Compare commits

..

74 Commits

Author SHA1 Message Date
Thomas Schönauer
d8748b004b Update check-and-lint.yaml 2022-11-03 19:40:24 +00:00
Thomas Schönauer
16953409fd Get windows to finish clippy without errors (#133)
* Changes windows get_wsl_distribution argument

* changes in get_wsl_distributions

* changes in run_wsl_topgrade due to clippy errors
2022-11-03 19:34:27 +00:00
Thomas Schönauer
c85adb8980 Update check-and-lint.yaml 2022-11-03 19:19:00 +00:00
Thomas Schönauer
91554cac56 GitHub action cleanup2 (#132)
* Changed clippy args for PR pipeline

* changes crates-publish toolchain version to stable

* Enhanced clippy for PRs

* Fixes typo
2022-11-03 19:09:44 +00:00
Thomas Schönauer
7256aaffc8 Resolve clippy errors (#131)
* Resolves clippy errors

* Fixes clippy errors

* Changes get_wsl_distributions arguments from pointer to value
2022-11-03 19:04:06 +00:00
Thomas Schönauer
66e0b94e85 Resolve clippy errors (#130)
* Resolves clippy errors

* Fixes clippy errors
2022-11-03 18:54:40 +00:00
Thomas Schönauer
4dcb5a214b GitHub action cleanups (#129)
* Changed clippy args for PR pipeline

* changes crates-publish toolchain version to stable

* Enhanced clippy for PRs
2022-11-03 18:53:37 +00:00
Thomas Schönauer
8731fd2b3f Resolves clippy errors (#128) 2022-11-03 18:29:22 +00:00
Thomas Schönauer
9233846479 Update release-cross.yml 2022-11-03 17:11:47 +00:00
Thomas Schönauer
94bdb8c3fd Update release.yml 2022-11-03 17:11:28 +00:00
Thomas Schönauer
632fcb5b77 Changes version requirements to latest path of minor version (#127) 2022-11-03 17:05:09 +00:00
Rebecca Turner
55ba2d30c1 Quote arguments when executing in a shell (#118)
* Quote arguments when executing in a shell

Fixes #107

* Parse quotes in `tmux_arguments`

This makes it possible to encode spaces in arguments. Maybe the config
value should be an array instead?

* Print error causes

Co-authored-by: Thomas Schönauer <37108907+DottoDev@users.noreply.github.com>
2022-11-03 16:46:43 +00:00
0xMRTT
ff66611ec0 fix: update debian os release (8->11) (#123) 2022-11-03 15:57:16 +01:00
pan93412
edc3dd6b0b refactor(ctrlc): Remove reduntant lazy_static (#109) 2022-11-03 15:57:16 +01:00
pan93412
623a11cf21 refactor!(steps/node): make PNPM a separated step (#114) 2022-11-03 15:57:16 +01:00
pan93412
7a83f38ca8 fix(steps/node): Only run global upgrade on Yarn 1.x (#112) 2022-11-03 15:57:16 +01:00
Thomas Schönauer
9a19b547c6 Revert clap version bump (#111)
* Update README.md

* Update release-cross.yml

* Update release.yml

* style(self_update): Run cargo fmt (#108)

The commit 9105a8aac is not formatted, which breaks the CI check.

Co-authored-by: Thomas Schönauer <37108907+DottoDev@users.noreply.github.com>

* Clap dependencie change

* Revert clap changes

Co-authored-by: pan93412 <pan93412@gmail.com>
2022-11-03 15:57:16 +01:00
0xMRTT
aae5c3b631 fix: link in readme (#120) 2022-11-03 09:35:34 +00:00
0xMRTT
3be75bf399 feat: add issue config (#122) 2022-11-03 09:35:12 +00:00
pan93412
a7c2262537 refactor: Run cargo clippy --fix (#113) 2022-11-02 20:26:20 +00:00
Thomas Schönauer
16a7d5f00b Cleanup CI/CD pipeline (#115) 2022-11-02 16:25:54 +00:00
pan93412
be0984cdf3 style(self_update): Run cargo fmt (#108)
The commit 9105a8aac is not formatted, which breaks the CI check.

Co-authored-by: Thomas Schönauer <37108907+DottoDev@users.noreply.github.com>
2022-11-02 14:55:59 +00:00
Thomas Schönauer
fb13543e44 Update release.yml 2022-11-02 14:54:52 +00:00
Thomas Schönauer
c406fe2775 Update release-cross.yml 2022-11-02 14:53:49 +00:00
Thomas Schönauer
ce0c0c4314 Update README.md 2022-11-02 12:17:59 +01:00
Sohum
9105a8aacf Fixes some references to the original topgrade repo (#41) 2022-11-02 10:10:16 +00:00
Benjamin Stürz
f26e48acca OpenBSD support (#104) 2022-11-02 10:00:10 +00:00
Pascal Jufer
b81f28a73a Use upper-case naming (Topgrade) everywhere (#96) 2022-11-01 22:21:30 +00:00
Thomas Schönauer
6cb9e96151 Adds nala on android support (#97) 2022-11-01 22:20:47 +00:00
Thomas Schönauer
027c99ea6b Update release-cross.yml 2022-10-31 17:36:55 +00:00
Thomas Schönauer
c191c073a0 Update release.yml 2022-10-31 17:36:22 +00:00
Thomas Schönauer
1bdc948a81 Update release.yml 2022-10-31 17:27:16 +00:00
Thomas Schönauer
381f13fe9c Update release-cross.yml 2022-10-31 17:26:57 +00:00
Thomas Schönauer
88e43a12d6 10.1.0 release (#101)
* Version bump to v10.1.0

* clap version bump to stop fmt error
2022-10-31 17:22:48 +00:00
Thomas Schönauer
b9d93e203a Version bump to v10.1.0 (#100) 2022-10-31 17:13:44 +00:00
Thomas Schönauer
f88998faf5 Release pipeline (#99)
* New CD pipeline

* Add AUR CD pipeline
2022-10-31 17:06:34 +00:00
Thomas Schönauer
96c22ffdf5 New CD pipeline (#98) 2022-10-31 16:46:25 +00:00
Rebecca Turner
dc07144918 Add fundle step (#90) 2022-10-31 06:05:43 +00:00
Rebecca Turner
d8bac65317 Add rcm step (#91) 2022-10-31 06:05:12 +00:00
Rebecca Turner
18cec5c9fa Add ghcup step (#89) 2022-10-30 16:34:14 +00:00
Thomas Schönauer
5a6f0d2e15 Revert CD changes 2022-10-28 18:52:00 +00:00
Thomas Schönauer
d9e49312b6 Release pipeline Test (#87)
* Added other release workflows

* Typo1

* Add name

* Typo2
2022-10-28 18:48:14 +00:00
Thomas Schönauer
0b83333ca7 Adds ToDo to README.md 2022-10-28 16:36:05 +02:00
LeSnake04
bf7f9a64ee Extra options for distrobox (#83) 2022-10-27 22:29:35 +00:00
Marcin Puc
6a3de81f1f Bump clap version to 4.0 (#81) 2022-10-27 15:51:43 +00:00
Pascal Jufer
3a5cc8a388 Enhance the README (#82) 2022-10-27 14:38:44 +00:00
LeSnake04
639c7fd422 feat: added distrobox (#76) 2022-10-26 22:12:38 +00:00
shura
31aae2198c Fix neovim upgrade (#77) 2022-10-26 21:27:59 +00:00
Thomas Schönauer
573bae7511 changed back to topgrade from topgrade-rs (#79)
* Rename back to topgrade

* Bugfix Version bump
2022-10-26 20:45:49 +00:00
Thomas Schönauer
d7891c4754 Ads runs-on for crates-publish action
Solves issue in #70
2022-10-26 11:48:02 +00:00
Kamil Borsuk
2861044501 Don't panic on git repository with no remote (#71) 2022-10-26 09:21:57 +00:00
Martin Kunz
b565aa5f71 Add(CI): For automatically publishing on new versions (#70)
* Add(CI): For automatically publishing on new versions

* Fix(CI): added on push to main

* Fix(CI): Add publish job

* add(CI): semver check

* edit(CI): Name

Also checks semver so added that to the workflow name.
2022-10-25 18:06:09 +00:00
Thomas Schönauer
7d3227c5c3 35 add support for aura aur helper (#63)
* Adds Archlinux Aura Package Manager support

* Added config support

* Fixes/adds config for aura

* changes aura arguments

* Let Aura only use sudo

* Corrects wrong order of commands
2022-10-23 21:29:25 +00:00
Thomas Schönauer
ea84fbd9a7 Build script improvements (#67) 2022-10-23 17:46:45 +00:00
Thomas Schönauer
347372ca71 Resolves clippy errors, please review!!! (#60) 2022-10-23 11:34:30 +00:00
Thomas Schönauer
6000124062 Add release targets (#62)
* add win/macos release targets

* Add manual run option

* Deleted Clippy check on release

* Changes toolchain version
2022-10-22 16:24:10 +00:00
Thomas Schönauer
9b33a07377 add win/macos release targets (#61)
* add win/macos release targets

* Add manual run option
2022-10-22 16:13:03 +00:00
Manuel
785bf11300 Backwards compatibility with fisher v3 (#55) 2022-10-22 10:48:32 +00:00
Thomas Schönauer
fb91e0b540 Update build-all.sh 2022-10-22 09:50:55 +00:00
Thomas Schönauer
30c3fcc4fc 10.0.0 fixes (#59)
Changed binary name to be backwards compatible
2022-10-22 09:49:32 +00:00
Thomas Schönauer
f274935a0c Fixes Antigen (#58)
Fixes antigen update (#53)

* Fixed antigen update

* Update src/steps/zsh.rs

Co-authored-by: xyz1001 <zgzf1001@gmail.com>

Co-authored-by: xyz1001 <zgzf1001@gmail.com>

Co-authored-by: xyz1001 <zgzf1001@gmail.com>
2022-10-22 09:47:39 +00:00
Thomas Schönauer
e7eda846a2 Adds simple Platform build script (#57)
* Added build scripts for multiple platforms

* Changed format of windows package to .zip

* Added print checksum
2022-10-22 09:36:37 +00:00
Thomas Schönauer
97c1200b79 Update README.md 2022-10-22 09:27:27 +00:00
Thomas Schönauer
3797fc7bae Fix nix profile upgrade command & add profile path detection (#56)
* Fixes antigen update (#39)

* Adds manifest.json check to nix

* #34 Fix `nix profile upgrade` command & add profile path detection (#4)

Authored-by: Manu [tennox] <2084639+tennox@users.noreply.github.com>
2022-10-22 09:26:49 +00:00
Sandro
7b512f1e00 Fix lock file (#54) 2022-10-21 21:49:54 +00:00
Thomas Schönauer
c5566ef43e Update Cargo.toml 2022-10-21 20:19:20 +00:00
Thomas Schönauer
2d52d114be Changed binary name to be backwards compatible, version bump to 10.0.0 (#48)
Changed binary name to be backwards compatible
2022-10-21 20:15:47 +00:00
Thomas Schönauer
08813259a8 Added build scripts for multiple platforms (#47) 2022-10-21 18:41:09 +00:00
Thomas Schönauer
b724aa0f58 Reverse version bump 2022-10-19 15:31:45 +00:00
Manuel
4dccca3d81 Revert fix for older fisher version (#37) 2022-10-19 11:16:38 +00:00
Thomas Schönauer
805d1f8bae Adds Contribution paragraphs to README 2022-10-19 10:55:09 +02:00
Thomas Schönauer
e4e246ddb5 Version bump (#36) 2022-10-18 21:00:44 +00:00
Thomas Schönauer
7528aa090b Fix broken fisher update command (#33) 2022-10-18 18:42:47 +00:00
Manuel
9cd155f7ea Update broken fisher command
```
fisher: unknown flag or command "update"
usage: fisher add <package...>     Add packages
       fisher rm  <package...>     Remove packages
       fisher                      Update all packages
       fisher ls  [<regex>]        List installed packages matching <regex>
       fisher --help               Show this help
       fisher --version            Show the current version
       fisher self-update          Update to the latest version
       fisher self-uninstall       Uninstall from your system
```
2022-10-18 15:39:35 +01:00
50 changed files with 1247 additions and 541 deletions

5
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: GitHub Discussions
url: https://github.com/topgrade-rs/topgrade/discussions
about: Please ask and answer questions here.

View File

@@ -1,24 +0,0 @@
name: Cargo Build & Test
on:
push:
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
build_and_test:
name: Rust project - latest
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- stable
- beta
- nightly
steps:
- uses: actions/checkout@v3
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- run: cargo build --verbose
- run: cargo test --verbose

View File

@@ -10,7 +10,10 @@ name: Check and Lint
jobs:
check:
name: Check
runs-on: ubuntu-latest
strategy:
matrix:
platform: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
@@ -24,7 +27,10 @@ jobs:
fmt:
name: Rustfmt
runs-on: ubuntu-latest
strategy:
matrix:
platform: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
@@ -40,7 +46,10 @@ jobs:
clippy:
name: Clippy
runs-on: ubuntu-latest
strategy:
matrix:
platform: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
@@ -48,8 +57,13 @@ jobs:
toolchain: stable
components: clippy
override: true
- uses: actions-rs/clippy-check@v1
- uses: actions-rs/cargo@v1.0.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
command: clippy
args: --all-targets --locked -- -D warnings
name: Clippy Output
- uses: actions-rs/cargo@v1.0.1
with:
command: clippy
args: --all-targets --locked --all-features -- -D warnings
name: Clippy (All features) Output

27
.github/workflows/check-semver.yml vendored Normal file
View File

@@ -0,0 +1,27 @@
on:
release:
types: [published, edited]
name: Check SemVer compliance
jobs:
prepare:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-08-03
override: true
components: rustfmt, clippy
semver:
runs-on: ubuntu-latest
steps:
- uses: actions-rs/cargo@v1
with:
command: install
args: --git https://github.com/rust-lang/rust-semverver
- run: eval "current_version=$(grep -e '^version = .*$' Cargo.toml | cut -d ' ' -f 3)"
- run: cargo semver | tee semver_out
- run: (head -n 1 semver_out | grep "\-> $current_version") || (echo "versioning mismatch" && return 1)

29
.github/workflows/crates-publish.yml vendored Normal file
View File

@@ -0,0 +1,29 @@
on:
# workflow_run:
# workflows: ["Check SemVer compliance"]
# types:
# - completed
release:
types: [published, edited]
name: Publish to crates.io on release
jobs:
prepare:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
publish:
runs-on: ubuntu-latest
steps:
- uses: katyo/publish-crates@v1
with:
dry-run: true
check-repo: ${{ github.event_name == 'push' }}
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
ignore-unpublished-changes: true

70
.github/workflows/release-cross.yml vendored Normal file
View File

@@ -0,0 +1,70 @@
name: Publish release files for non-cd-native environments
on:
# workflow_run:
# workflows: ["Check SemVer compliance"]
# types:
# - completed
release:
types: [ created ]
jobs:
build:
strategy:
fail-fast: false
matrix:
target: [ "aarch64-unknown-linux-gnu", "armv7-unknown-linux-gnueabihf", "x86_64-unknown-linux-musl", "aarch64-unknown-linux-musl", "x86_64-unknown-freebsd", ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
override: true
target: ${{ matrix.target }}
components: rustfmt, clippy
- uses: actions-rs/cargo@v1.0.1
name: Check format
with:
use-cross: true
command: fmt
args: --all -- --check
- uses: actions-rs/cargo@v1.0.1
name: Run clippy
with:
command: clippy
use-cross: true
args: --all-targets --locked --target ${{matrix.target}} -- -D warnings
- uses: actions-rs/cargo@v1.0.1
name: Run clippy (All features)
with:
command: clippy
use-cross: true
args: --locked --all-features --target ${{matrix.target}} -- -D warnings
- uses: actions-rs/cargo@v1.0.1
name: Run tests
with:
command: test
use-cross: true
args: --target ${{matrix.target}}
- uses: actions-rs/cargo@v1.0.1
name: Build
with:
command: build
use-cross: true
args: --release --all-features --target ${{matrix.target}}
- name: Rename Release
run: |
mkdir assets
FILENAME=topgrade-${{github.event.release.tag_name}}-${{matrix.target}}
mv target/${{matrix.target}}/release/topgrade assets
cd assets
tar --format=ustar -czf $FILENAME.tar.gz topgrade
rm topgrade
ls .
- name: Release
uses: softprops/action-gh-release@v1
with:
files: assets/*

View File

@@ -1,28 +0,0 @@
on:
workflow_dispatch:
push:
branches:
- main
name: Release Packaging
jobs:
release:
name: Release Packaging
env:
PROJECT_NAME_UNDERSCORE: topgrade-rs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Release Build
run: cargo build --release
- name: 'Upload Artifact'
uses: actions/upload-artifact@v2
with:
name: ${{ env.PROJECT_NAME_UNDERSCORE }}
path: target/release/${{ env.PROJECT_NAME_UNDERSCORE }}

77
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,77 @@
name: Publish release files for CD native environments
on:
# workflow_run:
# workflows: ["Check SemVer compliance"]
# types:
# - completed
release:
types: [ created ]
jobs:
build:
strategy:
fail-fast: false
matrix:
platform: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
components: rustfmt, clippy
- uses: actions-rs/cargo@v1.0.1
name: Check format
with:
command: fmt
args: --all -- --check
- uses: actions-rs/cargo@v1.0.1
name: Run clippy
with:
command: clippy
args: --all-targets --locked -- -D warnings
- uses: actions-rs/cargo@v1.0.1
name: Run clippy (All features)
with:
command: clippy
args: --all-targets --locked --all-features -- -D warnings
- uses: actions-rs/cargo@v1.0.1
name: Run tests
with:
command: test
- uses: actions-rs/cargo@v1.0.1
name: Build
with:
command: build
args: --release --all-features
- name: Rename Release (Unix)
run: |
cargo install default-target
mkdir assets
FILENAME=topgrade-${{github.event.release.tag_name}}-$(default-target)
mv target/release/topgrade assets
cd assets
tar --format=ustar -czf $FILENAME.tar.gz topgrade
rm topgrade
ls .
if: ${{ matrix.platform != 'windows-latest' }}
shell: bash
- name: Rename Release (Windows)
run: |
cargo install default-target
mkdir assets
FILENAME=topgrade-${{github.event.release.tag_name}}-$(default-target)
mv target/release/topgrade.exe assets/topgrade.exe
cd assets
powershell Compress-Archive -Path * -Destination ${FILENAME}.zip
rm topgrade.exe
ls .
if: ${{ matrix.platform == 'windows-latest' }}
shell: bash
- name: Release
uses: softprops/action-gh-release@v1
with:
files: assets/*

View File

@@ -1,24 +0,0 @@
name: Rust
on:
push:
branches: [ "master", "dev" ]
pull_request:
branches: [ "master", "dev" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build
run: cargo build --verbose
- name: Fmt
run: cargo fmt --check --all
- name: Run tests
run: cargo test --verbose

View File

@@ -1,10 +1,12 @@
on:
pull_request:
push:
branches:
- main
env:
CARGO_TERM_COLOR: always
name: Test with Code Coverage
jobs:

22
.github/workflows/update_aur.yml vendored Normal file
View File

@@ -0,0 +1,22 @@
name: Publish to AUR
on:
# workflow_run:
# workflows: ["Check SemVer compliance"]
# types:
# - completed
push:
tags:
- "v*"
jobs:
aur-publish:
runs-on: ubuntu-latest
steps:
- name: Publish AUR package
uses: ATiltedTree/create-aur-release@v1
with:
package_name: topgrade
commit_username: "Thomas Schönauer"
commit_email: t.schoenauer@hgs-wt.at
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
/target
/build
**/*.rs.bk

6
.vscode/launch.json vendored
View File

@@ -12,11 +12,11 @@
"cargo": {
"args": [
"build",
"--bin=topgrade",
"--package=topgrade"
"--bin=topgrade-rs",
"--package=topgrade-rs"
],
"filter": {
"name": "topgrade",
"name": "topgrade-rs",
"kind": "bin"
}
},

311
Cargo.lock generated
View File

@@ -39,9 +39,9 @@ dependencies = [
[[package]]
name = "anyhow"
version = "1.0.65"
version = "1.0.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98161a4e3e2184da77bb14f02184cdd111e83bbbcc9979dfee3c44b9a85f5602"
checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6"
[[package]]
name = "async-broadcast"
@@ -81,16 +81,16 @@ dependencies = [
[[package]]
name = "async-io"
version = "1.9.0"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83e21f3a490c72b3b0cf44962180e60045de2925d8dff97918f7ee43c8f637c7"
checksum = "e8121296a9f05be7f34aa4196b1747243b3b62e048bb7906f644f3fbfc490cf7"
dependencies = [
"async-lock",
"autocfg",
"concurrent-queue",
"futures-lite",
"libc",
"log",
"once_cell",
"parking",
"polling",
"slab",
@@ -101,11 +101,12 @@ dependencies = [
[[package]]
name = "async-lock"
version = "2.5.0"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e97a171d191782fba31bb902b14ad94e24a68145032b7eedf871ab0bc0d077b6"
checksum = "c8101efe8695a6c17e02911402145357e718ac92d3ff88ae8419e84b1707b685"
dependencies = [
"event-listener",
"futures-lite",
]
[[package]]
@@ -127,9 +128,9 @@ checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524"
[[package]]
name = "async-trait"
version = "0.1.57"
version = "0.1.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76464446b8bc32758d7e88ee1a804d9914cd9b1cb264c029899680b0be29826f"
checksum = "1e805d94e6b5001b651426cf4cd446b1ab5f319d27bab5c644f61de0a804360c"
dependencies = [
"proc-macro2",
"quote",
@@ -155,9 +156,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "base64"
version = "0.13.0"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
[[package]]
name = "bitflags"
@@ -173,9 +174,9 @@ checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
[[package]]
name = "bumpalo"
version = "3.11.0"
version = "3.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d"
checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba"
[[package]]
name = "byteorder"
@@ -197,9 +198,9 @@ checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c"
[[package]]
name = "cc"
version = "1.0.73"
version = "1.0.74"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
checksum = "581f5dba903aac52ea3feb5ec4810848460ee833876f1f9b0fdeab1f19091574"
[[package]]
name = "cfg-if"
@@ -224,16 +225,16 @@ dependencies = [
[[package]]
name = "clap"
version = "3.2.22"
version = "3.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86447ad904c7fb335a790c9d7fe3d0d971dc523b8ccd1561a520de9a85302750"
checksum = "d2dbdf4bdacb33466e854ce889eee8dfd5729abf7ccd7664d0a2d60cd384440b"
dependencies = [
"atty",
"bitflags",
"clap_derive",
"clap_lex",
"indexmap",
"once_cell",
"lazy_static",
"strsim",
"termcolor",
"textwrap",
@@ -241,9 +242,9 @@ dependencies = [
[[package]]
name = "clap_derive"
version = "3.2.18"
version = "3.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65"
checksum = "25320346e922cffe59c0bbc5410c8d8784509efb321488971081313cb1e1a33c"
dependencies = [
"heck 0.4.0",
"proc-macro-error",
@@ -320,9 +321,9 @@ dependencies = [
[[package]]
name = "cxx"
version = "1.0.79"
version = "1.0.80"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f83d0ebf42c6eafb8d7c52f7e5f2d3003b89c7aa4fd2b79229209459a849af8"
checksum = "6b7d4e43b25d3c994662706a1d4fcfc32aaa6afd287502c111b237093bb23f3a"
dependencies = [
"cc",
"cxxbridge-flags",
@@ -332,9 +333,9 @@ dependencies = [
[[package]]
name = "cxx-build"
version = "1.0.79"
version = "1.0.80"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07d050484b55975889284352b0ffc2ecbda25c0c55978017c132b29ba0818a86"
checksum = "84f8829ddc213e2c1368e51a2564c552b65a8cb6a28f31e576270ac81d5e5827"
dependencies = [
"cc",
"codespan-reporting",
@@ -347,15 +348,15 @@ dependencies = [
[[package]]
name = "cxxbridge-flags"
version = "1.0.79"
version = "1.0.80"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99d2199b00553eda8012dfec8d3b1c75fce747cf27c169a270b3b99e3448ab78"
checksum = "e72537424b474af1460806647c41d4b6d35d09ef7fe031c5c2fa5766047cc56a"
[[package]]
name = "cxxbridge-macro"
version = "1.0.79"
version = "1.0.80"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcb67a6de1f602736dd7eaead0080cf3435df806c61b24b13328db128c58868f"
checksum = "309e4fb93eed90e1e14bea0da16b209f81813ba9fc7830c20ed151dd7bc0a4d7"
dependencies = [
"proc-macro2",
"quote",
@@ -501,9 +502,9 @@ dependencies = [
[[package]]
name = "filetime"
version = "0.2.17"
version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e94a7bbaa59354bc20dd75b67f23e2797b4490e9d6928203fb105c79e448c86c"
checksum = "4b9663d381d07ae25dc88dbdf27df458faa83a9b25336bcac83d5e452b5fc9d3"
dependencies = [
"cfg-if",
"libc",
@@ -538,9 +539,9 @@ dependencies = [
[[package]]
name = "futures"
version = "0.3.24"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f21eda599937fba36daeb58a22e8f5cee2d14c4a17b5b7739c7c8e5e3b8230c"
checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0"
dependencies = [
"futures-channel",
"futures-core",
@@ -553,9 +554,9 @@ dependencies = [
[[package]]
name = "futures-channel"
version = "0.3.24"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30bdd20c28fadd505d0fd6712cdfcb0d4b5648baf45faef7f852afb2399bb050"
checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed"
dependencies = [
"futures-core",
"futures-sink",
@@ -563,15 +564,15 @@ dependencies = [
[[package]]
name = "futures-core"
version = "0.3.24"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf"
checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac"
[[package]]
name = "futures-executor"
version = "0.3.24"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ff63c23854bee61b6e9cd331d523909f238fc7636290b96826e9cfa5faa00ab"
checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2"
dependencies = [
"futures-core",
"futures-task",
@@ -580,9 +581,9 @@ dependencies = [
[[package]]
name = "futures-io"
version = "0.3.24"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbf4d2a7a308fd4578637c0b17c7e1c7ba127b8f6ba00b29f717e9655d85eb68"
checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb"
[[package]]
name = "futures-lite"
@@ -601,9 +602,9 @@ dependencies = [
[[package]]
name = "futures-macro"
version = "0.3.24"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42cd15d1c7456c04dbdf7e88bcd69760d74f3a798d6444e16974b505b0e62f17"
checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d"
dependencies = [
"proc-macro2",
"quote",
@@ -612,21 +613,21 @@ dependencies = [
[[package]]
name = "futures-sink"
version = "0.3.24"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21b20ba5a92e727ba30e72834706623d94ac93a725410b6a6b6fbc1b07f7ba56"
checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9"
[[package]]
name = "futures-task"
version = "0.3.24"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6508c467c73851293f390476d4491cf4d227dbabcd4170f3bb6044959b294f1"
checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea"
[[package]]
name = "futures-util"
version = "0.3.24"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44fb6cb1be61cc1d2e43b262516aafcf63b241cffdb1d3fa115f91d9c7b09c90"
checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6"
dependencies = [
"futures-channel",
"futures-core",
@@ -642,9 +643,9 @@ dependencies = [
[[package]]
name = "getrandom"
version = "0.2.7"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6"
checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31"
dependencies = [
"cfg-if",
"libc",
@@ -659,9 +660,9 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
[[package]]
name = "h2"
version = "0.3.14"
version = "0.3.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ca32592cf21ac7ccab1825cd87f6c9b3d9022c44d086172ed0966bec8af30be"
checksum = "62eeb471aa3e3c9197aa4bfeabfe02982f6dc96f750486c0bb0009ac58b26d2b"
dependencies = [
"bytes",
"fnv",
@@ -715,6 +716,15 @@ version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]]
name = "home"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "747309b4b440c06d57b0b25f2aee03ee9b5e5397d288c60e21fc709bb98a7408"
dependencies = [
"winapi",
]
[[package]]
name = "http"
version = "0.2.8"
@@ -760,9 +770,9 @@ dependencies = [
[[package]]
name = "hyper"
version = "0.14.20"
version = "0.14.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac"
checksum = "abfba89e19b959ca163c7752ba59d737c1ceea53a5d31a149c805446fc958064"
dependencies = [
"bytes",
"futures-channel",
@@ -797,9 +807,9 @@ dependencies = [
[[package]]
name = "iana-time-zone"
version = "0.1.51"
version = "0.1.53"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5a6ef98976b22b3b7f2f3a806f858cb862044cfa66805aa3ad84cb3d3b785ed"
checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765"
dependencies = [
"android_system_properties",
"core-foundation-sys",
@@ -889,9 +899,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.135"
version = "0.2.137"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68783febc7782c6c5cb401fbda4de5a9898be1762314da0bb2c10ced61f18b0c"
checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89"
[[package]]
name = "link-cplusplus"
@@ -931,7 +941,7 @@ dependencies = [
"dirs-next",
"objc-foundation",
"objc_id",
"time 0.3.15",
"time 0.3.16",
]
[[package]]
@@ -975,14 +985,24 @@ dependencies = [
[[package]]
name = "mio"
version = "0.8.4"
version = "0.7.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf"
checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc"
dependencies = [
"libc",
"log",
"wasi 0.11.0+wasi-snapshot-preview1",
"windows-sys",
"miow",
"ntapi",
"winapi",
]
[[package]]
name = "miow"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21"
dependencies = [
"winapi",
]
[[package]]
@@ -1024,6 +1044,15 @@ dependencies = [
"zvariant_derive",
]
[[package]]
name = "ntapi"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f"
dependencies = [
"winapi",
]
[[package]]
name = "num-integer"
version = "0.1.45"
@@ -1099,9 +1128,9 @@ dependencies = [
[[package]]
name = "once_cell"
version = "1.15.0"
version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1"
checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860"
[[package]]
name = "ordered-multimap"
@@ -1125,9 +1154,9 @@ dependencies = [
[[package]]
name = "os_str_bytes"
version = "6.3.0"
version = "6.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff"
checksum = "3baf96e39c5359d2eb0dd6ccb42c62b91d9678aa68160d261b9e0ccbf9e9dea9"
[[package]]
name = "parking"
@@ -1147,9 +1176,9 @@ dependencies = [
[[package]]
name = "parking_lot_core"
version = "0.9.3"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929"
checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0"
dependencies = [
"cfg-if",
"libc",
@@ -1191,9 +1220,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "polling"
version = "2.3.0"
version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "899b00b9c8ab553c743b3e11e87c5c7d423b2a2de229ba95b24a756344748011"
checksum = "ab4609a838d88b73d8238967b60dd115cc08d38e2bbaf51ee1e4b695f89122e2"
dependencies = [
"autocfg",
"cfg-if",
@@ -1348,9 +1377,9 @@ dependencies = [
[[package]]
name = "regex"
version = "1.6.0"
version = "1.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b"
checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1"
dependencies = [
"aho-corasick",
"memchr",
@@ -1438,9 +1467,9 @@ dependencies = [
[[package]]
name = "rustls"
version = "0.20.6"
version = "0.20.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5aab8ee6c7097ed6057f43c187a62418d0c05a4bd5f18b3571db50ee0f9ce033"
checksum = "539a2bfe908f471bfa933876bd1eb6a19cf2176d375f82ef7f99530a40e48c2c"
dependencies = [
"log",
"ring",
@@ -1529,18 +1558,18 @@ checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4"
[[package]]
name = "serde"
version = "1.0.145"
version = "1.0.147"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "728eb6351430bccb993660dfffc5a72f91ccc1295abaa8ce19b27ebe4f75568b"
checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.145"
version = "1.0.147"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81fa1584d3d1bcacd84c277a0dfe21f5b0f6accf4a23d04d4c6d61f1af522b4c"
checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852"
dependencies = [
"proc-macro2",
"quote",
@@ -1549,9 +1578,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.86"
version = "1.0.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41feea4228a6f1cd09ec7a3593a682276702cd67b5273544757dae23c096f074"
checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45"
dependencies = [
"itoa",
"ryu",
@@ -1596,6 +1625,12 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012"
[[package]]
name = "shell-words"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde"
[[package]]
name = "shellexpand"
version = "2.1.2"
@@ -1702,9 +1737,9 @@ dependencies = [
[[package]]
name = "syn"
version = "1.0.102"
version = "1.0.103"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fcd952facd492f9be3ef0d0b7032a6e442ee9b361d4acc2b1d0c4aaa5f613a1"
checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d"
dependencies = [
"proc-macro2",
"quote",
@@ -1745,13 +1780,13 @@ dependencies = [
[[package]]
name = "tempfile"
version = "3.3.0"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22"
dependencies = [
"cfg-if",
"fastrand",
"libc",
"rand",
"redox_syscall",
"remove_dir_all",
"winapi",
@@ -1815,21 +1850,32 @@ dependencies = [
[[package]]
name = "time"
version = "0.3.15"
version = "0.3.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d634a985c4d4238ec39cacaed2e7ae552fbd3c476b552c1deac3021b7d7eaf0c"
checksum = "0fab5c8b9980850e06d92ddbe3ab839c062c801f3927c0fb8abd6fc8e918fbca"
dependencies = [
"itoa",
"libc",
"num_threads",
"serde",
"time-core",
"time-macros",
]
[[package]]
name = "time-macros"
version = "0.2.4"
name = "time-core"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792"
checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd"
[[package]]
name = "time-macros"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "65bb801831d812c562ae7d2bfb531f26e66e4e1f6b17307ba4149c5064710e5b"
dependencies = [
"time-core",
]
[[package]]
name = "tinyvec"
@@ -1848,9 +1894,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]]
name = "tokio"
version = "1.21.2"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099"
checksum = "cd3b82e6e823a9ee7d7f64b08f8ac3d5f08ac988f23157194bd32af3f2f92767"
dependencies = [
"autocfg",
"bytes",
@@ -1858,9 +1904,9 @@ dependencies = [
"memchr",
"mio",
"num_cpus",
"once_cell",
"pin-project-lite",
"signal-hook-registry",
"socket2",
"winapi",
]
@@ -1877,16 +1923,16 @@ dependencies = [
[[package]]
name = "tokio-util"
version = "0.7.4"
version = "0.6.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740"
checksum = "9e99e1983e5d376cd8eb4b66604d2e99e79f5bd988c3055891dcd8c9e2604cc0"
dependencies = [
"bytes",
"futures-core",
"futures-sink",
"log",
"pin-project-lite",
"tokio",
"tracing",
]
[[package]]
@@ -1899,8 +1945,8 @@ dependencies = [
]
[[package]]
name = "topgrade-rs"
version = "9.1.0"
name = "topgrade"
version = "10.1.0"
dependencies = [
"anyhow",
"cfg-if",
@@ -1910,6 +1956,7 @@ dependencies = [
"directories",
"futures",
"glob",
"home",
"lazy_static",
"log",
"nix 0.24.2",
@@ -1921,6 +1968,7 @@ dependencies = [
"self_update",
"semver",
"serde",
"shell-words",
"shellexpand",
"strum 0.24.1",
"sys-info",
@@ -2188,13 +2236,12 @@ dependencies = [
[[package]]
name = "which"
version = "4.3.0"
version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c831fbbee9e129a8cf93e7747a82da9d95ba8e16621cae60ec2cdc849bacb7b"
checksum = "b55551e42cbdf2ce2bedd2203d0cc08dba002c27510f86dab6d0ce304cba3dfe"
dependencies = [
"either",
"libc",
"once_cell",
]
[[package]]
@@ -2249,22 +2296,24 @@ dependencies = [
[[package]]
name = "windows-sys"
version = "0.36.1"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
dependencies = [
"windows_aarch64_msvc 0.36.1",
"windows_i686_gnu 0.36.1",
"windows_i686_msvc 0.36.1",
"windows_x86_64_gnu 0.36.1",
"windows_x86_64_msvc 0.36.1",
"windows_aarch64_gnullvm",
"windows_aarch64_msvc 0.42.0",
"windows_i686_gnu 0.42.0",
"windows_i686_msvc 0.42.0",
"windows_x86_64_gnu 0.42.0",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc 0.42.0",
]
[[package]]
name = "windows_aarch64_msvc"
version = "0.36.1"
name = "windows_aarch64_gnullvm"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e"
[[package]]
name = "windows_aarch64_msvc"
@@ -2273,10 +2322,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec7711666096bd4096ffa835238905bb33fb87267910e154b18b44eaabb340f2"
[[package]]
name = "windows_i686_gnu"
version = "0.36.1"
name = "windows_aarch64_msvc"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4"
[[package]]
name = "windows_i686_gnu"
@@ -2285,10 +2334,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "763fc57100a5f7042e3057e7e8d9bdd7860d330070251a73d003563a3bb49e1b"
[[package]]
name = "windows_i686_msvc"
version = "0.36.1"
name = "windows_i686_gnu"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7"
[[package]]
name = "windows_i686_msvc"
@@ -2297,10 +2346,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bc7cbfe58828921e10a9f446fcaaf649204dcfe6c1ddd712c5eebae6bda1106"
[[package]]
name = "windows_x86_64_gnu"
version = "0.36.1"
name = "windows_i686_msvc"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246"
[[package]]
name = "windows_x86_64_gnu"
@@ -2309,10 +2358,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6868c165637d653ae1e8dc4d82c25d4f97dd6605eaa8d784b5c6e0ab2a252b65"
[[package]]
name = "windows_x86_64_msvc"
version = "0.36.1"
name = "windows_x86_64_gnu"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028"
[[package]]
name = "windows_x86_64_msvc"
@@ -2320,6 +2375,12 @@ version = "0.39.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e4d40883ae9cae962787ca76ba76390ffa29214667a111db9e0a1ad8377e809"
[[package]]
name = "windows_x86_64_msvc"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5"
[[package]]
name = "winreg"
version = "0.10.1"
@@ -2412,7 +2473,7 @@ dependencies = [
"crc32fast",
"crossbeam-utils",
"flate2",
"time 0.3.15",
"time 0.3.16",
]
[[package]]

View File

@@ -1,54 +1,63 @@
[package]
name = "topgrade-rs"
description = "Upgrade all the things, successor of topgrade"
name = "topgrade"
description = "Upgrade all the things"
categories = ["os"]
keywords = ["upgrade", "update"]
license-file = "LICENSE"
repository = "https://github.com/topgrade-rs/topgrade"
version = "9.1.0"
version = "10.1.0"
authors = ["Roey Darwish Dror <roey.ghost@gmail.com>", "Thomas Schönauer <t.schoenauer@hgs-wt.at>"]
exclude = ["doc/screenshot.gif"]
edition = "2018"
edition = "2021"
readme = "README.md"
[[bin]]
name = "topgrade"
path = "src/main.rs"
##[lib]
##name = "topgrade_lib"
[dependencies]
directories = "4.0"
serde = { version = "1.0", features = ["derive"] }
home = "~0.5"
directories = "~4.0"
serde = { version = "~1.0", features = ["derive"] }
toml = "0.5"
which_crate = { version = "4.1", package = "which" }
shellexpand = "2.1"
clap = { version = "3.1", features = ["cargo", "derive"] }
log = "0.4"
walkdir = "2.3"
console = "0.15"
lazy_static = "1.4"
chrono = "0.4"
pretty_env_logger = "0.4"
glob = "0.3"
strum = { version = "0.24", features = ["derive"] }
thiserror = "1.0"
anyhow = "1.0"
tempfile = "3.2"
cfg-if = "1.0"
tokio = { version = "1.5", features = ["process", "rt-multi-thread"] }
futures = "0.3"
regex = "1.5"
sys-info = "0.9"
semver = "1.0"
which_crate = { version = "~4.1", package = "which" }
shellexpand = "~2.1"
clap = { version = "~3.1", features = ["cargo", "derive"] }
log = "~0.4"
walkdir = "~2.3"
console = "~0.15"
lazy_static = "~1.4"
chrono = "~0.4"
pretty_env_logger = "~0.4"
glob = "~0.3"
strum = { version = "~0.24", features = ["derive"] }
thiserror = "~1.0"
anyhow = "~1.0"
tempfile = "~3.2"
cfg-if = "~1.0"
tokio = { version = "~1.5", features = ["process", "rt-multi-thread"] }
futures = "~0.3"
regex = "~1.5"
sys-info = "~0.9"
semver = "~1.0"
shell-words = "~1.1"
[target.'cfg(target_os = "macos")'.dependencies]
notify-rust = "4.5"
notify-rust = "~4.5"
[target.'cfg(unix)'.dependencies]
nix = "0.24"
rust-ini = "0.18"
self_update_crate = { version = "0.30", default-features = false, optional = true, package = "self_update", features = ["archive-tar", "compression-flate2", "rustls"] }
nix = "~0.24"
rust-ini = "~0.18"
self_update_crate = { version = "~0.30", default-features = false, optional = true, package = "self_update", features = ["archive-tar", "compression-flate2", "rustls"] }
[target.'cfg(windows)'.dependencies]
self_update_crate = { version = "0.30", default-features = false, optional = true, package = "self_update", features = ["archive-zip", "compression-zip-deflate", "rustls"] }
winapi = "0.3"
parselnk = "0.1"
self_update_crate = { version = "~0.30", default-features = false, optional = true, package = "self_update", features = ["archive-zip", "compression-zip-deflate", "rustls"] }
winapi = "~0.3"
parselnk = "~0.1"
[profile.release]
lto = true

View File

@@ -1,50 +1,89 @@
![Topgrade](doc/topgrade.png)
<!---
![GitHub release](https://img.shields.io/github/release/r-darwish/topgrade.svg)
[![Crates.io](https://img.shields.io/crates/v/topgrade.svg)](https://crates.io/crates/topgrade)
[![AUR](https://img.shields.io/aur/version/topgrade.svg)](https://aur.archlinux.org/packages/topgrade/)
![homebrew](https://img.shields.io/homebrew/v/topgrade.svg) -->
--->
<div align="center">
<img alt="Topgrade" src="doc/topgrade.png" width="850px">
![Demo](doc/screenshot.gif)
<!--
<a href="https://github.com/topgrade-rs/topgrade/releases"><img alt="GitHub Release" src="https://img.shields.io/github/release/r-darwish/topgrade.svg"></a>
<a href="https://crates.io/crates/topgrade"><img alt="crates.io" src="https://img.shields.io/crates/v/topgrade.svg"></a>
<a href="https://aur.archlinux.org/packages/topgrade"><img alt="AUR" src="https://img.shields.io/aur/version/topgrade.svg"></a>
<a href="https://formulae.brew.sh/formula/topgrade"><img alt="Homebrew" src="https://img.shields.io/homebrew/v/topgrade.svg"></a>
-->
## Fork
This is a fork of [topgrade by r-darwish](https://github.com/r-darwish/topgrade) to keep it maintained.
<img alt="Demo" src="doc/screenshot.gif" width="550px">
</div>
## Introduction
> **Note**
> This is a fork of [topgrade by r-darwish](https://github.com/r-darwish/topgrade) to keep it maintained.
Keeping your system up to date usually involves invoking multiple package managers.
This results in big, non-portable shell one-liners saved in your shell.
To remedy this, _topgrade_ detects which tools you use and runs the appropriate commands to update them.
To remedy this, **Topgrade** detects which tools you use and runs the appropriate commands to update them.
## Installation
- Arch Linux: [AUR](https://aur.archlinux.org/packages/topgrade/) package.
- Arch Linux: [AUR](https://aur.archlinux.org/packages/topgrade) package.
- NixOS: _topgrade_ package in `nixpkgs`.
- macOS: [Homebrew](https://brew.sh/) or [MacPorts](https://www.macports.org/install.php).
- macOS: [Homebrew](https://formulae.brew.sh/formula/topgrade) or [MacPorts](https://ports.macports.org/port/topgrade/).
Other systems users can either use `cargo install` or use the compiled binaries from the release page.
The compiled binaries contain a self-upgrading feature.
Topgrade requires Rust 1.51 or above.
## Documentation[WIP]
## Documentation
> **Warning**
> Work in Progress
You can visit the documentation at [topgrade-rs.github.io](https://topgrade-rs.github.io/) .
## Usage
Just run `topgrade`.
See [the wiki](https://github.com/r-darwish/topgrade/wiki/Step-list) for the list of things Topgrade supports.
See [the documentation](https://topgrade-rs.github.io/) for the list of things Topgrade supports.
## Customization
See `config.example.toml` for an example configuration file.
### Configuration path
The configuration should be placed in the following paths depending by the operating system:
* **Windows** - `%APPDATA%/topgrade.toml`
* **macOS** and **other Unix systems** - `${XDG_CONFIG_HOME:-~/.config}/topgrade.toml`
- **Windows** - `%APPDATA%/topgrade.toml`
- **macOS** and **other Unix systems** - `${XDG_CONFIG_HOME:-~/.config}/topgrade.toml`
## Contribution
### Problems or missing features?
Open a new Issue describing your problem and if possible with a possible solution.
### Missing a feature or found an unsupported tool/distro?
Just let us now what you are missing by opening an issue.
For tools please open an Issue describing the tool, which platforms it supports and if possible, give us an example of its usage.
### Want to contribute to the code?
Just fork the repository and start coding.
### Contribution Guidelines
- Check if your code passes `cargo fmt` and `cargo clippy`.
- Check if your code is self explanatory, if not it should be documented by comments.
- Make a Pull Request to the dev branch for new features or to the bug-fixes branch for bug fixes.
## Remote execution
You can specify a key called `remote_topgrades` in the configuration file.
This key should contain a list of hostnames that have topgrade installed on them.
This key should contain a list of hostnames that have Topgrade installed on them.
Topgrade will use `ssh` to run `topgrade` on remote hosts before acting locally.
To limit the execution only to specific hosts use the `--remote-host-limit` parameter.
## ToDo
- [ ] Add a proper testing framework to the code base.
- [ ] Add unit tests for package managers.
- [ ] Split up code into more maintainable parts, eg. putting every linux package manager in a own submodule of linux.rs.

92
build-all.sh Executable file
View File

@@ -0,0 +1,92 @@
#!/usr/bin/env sh
build_function() {
rustup update
cargo install cross
echo -n "Building x86_64-linux-gnu"
cross build --release --target x86_64-unknown-linux-gnu
echo -n "Building x86_64-linux-musl"
cross build --release --target x86_64-unknown-linux-musl
echo -n "Building x86_64-freebsd"
cross build --release --target x86_64-unknown-freebsd
echo -n "Building aarch64-linux-gnu"
cross build --release --target aarch64-unknown-linux-gnu
echo -n "Building aarch64-linux-musl"
cross build --release --target aarch64-unknown-linux-musl
echo -n "Building x86_64-windows-gnu"
cross build --release --target x86_64-pc-windows-gnu
}
package_function() {
cd build
mkdir x86_64-unknown-linux-gnu/
mkdir x86_64-unknown-linux-musl/
mkdir x86_64-unknown-freebsd/
mkdir x86_64-pc-windows-gnu/
mkdir aarch64-unknown-linux-gnu/
mkdir aarch64-unknown-linux-musl/
cp ../target/x86_64-unknown-linux-gnu/release/topgrade x86_64-unknown-linux-gnu/
cp ../target/x86_64-unknown-linux-musl/release/topgrade x86_64-unknown-linux-musl/
cp ../target/x86_64-unknown-freebsd/release/topgrade x86_64-unknown-freebsd/topgrade
cp ../target/aarch64-unknown-linux-gnu/release/topgrade aarch64-unknown-linux-gnu/topgrade
cp ../target/aarch64-unknown-linux-musl/release/topgrade aarch64-unknown-linux-musl/topgrade
cp ../target/x86_64-pc-windows-gnu/release/topgrade.exe x86_64-pc-windows-gnu/topgrade.exe
cd x86_64-unknown-linux-gnu/
tar -czf ../topgrade-${ans}-x86_64-linux-gnu.tar.gz topgrade
cd ..
cd x86_64-unknown-linux-musl
tar -czf ../topgrade-${ans}-x86_64-linux-musl.tar.gz topgrade
cd ..
cd x86_64-unknown-freebsd/
tar -czf ../topgrade-${ans}-x86_64-freebsd.tar.gz topgrade
cd ..
cd aarch64-unknown-linux-gnu/
tar -czf ../topgrade-${ans}-aarch64-linux-gnu.tar.gz topgrade
cd ..
cd aarch64-unknown-linux-musl/
tar -czf ../topgrade-${ans}-aarch64-linux-musl.tar.gz topgrade
cd ..
cd x86_64-pc-windows-gnu/
zip -q ../topgrade-${ans}-x86_64-windows.zip topgrade.exe
cd ..
cd ..
}
print_checksums() {
cd build/
sha256sum topgrade-${ans}-*
cd ../
}
while true; do
echo "You should always have a look on scripts you download from the internet."
read -p "Do you still want to proceed? (y/n) " yn
echo -n "Input version number: "
read ans
mkdir build
case $yn in
y ) build_function
package_function
print_checksums
break;;
n ) echo exiting...;
exit;;
* ) echo invalid response;;
esac
done

View File

@@ -70,10 +70,12 @@
#autoremove = true
[linux]
# Arch Package Manager to use. Allowed values: autodetect, trizen, paru, yay, pikaur, pacman, pamac.
# Arch Package Manager to use. Allowed values: autodetect, trizen, aura, paru, yay, pikaur, pacman, pamac.
#arch_package_manager = "pacman"
# Arguments to pass yay (or paru) when updating packages
#yay_arguments = "--nodevel"
#aura_aur_arguments = "-kx"
#aura_pacman_arguments = ""
#show_arch_news = true
#trizen_arguments = "--devel"
#pikaur_arguments = ""
@@ -105,3 +107,7 @@
[flatpak]
# Use sudo for updating the system-wide installation
#use_sudo = true
[distrobox]
#use_root = false
#containers = ["archlinux-latest"]

View File

@@ -1,16 +1,16 @@
#![allow(dead_code)]
use std::collections::BTreeMap;
use std::fs::write;
use std::path::PathBuf;
use std::process::Command;
use std::{env, fs};
use anyhow::Context;
use anyhow::Result;
use clap::{ArgEnum, Parser};
use directories::BaseDirs;
use log::debug;
use regex::Regex;
use serde::Deserialize;
use std::collections::BTreeMap;
use std::fs::write;
use std::path::PathBuf;
use std::process::Command;
use std::{env, fs};
use strum::{EnumIter, EnumString, EnumVariantNames, IntoEnumIterator};
use sys_info::hostname;
use which_crate::which;
@@ -83,6 +83,7 @@ pub enum Step {
Containers,
CustomCommands,
DebGet,
Distrobox,
Deno,
Dotnet,
Emacs,
@@ -92,6 +93,7 @@ pub enum Step {
Fossil,
Gcloud,
Gem,
Ghcup,
GithubCliExtensions,
GitRepos,
Go,
@@ -120,6 +122,7 @@ pub enum Step {
Powershell,
Protonup,
Raco,
Rcm,
Remotes,
Restarts,
Rtcl,
@@ -171,6 +174,14 @@ pub struct Windows {
enable_winget: Option<bool>,
}
#[derive(Deserialize, Default, Debug)]
#[serde(deny_unknown_fields)]
#[allow(clippy::upper_case_acronyms)]
pub struct Distrobox {
use_root: Option<bool>,
containers: Option<Vec<String>>,
}
#[derive(Deserialize, Default, Debug)]
#[serde(deny_unknown_fields)]
#[allow(clippy::upper_case_acronyms)]
@@ -216,12 +227,15 @@ pub enum ArchPackageManager {
Pacman,
Pikaur,
Pamac,
Aura,
}
#[derive(Deserialize, Default, Debug)]
#[serde(deny_unknown_fields)]
pub struct Linux {
yay_arguments: Option<String>,
aura_aur_arguments: Option<String>,
aura_pacman_arguments: Option<String>,
arch_package_manager: Option<ArchPackageManager>,
show_arch_news: Option<bool>,
trizen_arguments: Option<String>,
@@ -268,6 +282,8 @@ pub struct ConfigFile {
display_time: Option<bool>,
assume_yes: Option<bool>,
yay_arguments: Option<String>,
aura_aur_arguments: Option<String>,
aura_pacman_arguments: Option<String>,
no_retry: Option<bool>,
run_in_tmux: Option<bool>,
cleanup: Option<bool>,
@@ -287,6 +303,7 @@ pub struct ConfigFile {
firmware: Option<Firmware>,
vagrant: Option<Vagrant>,
flatpak: Option<Flatpak>,
distrobox: Option<Distrobox>,
}
fn config_directory(base_dirs: &BaseDirs) -> PathBuf {
@@ -609,9 +626,16 @@ impl Config {
}
/// Extra Tmux arguments
pub fn tmux_arguments(&self) -> &Option<String> {
&self.config_file.tmux_arguments
pub fn tmux_arguments(&self) -> anyhow::Result<Vec<String>> {
let args = &self.config_file.tmux_arguments.as_deref().unwrap_or_default();
shell_words::split(args)
// The only time the parse failed is in case of a missing close quote.
// The error message looks like this:
// Error: Failed to parse `tmux_arguments`: `'foo`
//
// Caused by:
// missing closing quote
.with_context(|| format!("Failed to parse `tmux_arguments`: `{args}`"))
}
/// Prompt for a key before exiting
@@ -764,9 +788,27 @@ impl Config {
/// Extra yay arguments
pub fn yay_arguments(&self) -> &str {
get_deprecated!(self.config_file, yay_arguments, linux, yay_arguments)
.as_deref()
.unwrap_or("--devel")
self.config_file
.linux
.as_ref()
.and_then(|s| s.yay_arguments.as_deref())
.unwrap_or("")
}
/// Extra aura arguments for AUR and pacman
pub fn aura_aur_arguments(&self) -> &str {
self.config_file
.linux
.as_ref()
.and_then(|s| s.aura_aur_arguments.as_deref())
.unwrap_or("")
}
pub fn aura_pacman_arguments(&self) -> &str {
self.config_file
.linux
.as_ref()
.and_then(|s| s.aura_pacman_arguments.as_deref())
.unwrap_or("")
}
/// Extra apt arguments
@@ -785,6 +827,20 @@ impl Config {
.and_then(|linux| linux.dnf_arguments.as_deref())
}
/// Distrobox use root
pub fn distrobox_root(&self) -> bool {
self.config_file
.distrobox
.as_ref()
.and_then(|r| r.use_root)
.unwrap_or(false)
}
/// Distrobox containers
pub fn distrobox_containers(&self) -> Option<&Vec<String>> {
self.config_file.distrobox.as_ref().and_then(|r| r.containers.as_ref())
}
/// Concurrency limit for git
pub fn git_concurrency_limit(&self) -> Option<usize> {
self.config_file.git.as_ref().and_then(|git| git.max_concurrency)

View File

@@ -1,10 +1,7 @@
use lazy_static::lazy_static;
use std::sync::atomic::{AtomicBool, Ordering};
lazy_static! {
/// A global variable telling whether the application has been interrupted.
static ref INTERRUPTED: AtomicBool = AtomicBool::new(false);
}
/// A global variable telling whether the application has been interrupted.
static INTERRUPTED: AtomicBool = AtomicBool::new(false);
/// Tells whether the program has been interrupted
pub fn interrupted() -> bool {

View File

@@ -194,11 +194,12 @@ impl DryCommand {
print!(
"Dry running: {} {}",
self.program.to_string_lossy(),
self.args
.iter()
.map(|a| String::from(a.to_string_lossy()))
.collect::<Vec<String>>()
.join(" ")
shell_words::join(
self.args
.iter()
.map(|a| String::from(a.to_string_lossy()))
.collect::<Vec<String>>()
)
);
match &self.directory {
Some(dir) => println!(" in {}", dir.to_string_lossy()),

2
src/lib.rs Normal file
View File

@@ -0,0 +1,2 @@
//pub mod steps;
//pub mod utils;

View File

@@ -79,7 +79,7 @@ fn run() -> Result<()> {
if config.run_in_tmux() && env::var("TOPGRADE_INSIDE_TMUX").is_err() {
#[cfg(unix)]
{
tmux::run_in_tmux(config.tmux_arguments());
tmux::run_in_tmux(config.tmux_arguments()?);
}
}
@@ -140,7 +140,7 @@ fn run() -> Result<()> {
#[cfg(target_os = "linux")]
let distribution = linux::Distribution::detect();
#[cfg(target_os = "linux")]
#[cfg(target_os = r#"linux"#)]
{
match &distribution {
Ok(distribution) => {
@@ -209,6 +209,11 @@ fn run() -> Result<()> {
freebsd::upgrade_packages(sudo.as_ref(), run_type)
})?;
#[cfg(target_os = "openbsd")]
runner.execute(Step::Pkg, "OpenBSD Packages", || {
openbsd::upgrade_packages(sudo.as_ref(), run_type)
})?;
#[cfg(target_os = "android")]
runner.execute(Step::Pkg, "Termux Packages", || android::upgrade_packages(&ctx))?;
@@ -231,6 +236,10 @@ fn run() -> Result<()> {
git_repos.insert_if_repo(base_dirs.home_dir().join(".ideavimrc"));
git_repos.insert_if_repo(base_dirs.home_dir().join(".intellimacs"));
if config.should_run(Step::Rcm) {
git_repos.insert_if_repo(base_dirs.home_dir().join(".dotfiles"));
}
#[cfg(unix)]
{
git_repos.insert_if_repo(zsh::zshrc(&base_dirs));
@@ -291,6 +300,7 @@ fn run() -> Result<()> {
runner.execute(Step::Shell, "bash-it", || unix::run_bashit(&ctx))?;
runner.execute(Step::Shell, "oh-my-fish", || unix::run_oh_my_fish(&ctx))?;
runner.execute(Step::Shell, "fish-plug", || unix::run_fish_plug(&ctx))?;
runner.execute(Step::Shell, "fundle", || unix::run_fundle(&ctx))?;
runner.execute(Step::Tmux, "tmux", || tmux::run_tpm(&base_dirs, run_type))?;
runner.execute(Step::Tldr, "TLDR", || unix::run_tldr(run_type))?;
runner.execute(Step::Pearl, "pearl", || unix::run_pearl(run_type))?;
@@ -301,6 +311,7 @@ fn run() -> Result<()> {
runner.execute(Step::Sdkman, "SDKMAN!", || {
unix::run_sdkman(&base_dirs, config.cleanup(), run_type)
})?;
runner.execute(Step::Rcm, "rcm", || unix::run_rcm(&ctx))?;
}
#[cfg(not(any(
@@ -323,6 +334,7 @@ fn run() -> Result<()> {
runner.execute(Step::Pipx, "pipx", || generic::run_pipx_update(run_type))?;
runner.execute(Step::Conda, "conda", || generic::run_conda_update(&ctx))?;
runner.execute(Step::Pip3, "pip3", || generic::run_pip3_update(run_type))?;
runner.execute(Step::Ghcup, "ghcup", || generic::run_ghcup_update(run_type))?;
runner.execute(Step::Stack, "stack", || generic::run_stack_update(run_type))?;
runner.execute(Step::Tlmgr, "tlmgr", || generic::run_tlmgr_update(&ctx))?;
runner.execute(Step::Myrepos, "myrepos", || {
@@ -339,6 +351,7 @@ fn run() -> Result<()> {
runner.execute(Step::Kakoune, "Kakoune", || kakoune::upgrade_kak_plug(&ctx))?;
runner.execute(Step::Node, "npm", || node::run_npm_upgrade(&ctx))?;
runner.execute(Step::Node, "yarn", || node::run_yarn_upgrade(&ctx))?;
runner.execute(Step::Node, "pnpm", || node::run_pnpm_upgrade(&ctx))?;
runner.execute(Step::Containers, "Containers", || containers::run_containers(&ctx))?;
runner.execute(Step::Deno, "deno", || node::deno_upgrade(&ctx))?;
runner.execute(Step::Composer, "composer", || generic::run_composer_update(&ctx))?;
@@ -368,6 +381,7 @@ fn run() -> Result<()> {
runner.execute(Step::Pacstall, "pacstall", || linux::run_pacstall(&ctx))?;
runner.execute(Step::Pacdef, "pacdef", || linux::run_pacdef(&ctx))?;
runner.execute(Step::Protonup, "protonup", || linux::run_protonup_update(&ctx))?;
runner.execute(Step::Distrobox, "distrobox", || linux::run_distrobox_update(&ctx))?;
}
if let Some(commands) = config.commands() {
@@ -403,6 +417,11 @@ fn run() -> Result<()> {
freebsd::upgrade_freebsd(sudo.as_ref(), run_type)
})?;
#[cfg(target_os = "openbsd")]
runner.execute(Step::System, "OpenBSD Upgrade", || {
openbsd::upgrade_openbsd(sudo.as_ref(), run_type)
})?;
#[cfg(windows)]
runner.execute(Step::System, "Windows update", || windows::windows_update(&ctx))?;
@@ -505,7 +524,10 @@ fn main() {
.is_some());
if !skip_print {
println!("Error: {}", error);
// The `Debug` implementation of `anyhow::Result` prints a multi-line
// error message that includes all the 'causes' added with
// `.with_context(...)` calls.
println!("Error: {:?}", error);
}
exit(1);
}

View File

@@ -31,7 +31,7 @@ impl Drop for SelfRenamer {
}
match fs::rename(&self.temp_path, &self.exe_path) {
Ok(_) => debug!("Moved topgrade back from {:?} to {:?}", self.temp_path, self.exe_path),
Ok(_) => debug!("Moved Topgrade back from {:?} to {:?}", self.temp_path, self.exe_path),
Err(e) => error!(
"Could not move Topgrade from {} back to {}: {}",
self.temp_path.display(),

View File

@@ -15,10 +15,14 @@ pub fn self_update() -> Result<()> {
let target = self_update_crate::get_target();
let result = Update::configure()
.repo_owner("r-darwish")
.repo_owner("topgrade-rs")
.repo_name("topgrade")
.target(target)
.bin_name(if cfg!(windows) { "topgrade.exe" } else { "topgrade" })
.bin_name(if cfg!(windows) {
"topgrade-rs.exe"
} else {
"topgrade-rs"
})
.show_output(false)
.show_download_progress(true)
.current_version(self_update_crate::cargo_crate_version!())

View File

@@ -23,7 +23,7 @@ fn list_containers(crt: &Path) -> Result<Vec<String>> {
crt.display()
);
let output = Command::new(crt)
.args(&["image", "ls", "--format", "{{.Repository}}:{{.Tag}}"])
.args(["image", "ls", "--format", "{{.Repository}}:{{.Tag}}"])
.output()?;
let output_str = String::from_utf8(output.stdout)?;
@@ -95,7 +95,7 @@ pub fn run_containers(ctx: &ExecutionContext) -> Result<()> {
if ctx.config().cleanup() {
// Remove dangling images
debug!("Removing dangling images");
if let Err(e) = ctx.run_type().execute(&crt).args(&["image", "prune", "-f"]).check_run() {
if let Err(e) = ctx.run_type().execute(&crt).args(["image", "prune", "-f"]).check_run() {
error!("Removing dangling images failed: {}", e);
success = false;
}

View File

@@ -71,7 +71,7 @@ impl Emacs {
command.arg("--force");
}
command.args(&["upgrade"]);
command.args(["upgrade"]);
command.check_run()
}
@@ -87,10 +87,10 @@ impl Emacs {
print_separator("Emacs");
let mut command = ctx.run_type().execute(&emacs);
let mut command = ctx.run_type().execute(emacs);
command
.args(&["--batch", "--debug-init", "-l"])
.args(["--batch", "--debug-init", "-l"])
.arg(init_file)
.arg("--eval");

View File

@@ -52,7 +52,7 @@ pub fn run_cargo_update(ctx: &ExecutionContext) -> Result<()> {
ctx.run_type()
.execute(cargo_update)
.args(&["install-update", "--git", "--all"])
.args(["install-update", "--git", "--all"])
.check_run()
}
@@ -60,12 +60,12 @@ pub fn run_flutter_upgrade(run_type: RunType) -> Result<()> {
let flutter = utils::require("flutter")?;
print_separator("Flutter");
run_type.execute(&flutter).arg("upgrade").check_run()
run_type.execute(flutter).arg("upgrade").check_run()
}
pub fn run_go(run_type: RunType) -> Result<()> {
let go = utils::require("go")?;
let go_output = run_type.execute(&go).args(&["env", "GOPATH"]).check_output()?;
let go_output = run_type.execute(go).args(["env", "GOPATH"]).check_output()?;
let gopath = go_output.trim();
let go_global_update = utils::require("go-global-update")
@@ -74,7 +74,7 @@ pub fn run_go(run_type: RunType) -> Result<()> {
print_separator("Go");
run_type.execute(&go_global_update).check_run()
run_type.execute(go_global_update).check_run()
}
pub fn run_gem(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
@@ -83,7 +83,7 @@ pub fn run_gem(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
print_separator("RubyGems");
let mut command = run_type.execute(&gem);
let mut command = run_type.execute(gem);
command.arg("update");
if env::var_os("RBENV_SHELL").is_none() {
@@ -123,7 +123,7 @@ pub fn run_sheldon(ctx: &ExecutionContext) -> Result<()> {
print_separator("Sheldon");
ctx.run_type().execute(&sheldon).args(&["lock", "--update"]).check_run()
ctx.run_type().execute(sheldon).args(["lock", "--update"]).check_run()
}
pub fn run_fossil(run_type: RunType) -> Result<()> {
@@ -131,7 +131,7 @@ pub fn run_fossil(run_type: RunType) -> Result<()> {
print_separator("Fossil");
run_type.execute(&fossil).args(&["all", "sync"]).check_run()
run_type.execute(fossil).args(["all", "sync"]).check_run()
}
pub fn run_micro(run_type: RunType) -> Result<()> {
@@ -139,7 +139,7 @@ pub fn run_micro(run_type: RunType) -> Result<()> {
print_separator("micro");
let stdout = run_type.execute(&micro).args(&["-plugin", "update"]).string_output()?;
let stdout = run_type.execute(micro).args(["-plugin", "update"]).string_output()?;
std::io::stdout().write_all(stdout.as_bytes())?;
if stdout.contains("Nothing to install / update") || stdout.contains("One or more plugins installed") {
@@ -160,7 +160,7 @@ pub fn run_apm(run_type: RunType) -> Result<()> {
print_separator("Atom Package Manager");
run_type.execute(&apm).args(&["upgrade", "--confirm=false"]).check_run()
run_type.execute(apm).args(["upgrade", "--confirm=false"]).check_run()
}
pub fn run_rustup(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
@@ -169,7 +169,7 @@ pub fn run_rustup(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
print_separator("rustup");
if rustup.canonicalize()?.is_descendant_of(base_dirs.home_dir()) {
run_type.execute(&rustup).args(&["self", "update"]).check_run()?;
run_type.execute(&rustup).args(["self", "update"]).check_run()?;
}
run_type.execute(&rustup).arg("update").check_run()
@@ -181,8 +181,8 @@ pub fn run_choosenim(ctx: &ExecutionContext) -> Result<()> {
print_separator("choosenim");
let run_type = ctx.run_type();
run_type.execute(&choosenim).args(&["update", "self"]).check_run()?;
run_type.execute(&choosenim).args(&["update", "stable"]).check_run()
run_type.execute(&choosenim).args(["update", "self"]).check_run()?;
run_type.execute(&choosenim).args(["update", "stable"]).check_run()
}
pub fn run_krew_upgrade(run_type: RunType) -> Result<()> {
@@ -190,7 +190,7 @@ pub fn run_krew_upgrade(run_type: RunType) -> Result<()> {
print_separator("Krew");
run_type.execute(&krew).args(&["upgrade"]).check_run()
run_type.execute(krew).args(["upgrade"]).check_run()
}
pub fn run_gcloud_components_update(run_type: RunType) -> Result<()> {
@@ -199,8 +199,8 @@ pub fn run_gcloud_components_update(run_type: RunType) -> Result<()> {
print_separator("gcloud");
run_type
.execute(&gcloud)
.args(&["components", "update", "--quiet"])
.execute(gcloud)
.args(["components", "update", "--quiet"])
.check_run()
}
@@ -209,7 +209,7 @@ pub fn run_jetpack(run_type: RunType) -> Result<()> {
print_separator("Jetpack");
run_type.execute(&jetpack).args(&["global", "update"]).check_run()
run_type.execute(jetpack).args(["global", "update"]).check_run()
}
pub fn run_rtcl(ctx: &ExecutionContext) -> Result<()> {
@@ -217,7 +217,7 @@ pub fn run_rtcl(ctx: &ExecutionContext) -> Result<()> {
print_separator("rtcl");
ctx.run_type().execute(&rupdate).check_run()
ctx.run_type().execute(rupdate).check_run()
}
pub fn run_opam_update(ctx: &ExecutionContext) -> Result<()> {
@@ -239,21 +239,21 @@ pub fn run_vcpkg_update(run_type: RunType) -> Result<()> {
let vcpkg = utils::require("vcpkg")?;
print_separator("vcpkg");
run_type.execute(&vcpkg).args(&["upgrade", "--no-dry-run"]).check_run()
run_type.execute(vcpkg).args(["upgrade", "--no-dry-run"]).check_run()
}
pub fn run_pipx_update(run_type: RunType) -> Result<()> {
let pipx = utils::require("pipx")?;
print_separator("pipx");
run_type.execute(&pipx).arg("upgrade-all").check_run()
run_type.execute(pipx).arg("upgrade-all").check_run()
}
pub fn run_conda_update(ctx: &ExecutionContext) -> Result<()> {
let conda = utils::require("conda")?;
let output = Command::new("conda")
.args(&["config", "--show", "auto_activate_base"])
.args(["config", "--show", "auto_activate_base"])
.output()?;
let string_output = String::from_utf8(output.stdout)?;
debug!("Conda output: {}", string_output);
@@ -264,15 +264,15 @@ pub fn run_conda_update(ctx: &ExecutionContext) -> Result<()> {
print_separator("Conda");
ctx.run_type()
.execute(&conda)
.args(&["update", "--all", "-y"])
.execute(conda)
.args(["update", "--all", "-y"])
.check_run()
}
pub fn run_pip3_update(run_type: RunType) -> Result<()> {
let python3 = utils::require("python3")?;
Command::new(&python3)
.args(&["-m", "pip"])
.args(["-m", "pip"])
.check_output()
.map_err(|_| SkipStep("pip does not exists".to_string()))?;
@@ -284,15 +284,29 @@ pub fn run_pip3_update(run_type: RunType) -> Result<()> {
run_type
.execute(&python3)
.args(&["-m", "pip", "install", "--upgrade", "--user", "pip"])
.args(["-m", "pip", "install", "--upgrade", "--user", "pip"])
.check_run()
}
pub fn run_stack_update(run_type: RunType) -> Result<()> {
if utils::require("ghcup").is_ok() {
// `ghcup` is present and probably(?) being used to install `stack`.
// Don't upgrade `stack`, let `ghcup` handle it. Per `ghcup install stack`:
// !!! Additionally, you should upgrade stack only through ghcup and not use 'stack upgrade' !!!
return Ok(());
}
let stack = utils::require("stack")?;
print_separator("stack");
run_type.execute(&stack).arg("upgrade").check_run()
run_type.execute(stack).arg("upgrade").check_run()
}
pub fn run_ghcup_update(run_type: RunType) -> Result<()> {
let ghcup = utils::require("ghcup")?;
print_separator("ghcup");
run_type.execute(ghcup).arg("upgrade").check_run()
}
pub fn run_tlmgr_update(ctx: &ExecutionContext) -> Result<()> {
@@ -309,7 +323,7 @@ pub fn run_tlmgr_update(ctx: &ExecutionContext) -> Result<()> {
let tlmgr_directory = {
let mut d = PathBuf::from(
std::str::from_utf8(
&Command::new(&kpsewhich)
&Command::new(kpsewhich)
.arg("-var-value=SELFAUTOPARENT")
.output()?
.stdout,
@@ -335,7 +349,7 @@ pub fn run_tlmgr_update(ctx: &ExecutionContext) -> Result<()> {
c.arg(&tlmgr);
c
};
command.args(&["update", "--self", "--all"]);
command.args(["update", "--self", "--all"]);
command.check_run()
}
@@ -346,7 +360,7 @@ pub fn run_chezmoi_update(base_dirs: &BaseDirs, run_type: RunType) -> Result<()>
print_separator("chezmoi");
run_type.execute(&chezmoi).arg("update").check_run()
run_type.execute(chezmoi).arg("update").check_run()
}
pub fn run_myrepos_update(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
@@ -377,7 +391,7 @@ pub fn run_custom_command(name: &str, command: &str, ctx: &ExecutionContext) ->
pub fn run_composer_update(ctx: &ExecutionContext) -> Result<()> {
let composer = utils::require("composer")?;
let composer_home = Command::new(&composer)
.args(&["global", "config", "--absolute", "--quiet", "home"])
.args(["global", "config", "--absolute", "--quiet", "home"])
.check_output()
.map_err(|e| (SkipStep(format!("Error getting the composer directory: {}", e))))
.map(|s| PathBuf::from(s.trim()))?
@@ -415,7 +429,7 @@ pub fn run_composer_update(ctx: &ExecutionContext) -> Result<()> {
}
}
let output = Command::new(&composer).args(&["global", "update"]).output()?;
let output = Command::new(&composer).args(["global", "update"]).output()?;
let status = output.status;
if !status.success() {
return Err(TopgradeError::ProcessFailed(status).into());
@@ -426,7 +440,7 @@ pub fn run_composer_update(ctx: &ExecutionContext) -> Result<()> {
if stdout.contains("valet") || stderr.contains("valet") {
if let Some(valet) = utils::which("valet") {
ctx.run_type().execute(&valet).arg("install").check_run()?;
ctx.run_type().execute(valet).arg("install").check_run()?;
}
}
@@ -436,7 +450,7 @@ pub fn run_composer_update(ctx: &ExecutionContext) -> Result<()> {
pub fn run_dotnet_upgrade(ctx: &ExecutionContext) -> Result<()> {
let dotnet = utils::require("dotnet")?;
let output = Command::new(dotnet).args(&["tool", "list", "--global"]).output()?;
let output = Command::new(dotnet).args(["tool", "list", "--global"]).output()?;
if !output.status.success() {
return Err(SkipStep(format!("dotnet failed with exit code {:?}", output.status)).into());
@@ -459,7 +473,7 @@ pub fn run_dotnet_upgrade(ctx: &ExecutionContext) -> Result<()> {
let package_name = package.split_whitespace().next().unwrap();
ctx.run_type()
.execute("dotnet")
.args(&["tool", "update", package_name, "--global"])
.args(["tool", "update", package_name, "--global"])
.check_run()?;
}
@@ -471,26 +485,26 @@ pub fn run_raco_update(run_type: RunType) -> Result<()> {
print_separator("Racket Package Manager");
run_type.execute(&raco).args(&["pkg", "update", "--all"]).check_run()
run_type.execute(raco).args(["pkg", "update", "--all"]).check_run()
}
pub fn bin_update(ctx: &ExecutionContext) -> Result<()> {
let bin = utils::require("bin")?;
print_separator("Bin");
ctx.run_type().execute(&bin).arg("update").check_run()
ctx.run_type().execute(bin).arg("update").check_run()
}
pub fn spicetify_upgrade(ctx: &ExecutionContext) -> Result<()> {
let spicetify = utils::require("spicetify")?;
print_separator("Spicetify");
ctx.run_type().execute(&spicetify).arg("upgrade").check_run()
ctx.run_type().execute(spicetify).arg("upgrade").check_run()
}
pub fn run_ghcli_extensions_upgrade(ctx: &ExecutionContext) -> Result<()> {
let gh = utils::require("gh")?;
let result = Command::new(&gh).args(&["extensions", "list"]).check_output();
let result = Command::new(&gh).args(["extensions", "list"]).check_output();
if result.is_err() {
debug!("GH result {:?}", result);
return Err(SkipStep(String::from("GH failed")).into());
@@ -499,7 +513,7 @@ pub fn run_ghcli_extensions_upgrade(ctx: &ExecutionContext) -> Result<()> {
print_separator("GitHub CLI Extensions");
ctx.run_type()
.execute(&gh)
.args(&["extension", "upgrade", "--all"])
.args(["extension", "upgrade", "--all"])
.check_run()
}
@@ -509,7 +523,7 @@ pub fn update_julia_packages(ctx: &ExecutionContext) -> Result<()> {
print_separator("Julia Packages");
ctx.run_type()
.execute(&julia)
.args(&["-e", "using Pkg; Pkg.update()"])
.execute(julia)
.args(["-e", "using Pkg; Pkg.update()"])
.check_run()
}

View File

@@ -53,7 +53,7 @@ async fn pull_repository(repo: String, git: &Path, ctx: &ExecutionContext<'_>) -
command
.stdin(Stdio::null())
.current_dir(&repo)
.args(&["pull", "--ff-only"]);
.args(["pull", "--ff-only"]);
if let Some(extra_arguments) = ctx.config().git_arguments() {
command.args(extra_arguments.split_whitespace());
@@ -61,7 +61,7 @@ async fn pull_repository(repo: String, git: &Path, ctx: &ExecutionContext<'_>) -
let pull_output = command.output().await?;
let submodule_output = AsyncCommand::new(git)
.args(&["submodule", "update", "--recursive"])
.args(["submodule", "update", "--recursive"])
.current_dir(&repo)
.stdin(Stdio::null())
.output()
@@ -78,10 +78,10 @@ async fn pull_repository(repo: String, git: &Path, ctx: &ExecutionContext<'_>) -
(Some(before), Some(after)) if before != after => {
println!("{} {}:", style("Changed").yellow().bold(), &repo);
Command::new(&git)
Command::new(git)
.stdin(Stdio::null())
.current_dir(&repo)
.args(&[
.args([
"--no-pager",
"log",
"--no-decorate",
@@ -107,7 +107,7 @@ fn get_head_revision(git: &Path, repo: &str) -> Option<String> {
Command::new(git)
.stdin(Stdio::null())
.current_dir(repo)
.args(&["rev-parse", "HEAD"])
.args(["rev-parse", "HEAD"])
.check_output()
.map(|output| output.trim().to_string())
.map_err(|e| {
@@ -122,7 +122,7 @@ fn has_remotes(git: &Path, repo: &str) -> Option<bool> {
Command::new(git)
.stdin(Stdio::null())
.current_dir(repo)
.args(&["remote", "show"])
.args(["remote", "show"])
.check_output()
.map(|output| output.lines().count() > 0)
.map_err(|e| {
@@ -162,10 +162,10 @@ impl Git {
};
if let Some(git) = &self.git {
let output = Command::new(&git)
let output = Command::new(git)
.stdin(Stdio::null())
.current_dir(path)
.args(&["rev-parse", "--show-toplevel"])
.args(["rev-parse", "--show-toplevel"])
.check_output()
.ok()
.map(|output| output.trim().to_string());

View File

@@ -13,8 +13,8 @@ pub fn upgrade_kak_plug(ctx: &ExecutionContext) -> Result<()> {
print_separator("Kakoune");
let mut command = ctx.run_type().execute(&kak);
command.args(&["-ui", "dummy", "-e", UPGRADE_KAK]);
let mut command = ctx.run_type().execute(kak);
command.args(["-ui", "dummy", "-e", UPGRADE_KAK]);
let output = command.output()?;

View File

@@ -1,5 +1,6 @@
#![allow(unused_imports)]
use std::fmt::Display;
#[cfg(unix)]
use std::os::unix::prelude::MetadataExt;
use std::path::PathBuf;
@@ -17,24 +18,71 @@ use crate::terminal::print_separator;
use crate::utils::{require, PathExt};
use crate::{error::SkipStep, execution_context::ExecutionContext};
enum NPMVariant {
Npm,
Pnpm,
}
impl NPMVariant {
const fn long_name(&self) -> &str {
match self {
NPMVariant::Npm => "Node Package Manager",
NPMVariant::Pnpm => "PNPM",
}
}
const fn short_name(&self) -> &str {
match self {
NPMVariant::Npm => "npm",
NPMVariant::Pnpm => "pnpm",
}
}
const fn is_npm(&self) -> bool {
matches!(self, NPMVariant::Npm)
}
}
impl Display for NPMVariant {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.short_name())
}
}
#[allow(clippy::upper_case_acronyms)]
struct NPM {
command: PathBuf,
variant: NPMVariant,
}
impl NPM {
fn new(command: PathBuf) -> Self {
Self { command }
fn new(command: PathBuf, variant: NPMVariant) -> Self {
Self { command, variant }
}
/// Is the “NPM” version larger than 8.11.0?
fn is_npm_8(&self) -> bool {
let v = self.version();
self.variant.is_npm() && matches!(v, Ok(v) if v >= Version::new(8, 11, 0))
}
/// Get the most suitable “global location” argument
/// of this NPM instance.
///
/// If the “NPM” version is larger than 8.11.0, we use
/// `--location=global`; otherwise, use `-g`.
fn global_location_arg(&self) -> &str {
if self.is_npm_8() {
"--location=global"
} else {
"-g"
}
}
#[cfg(target_os = "linux")]
fn root(&self) -> Result<PathBuf> {
let version = self.version()?;
let args = if version < Version::new(8, 11, 0) {
["root", "-g"]
} else {
["root", "--location=global"]
};
let args = ["root", self.global_location_arg()];
Command::new(&self.command)
.args(args)
.check_output()
@@ -43,20 +91,15 @@ impl NPM {
fn version(&self) -> Result<Version> {
let version_str = Command::new(&self.command)
.args(&["--version"])
.args(["--version"])
.check_output()
.map(|s| s.trim().to_owned());
Version::parse(&version_str?).map_err(|err| err.into())
}
fn upgrade(&self, run_type: RunType, use_sudo: bool) -> Result<()> {
print_separator("Node Package Manager");
let version = self.version()?;
let args = if version < Version::new(8, 11, 0) {
["update", "-g"]
} else {
["update", "--location=global"]
};
print_separator(self.variant.long_name());
let args = ["update", self.global_location_arg()];
if use_sudo {
run_type.execute("sudo").args(args).check_run()?;
} else {
@@ -70,7 +113,7 @@ impl NPM {
pub fn should_use_sudo(&self) -> Result<bool> {
let npm_root = self.root()?;
if !npm_root.exists() {
return Err(SkipStep(format!("NPM root at {} doesn't exist", npm_root.display(),)).into());
return Err(SkipStep(format!("{} root at {} doesn't exist", self.variant, npm_root.display())).into());
}
let metadata = std::fs::metadata(&npm_root)?;
@@ -93,6 +136,17 @@ impl Yarn {
}
}
fn has_global_subcmd(&self) -> bool {
// Get the version of Yarn. After Yarn 2.x (berry),
// “yarn global” has been replaced with “yarn dlx”.
//
// As “yarn dlx” don't need to “upgrade”, we
// ignore the whole task if Yarn is 2.x or above.
let version = Command::new(&self.command).args(["--version"]).check_output();
matches!(version, Ok(ver) if ver.starts_with('1') || ver.starts_with('0'))
}
#[cfg(target_os = "linux")]
fn root(&self) -> Result<PathBuf> {
let args = ["global", "dir"];
@@ -123,7 +177,7 @@ impl Yarn {
pub fn should_use_sudo(&self) -> Result<bool> {
let yarn_root = self.root()?;
if !yarn_root.exists() {
return Err(SkipStep(format!("NPM root at {} doesn't exist", yarn_root.display(),)).into());
return Err(SkipStep(format!("Yarn root at {} doesn't exist", yarn_root.display(),)).into());
}
let metadata = std::fs::metadata(&yarn_root)?;
@@ -162,7 +216,7 @@ fn should_use_sudo_yarn(yarn: &Yarn, ctx: &ExecutionContext) -> Result<bool> {
}
pub fn run_npm_upgrade(ctx: &ExecutionContext) -> Result<()> {
let npm = require("pnpm").or_else(|_| require("npm")).map(NPM::new)?;
let npm = require("npm").map(|b| NPM::new(b, NPMVariant::Npm))?;
#[cfg(target_os = "linux")]
{
@@ -175,9 +229,28 @@ pub fn run_npm_upgrade(ctx: &ExecutionContext) -> Result<()> {
}
}
pub fn run_pnpm_upgrade(ctx: &ExecutionContext) -> Result<()> {
let pnpm = require("pnpm").map(|b| NPM::new(b, NPMVariant::Pnpm))?;
#[cfg(target_os = "linux")]
{
pnpm.upgrade(ctx.run_type(), should_use_sudo(&pnpm, ctx)?)
}
#[cfg(not(target_os = "linux"))]
{
pnpm.upgrade(ctx.run_type(), false)
}
}
pub fn run_yarn_upgrade(ctx: &ExecutionContext) -> Result<()> {
let yarn = require("yarn").map(Yarn::new)?;
if !yarn.has_global_subcmd() {
debug!("Yarn is 2.x or above, skipping global upgrade");
return Ok(());
}
#[cfg(target_os = "linux")]
{
yarn.upgrade(ctx.run_type(), should_use_sudo_yarn(&yarn, ctx)?)

View File

@@ -5,27 +5,33 @@ use crate::Step;
use anyhow::Result;
pub fn upgrade_packages(ctx: &ExecutionContext) -> Result<()> {
let pkg = require("pkg")?;
//let pkg = require("pkg")?;
let pkg = which("nala").or_else(|| which("pkg")).unwrap();
print_separator("Termux Packages");
let is_nala = pkg.end_with("nala");
let mut command = ctx.run_type().execute(&pkg);
command.arg("upgrade");
if ctx.config().yes(Step::System) {
command.arg("-y");
}
command.check_run()?;
if ctx.config().cleanup() {
ctx.run_type().execute(&pkg).arg("clean").check_run()?;
if !is_nala {
if ctx.config().cleanup() {
ctx.run_type().execute(&pkg).arg("clean").check_run()?;
let apt = require("apt")?;
let mut command = ctx.run_type().execute(&apt);
command.arg("autoremove");
if ctx.config().yes(Step::System) {
command.arg("-y");
let apt = require("apt")?;
let mut command = ctx.run_type().execute(&apt);
command.arg("autoremove");
if ctx.config().yes(Step::System) {
command.arg("-y");
}
command.check_run()?;
}
command.check_run()?;
}
Ok(())

View File

@@ -229,6 +229,53 @@ impl ArchPackageManager for Pamac {
}
}
pub struct Aura {
executable: PathBuf,
sudo: PathBuf,
}
impl Aura {
fn get(ctx: &ExecutionContext) -> Option<Self> {
Some(Self {
executable: which("aura")?,
sudo: ctx.sudo().to_owned()?,
})
}
}
impl ArchPackageManager for Aura {
fn upgrade(&self, ctx: &ExecutionContext) -> Result<()> {
let sudo = which("sudo").unwrap_or_else(PathBuf::new);
let mut aur_update = ctx.run_type().execute(&sudo);
if sudo.ends_with("sudo") {
aur_update
.arg(&self.executable)
.arg("-Au")
.args(ctx.config().aura_aur_arguments().split_whitespace());
if ctx.config().yes(Step::System) {
aur_update.arg("--noconfirm");
}
aur_update.check_run()?;
} else {
println!("Aura requires sudo installed to work with AUR packages")
}
let mut pacman_update = ctx.run_type().execute(&self.sudo);
pacman_update
.arg(&self.executable)
.arg("-Syu")
.args(ctx.config().aura_pacman_arguments().split_whitespace());
if ctx.config().yes(Step::System) {
pacman_update.arg("--noconfirm");
}
pacman_update.check_run()?;
Ok(())
}
}
fn box_package_manager<P: 'static + ArchPackageManager>(package_manager: P) -> Box<dyn ArchPackageManager> {
Box::new(package_manager) as Box<dyn ArchPackageManager>
}
@@ -243,13 +290,15 @@ pub fn get_arch_package_manager(ctx: &ExecutionContext) -> Option<Box<dyn ArchPa
.or_else(|| Trizen::get().map(box_package_manager))
.or_else(|| Pikaur::get().map(box_package_manager))
.or_else(|| Pamac::get().map(box_package_manager))
.or_else(|| Pacman::get(ctx).map(box_package_manager)),
.or_else(|| Pacman::get(ctx).map(box_package_manager))
.or_else(|| Aura::get(ctx).map(box_package_manager)),
config::ArchPackageManager::Trizen => Trizen::get().map(box_package_manager),
config::ArchPackageManager::Paru => YayParu::get("paru", &pacman).map(box_package_manager),
config::ArchPackageManager::Yay => YayParu::get("yay", &pacman).map(box_package_manager),
config::ArchPackageManager::Pacman => Pacman::get(ctx).map(box_package_manager),
config::ArchPackageManager::Pikaur => Pikaur::get().map(box_package_manager),
config::ArchPackageManager::Pamac => Pamac::get().map(box_package_manager),
config::ArchPackageManager::Aura => Aura::get(ctx).map(box_package_manager),
}
}

View File

@@ -125,7 +125,7 @@ impl Distribution {
fn update_bedrock(ctx: &ExecutionContext) -> Result<()> {
let sudo = require_option(ctx.sudo().as_ref(), String::from("Sudo required"))?;
ctx.run_type().execute(sudo).args(&["brl", "update"]);
ctx.run_type().execute(sudo).args(["brl", "update"]);
let output = Command::new("brl").arg("list").output()?;
debug!("brl list: {:?} {:?}", output.stdout, output.stderr);
@@ -171,7 +171,7 @@ fn upgrade_redhat(ctx: &ExecutionContext) -> Result<()> {
};
if let Some(sudo) = &ctx.sudo() {
let mut command = ctx.run_type().execute(&sudo);
let mut command = ctx.run_type().execute(sudo);
command
.arg(which("dnf").unwrap_or_else(|| Path::new("yum").to_path_buf()))
.arg(if ctx.config().redhat_distro_sync() {
@@ -198,7 +198,7 @@ fn upgrade_redhat(ctx: &ExecutionContext) -> Result<()> {
fn upgrade_bedrock_strata(ctx: &ExecutionContext) -> Result<()> {
if let Some(sudo) = ctx.sudo() {
ctx.run_type().execute(&sudo).args(&["brl", "update"]).check_run()?;
ctx.run_type().execute(sudo).args(["brl", "update"]).check_run()?;
} else {
print_warning("No sudo detected. Skipping system upgrade");
}
@@ -208,11 +208,11 @@ fn upgrade_bedrock_strata(ctx: &ExecutionContext) -> Result<()> {
fn upgrade_suse(ctx: &ExecutionContext) -> Result<()> {
if let Some(sudo) = ctx.sudo() {
ctx.run_type().execute(&sudo).args(&["zypper", "refresh"]).check_run()?;
ctx.run_type().execute(sudo).args(["zypper", "refresh"]).check_run()?;
ctx.run_type()
.execute(&sudo)
.args(&["zypper", "dist-upgrade"])
.execute(sudo)
.args(["zypper", "dist-upgrade"])
.check_run()?;
} else {
print_warning("No sudo detected. Skipping system upgrade");
@@ -223,9 +223,9 @@ fn upgrade_suse(ctx: &ExecutionContext) -> Result<()> {
fn upgrade_openmandriva(ctx: &ExecutionContext) -> Result<()> {
if let Some(sudo) = &ctx.sudo() {
let mut command = ctx.run_type().execute(&sudo);
let mut command = ctx.run_type().execute(sudo);
command.arg(which("dnf").unwrap().to_path_buf()).arg("upgrade");
command.arg(&which("dnf").unwrap()).arg("upgrade");
if let Some(args) = ctx.config().dnf_arguments() {
command.args(args.split_whitespace());
@@ -245,15 +245,15 @@ fn upgrade_openmandriva(ctx: &ExecutionContext) -> Result<()> {
fn upgrade_void(ctx: &ExecutionContext) -> Result<()> {
if let Some(sudo) = ctx.sudo() {
let mut command = ctx.run_type().execute(&sudo);
command.args(&["xbps-install", "-Su", "xbps"]);
let mut command = ctx.run_type().execute(sudo);
command.args(["xbps-install", "-Su", "xbps"]);
if ctx.config().yes(Step::System) {
command.arg("-y");
}
command.check_run()?;
let mut command = ctx.run_type().execute(&sudo);
command.args(&["xbps-install", "-u"]);
let mut command = ctx.run_type().execute(sudo);
command.args(["xbps-install", "-u"]);
if ctx.config().yes(Step::System) {
command.arg("-y");
}
@@ -270,13 +270,13 @@ fn upgrade_gentoo(ctx: &ExecutionContext) -> Result<()> {
if let Some(sudo) = &ctx.sudo() {
if let Some(layman) = which("layman") {
run_type.execute(&sudo).arg(layman).args(&["-s", "ALL"]).check_run()?;
run_type.execute(sudo).arg(layman).args(["-s", "ALL"]).check_run()?;
}
println!("Syncing portage");
run_type
.execute(&sudo)
.args(&["emerge", "--sync"])
.execute(sudo)
.args(["emerge", "--sync"])
.args(
ctx.config()
.emerge_sync_flags()
@@ -286,11 +286,11 @@ fn upgrade_gentoo(ctx: &ExecutionContext) -> Result<()> {
.check_run()?;
if let Some(eix_update) = which("eix-update") {
run_type.execute(&sudo).arg(eix_update).check_run()?;
run_type.execute(sudo).arg(eix_update).check_run()?;
}
run_type
.execute(&sudo)
.execute(sudo)
.arg("emerge")
.args(
ctx.config()
@@ -314,10 +314,10 @@ fn upgrade_debian(ctx: &ExecutionContext) -> Result<()> {
let is_nala = apt.ends_with("nala");
if !is_nala {
ctx.run_type().execute(&sudo).arg(&apt).arg("update").check_run()?;
ctx.run_type().execute(sudo).arg(&apt).arg("update").check_run()?;
}
let mut command = ctx.run_type().execute(&sudo);
let mut command = ctx.run_type().execute(sudo);
command.arg(&apt);
if is_nala {
command.arg("upgrade");
@@ -333,9 +333,9 @@ fn upgrade_debian(ctx: &ExecutionContext) -> Result<()> {
command.check_run()?;
if ctx.config().cleanup() {
ctx.run_type().execute(&sudo).arg(&apt).arg("clean").check_run()?;
ctx.run_type().execute(sudo).arg(&apt).arg("clean").check_run()?;
let mut command = ctx.run_type().execute(&sudo);
let mut command = ctx.run_type().execute(sudo);
command.arg(&apt).arg("autoremove");
if ctx.config().yes(Step::System) {
command.arg("-y");
@@ -366,7 +366,7 @@ pub fn run_deb_get(ctx: &ExecutionContext) -> Result<()> {
fn upgrade_solus(ctx: &ExecutionContext) -> Result<()> {
if let Some(sudo) = ctx.sudo() {
ctx.run_type().execute(&sudo).args(&["eopkg", "upgrade"]).check_run()?;
ctx.run_type().execute(sudo).args(["eopkg", "upgrade"]).check_run()?;
} else {
print_warning("No sudo detected. Skipping system upgrade");
}
@@ -396,7 +396,7 @@ pub fn run_pacstall(ctx: &ExecutionContext) -> Result<()> {
fn upgrade_clearlinux(ctx: &ExecutionContext) -> Result<()> {
if let Some(sudo) = &ctx.sudo() {
ctx.run_type().execute(&sudo).args(&["swupd", "update"]).check_run()?;
ctx.run_type().execute(sudo).args(["swupd", "update"]).check_run()?;
} else {
print_warning("No sudo detected. Skipping system upgrade");
}
@@ -406,28 +406,25 @@ fn upgrade_clearlinux(ctx: &ExecutionContext) -> Result<()> {
fn upgrade_exherbo(ctx: &ExecutionContext) -> Result<()> {
if let Some(sudo) = ctx.sudo() {
ctx.run_type().execute(&sudo).args(&["cave", "sync"]).check_run()?;
ctx.run_type().execute(sudo).args(["cave", "sync"]).check_run()?;
ctx.run_type()
.execute(&sudo)
.args(&["cave", "resolve", "world", "-c1", "-Cs", "-km", "-Km", "-x"])
.execute(sudo)
.args(["cave", "resolve", "world", "-c1", "-Cs", "-km", "-Km", "-x"])
.check_run()?;
if ctx.config().cleanup() {
ctx.run_type()
.execute(&sudo)
.args(&["cave", "purge", "-x"])
.check_run()?;
ctx.run_type().execute(sudo).args(["cave", "purge", "-x"]).check_run()?;
}
ctx.run_type()
.execute(&sudo)
.args(&["cave", "fix-linkage", "-x", "--", "-Cs"])
.execute(sudo)
.args(["cave", "fix-linkage", "-x", "--", "-Cs"])
.check_run()?;
ctx.run_type()
.execute(&sudo)
.args(&["eclectic", "config", "interactive"])
.execute(sudo)
.args(["eclectic", "config", "interactive"])
.check_run()?;
} else {
print_warning("No sudo detected. Skipping system upgrade");
@@ -439,14 +436,14 @@ fn upgrade_exherbo(ctx: &ExecutionContext) -> Result<()> {
fn upgrade_nixos(ctx: &ExecutionContext) -> Result<()> {
if let Some(sudo) = ctx.sudo() {
ctx.run_type()
.execute(&sudo)
.args(&["/run/current-system/sw/bin/nixos-rebuild", "switch", "--upgrade"])
.execute(sudo)
.args(["/run/current-system/sw/bin/nixos-rebuild", "switch", "--upgrade"])
.check_run()?;
if ctx.config().cleanup() {
ctx.run_type()
.execute(&sudo)
.args(&["/run/current-system/sw/bin/nix-collect-garbage", "-d"])
.execute(sudo)
.args(["/run/current-system/sw/bin/nix-collect-garbage", "-d"])
.check_run()?;
}
} else {
@@ -465,8 +462,8 @@ fn upgrade_neon(ctx: &ExecutionContext) -> Result<()> {
if let Some(sudo) = &ctx.sudo() {
let pkcon = which("pkcon").unwrap();
// pkcon ignores update with update and refresh provided together
ctx.run_type().execute(&sudo).arg(&pkcon).arg("refresh").check_run()?;
let mut exe = ctx.run_type().execute(&sudo);
ctx.run_type().execute(sudo).arg(&pkcon).arg("refresh").check_run()?;
let mut exe = ctx.run_type().execute(sudo);
let cmd = exe.arg(&pkcon).arg("update");
if ctx.config().yes(Step::System) {
cmd.arg("-y");
@@ -492,7 +489,7 @@ pub fn run_needrestart(sudo: Option<&PathBuf>, run_type: RunType) -> Result<()>
print_separator("Check for needed restarts");
run_type.execute(&sudo).arg(needrestart).check_run()?;
run_type.execute(sudo).arg(needrestart).check_run()?;
Ok(())
}
@@ -552,7 +549,7 @@ pub fn flatpak_update(ctx: &ExecutionContext) -> Result<()> {
if yes {
update_args.push("-y");
}
run_type.execute(&sudo).arg(&flatpak).args(&update_args).check_run()?;
run_type.execute(sudo).arg(&flatpak).args(&update_args).check_run()?;
if cleanup {
let mut cleanup_args = vec!["uninstall", "--system", "--unused"];
if yes {
@@ -609,6 +606,29 @@ pub fn run_protonup_update(ctx: &ExecutionContext) -> Result<()> {
Ok(())
}
pub fn run_distrobox_update(ctx: &ExecutionContext) -> Result<()> {
print_separator("Distrobox");
match (
match (
ctx.run_type().execute("distrobox").arg("upgrade"),
ctx.config().distrobox_containers(),
) {
(r, Some(c)) => {
if c.is_empty() {
return Err(SkipStep("You need to specify at least one container".to_string()).into());
}
r.args(c)
}
(r, None) => r.arg("--all"),
},
ctx.config().distrobox_root(),
) {
(r, true) => r.arg("--root"),
(r, false) => r,
}
.check_run()
}
pub fn run_config_update(ctx: &ExecutionContext) -> Result<()> {
let sudo = require_option(ctx.sudo().as_ref(), String::from("sudo is not installed"))?;
if ctx.config().yes(Step::ConfigUpdate) {

View File

@@ -11,15 +11,15 @@ pub fn run_macports(ctx: &ExecutionContext) -> Result<()> {
require("port")?;
let sudo = ctx.sudo().as_ref().unwrap();
print_separator("MacPorts");
ctx.run_type().execute(sudo).args(&["port", "selfupdate"]).check_run()?;
ctx.run_type().execute(sudo).args(["port", "selfupdate"]).check_run()?;
ctx.run_type()
.execute(sudo)
.args(&["port", "-u", "upgrade", "outdated"])
.args(["port", "-u", "upgrade", "outdated"])
.check_run()?;
if ctx.config().cleanup() {
ctx.run_type()
.execute(sudo)
.args(&["port", "-N", "reclaim"])
.args(["port", "-N", "reclaim"])
.check_run()?;
}
@@ -52,7 +52,7 @@ pub fn upgrade_macos(ctx: &ExecutionContext) -> Result<()> {
}
let mut command = ctx.run_type().execute("softwareupdate");
command.args(&["--install", "--all"]);
command.args(["--install", "--all"]);
if should_ask {
command.arg("--no-scan");
@@ -81,12 +81,12 @@ pub fn run_sparkle(ctx: &ExecutionContext) -> Result<()> {
for application in (fs::read_dir("/Applications")?).flatten() {
let probe = Command::new(&sparkle)
.args(&["--probe", "--application"])
.args(["--probe", "--application"])
.arg(application.path())
.check_output();
if probe.is_ok() {
let mut command = ctx.run_type().execute(&sparkle);
command.args(&["bundle", "--check-immediately", "--application"]);
command.args(["bundle", "--check-immediately", "--application"]);
command.arg(application.path());
command.spawn()?.wait()?;
}

View File

@@ -10,6 +10,8 @@ pub mod freebsd;
pub mod linux;
#[cfg(target_os = "macos")]
pub mod macos;
#[cfg(target_os = "openbsd")]
pub mod openbsd;
#[cfg(unix)]
pub mod unix;
#[cfg(target_os = "windows")]

17
src/steps/os/openbsd.rs Normal file
View File

@@ -0,0 +1,17 @@
use crate::executor::RunType;
use crate::terminal::print_separator;
use crate::utils::require_option;
use anyhow::Result;
use std::path::PathBuf;
pub fn upgrade_openbsd(sudo: Option<&PathBuf>, run_type: RunType) -> Result<()> {
let sudo = require_option(sudo, String::from("No sudo detected"))?;
print_separator("OpenBSD Update");
run_type.execute(sudo).args(&["/usr/sbin/sysupgrade", "-n"]).check_run()
}
pub fn upgrade_packages(sudo: Option<&PathBuf>, run_type: RunType) -> Result<()> {
let sudo = require_option(sudo, String::from("No sudo detected"))?;
print_separator("OpenBSD Packages");
run_type.execute(sudo).args(&["/usr/sbin/pkg_add", "-u"]).check_run()
}

View File

@@ -1,8 +1,9 @@
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support"
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

View File

@@ -8,6 +8,7 @@ use crate::utils::{require, PathExt};
use crate::Step;
use anyhow::Result;
use directories::BaseDirs;
use home;
use ini::Ini;
use log::debug;
use std::fs;
@@ -88,7 +89,19 @@ pub fn run_fisher(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
print_separator("Fisher");
run_type.execute(&fish).args(&["-c", "fisher update"]).check_run()
let version_str = run_type
.execute(&fish)
.args(["-c", "fisher --version"])
.check_output()?;
debug!("Fisher version: {}", version_str);
if version_str.starts_with("fisher version 3.") {
// v3 - see https://github.com/topgrade-rs/topgrade/pull/37#issuecomment-1283844506
run_type.execute(&fish).args(["-c", "fisher"]).check_run()
} else {
// v4
run_type.execute(&fish).args(["-c", "fisher update"]).check_run()
}
}
pub fn run_bashit(ctx: &ExecutionContext) -> Result<()> {
@@ -98,7 +111,7 @@ pub fn run_bashit(ctx: &ExecutionContext) -> Result<()> {
ctx.run_type()
.execute("bash")
.args(&["-lic", &format!("bash-it update {}", ctx.config().bashit_branch())])
.args(["-lic", &format!("bash-it update {}", ctx.config().bashit_branch())])
.check_run()
}
@@ -111,7 +124,7 @@ pub fn run_oh_my_fish(ctx: &ExecutionContext) -> Result<()> {
print_separator("oh-my-fish");
ctx.run_type().execute(&fish).args(&["-c", "omf update"]).check_run()
ctx.run_type().execute(fish).args(["-c", "omf update"]).check_run()
}
pub fn run_pkgin(ctx: &ExecutionContext) -> Result<()> {
@@ -141,7 +154,24 @@ pub fn run_fish_plug(ctx: &ExecutionContext) -> Result<()> {
print_separator("fish-plug");
ctx.run_type().execute(&fish).args(&["-c", "plug update"]).check_run()
ctx.run_type().execute(fish).args(["-c", "plug update"]).check_run()
}
/// Upgrades `fundle` and `fundle` plugins.
///
/// `fundle` is a package manager for the Fish shell.
///
/// See: <https://github.com/danhper/fundle>
pub fn run_fundle(ctx: &ExecutionContext) -> Result<()> {
let fish = require("fish")?;
ctx.base_dirs().home_dir().join(".config/fish/fundle").require()?;
print_separator("fundle");
ctx.run_type()
.execute(fish)
.args(["-c", "fundle self-update && fundle update"])
.check_run()
}
#[cfg(not(any(target_os = "android", target_os = "macos")))]
@@ -152,7 +182,7 @@ pub fn upgrade_gnome_extensions(ctx: &ExecutionContext) -> Result<()> {
"Desktop doest not appear to be gnome".to_string(),
)?;
let output = Command::new("gdbus")
.args(&[
.args([
"call",
"--session",
"--dest",
@@ -173,7 +203,7 @@ pub fn upgrade_gnome_extensions(ctx: &ExecutionContext) -> Result<()> {
ctx.run_type()
.execute(gdbus)
.args(&[
.args([
"call",
"--session",
"--dest",
@@ -203,7 +233,7 @@ pub fn run_brew_formula(ctx: &ExecutionContext, variant: BrewVariant) -> Result<
variant.execute(run_type).arg("update").check_run()?;
variant
.execute(run_type)
.args(&["upgrade", "--ignore-pinned", "--formula"])
.args(["upgrade", "--ignore-pinned", "--formula"])
.check_run()?;
if ctx.config().cleanup() {
@@ -228,19 +258,19 @@ pub fn run_brew_cask(ctx: &ExecutionContext, variant: BrewVariant) -> Result<()>
let cask_upgrade_exists = variant
.execute(RunType::Wet)
.args(&["--repository", "buo/cask-upgrade"])
.args(["--repository", "buo/cask-upgrade"])
.check_output()
.map(|p| Path::new(p.trim()).exists())?;
let mut brew_args = vec![];
if cask_upgrade_exists {
brew_args.extend(&["cu", "-y"]);
brew_args.extend(["cu", "-y"]);
if ctx.config().brew_cask_greedy() {
brew_args.push("-a");
}
} else {
brew_args.extend(&["upgrade", "--cask"]);
brew_args.extend(["upgrade", "--cask"]);
if ctx.config().brew_cask_greedy() {
brew_args.push("--greedy");
}
@@ -268,7 +298,7 @@ pub fn run_guix(ctx: &ExecutionContext) -> Result<()> {
print_separator("Guix");
if should_upgrade {
return run_type.execute(&guix).args(&["package", "-u"]).check_run();
return run_type.execute(&guix).args(["package", "-u"]).check_run();
}
Err(SkipStep(String::from("Guix Pull Failed, Skipping")).into())
}
@@ -277,8 +307,14 @@ pub fn run_nix(ctx: &ExecutionContext) -> Result<()> {
let nix = require("nix")?;
let nix_channel = require("nix-channel")?;
let nix_env = require("nix-env")?;
let profile_path = match home::home_dir() {
Some(home) => Path::new(&home).join(".nix-profile"),
None => Path::new("/nix/var/nix/profiles/per-user/default").into(),
};
debug!("nix profile: {:?}", profile_path);
let manifest_json_path = profile_path.join("manifest.json");
let output = Command::new(&nix_env).args(&["--query", "nix"]).check_output();
let output = Command::new(&nix_env).args(["--query", "nix"]).check_output();
debug!("nix-env output: {:?}", output);
let should_self_upgrade = output.is_ok();
@@ -316,8 +352,18 @@ pub fn run_nix(ctx: &ExecutionContext) -> Result<()> {
}
}
run_type.execute(&nix_channel).arg("--update").check_run()?;
run_type.execute(&nix_env).arg("--upgrade").check_run()
run_type.execute(nix_channel).arg("--update").check_run()?;
if std::path::Path::new(&manifest_json_path).exists() {
run_type
.execute(&nix)
.arg("profile")
.arg("upgrade")
.arg(".*")
.check_run()
} else {
run_type.execute(&nix_env).arg("--upgrade").check_run()
}
}
pub fn run_yadm(ctx: &ExecutionContext) -> Result<()> {
@@ -325,7 +371,7 @@ pub fn run_yadm(ctx: &ExecutionContext) -> Result<()> {
print_separator("yadm");
ctx.run_type().execute(&yadm).arg("pull").check_run()
ctx.run_type().execute(yadm).arg("pull").check_run()
}
pub fn run_asdf(run_type: RunType) -> Result<()> {
@@ -339,28 +385,28 @@ pub fn run_asdf(run_type: RunType) -> Result<()> {
return Err(TopgradeError::ProcessFailed(e).into());
}
}
run_type.execute(&asdf).args(&["plugin", "update", "--all"]).check_run()
run_type.execute(&asdf).args(["plugin", "update", "--all"]).check_run()
}
pub fn run_home_manager(run_type: RunType) -> Result<()> {
let home_manager = require("home-manager")?;
print_separator("home-manager");
run_type.execute(&home_manager).arg("switch").check_run()
run_type.execute(home_manager).arg("switch").check_run()
}
pub fn run_tldr(run_type: RunType) -> Result<()> {
let tldr = require("tldr")?;
print_separator("TLDR");
run_type.execute(&tldr).arg("--update").check_run()
run_type.execute(tldr).arg("--update").check_run()
}
pub fn run_pearl(run_type: RunType) -> Result<()> {
let pearl = require("pearl")?;
print_separator("pearl");
run_type.execute(&pearl).arg("update").check_run()
run_type.execute(pearl).arg("update").check_run()
}
pub fn run_sdkman(base_dirs: &BaseDirs, cleanup: bool, run_type: RunType) -> Result<()> {
@@ -393,30 +439,27 @@ pub fn run_sdkman(base_dirs: &BaseDirs, cleanup: bool, run_type: RunType) -> Res
let cmd_selfupdate = format!("source {} && sdk selfupdate", &sdkman_init_path);
run_type
.execute(&bash)
.args(&["-c", cmd_selfupdate.as_str()])
.args(["-c", cmd_selfupdate.as_str()])
.check_run()?;
}
let cmd_update = format!("source {} && sdk update", &sdkman_init_path);
run_type.execute(&bash).args(&["-c", cmd_update.as_str()]).check_run()?;
run_type.execute(&bash).args(["-c", cmd_update.as_str()]).check_run()?;
let cmd_upgrade = format!("source {} && sdk upgrade", &sdkman_init_path);
run_type
.execute(&bash)
.args(&["-c", cmd_upgrade.as_str()])
.check_run()?;
run_type.execute(&bash).args(["-c", cmd_upgrade.as_str()]).check_run()?;
if cleanup {
let cmd_flush_archives = format!("source {} && sdk flush archives", &sdkman_init_path);
run_type
.execute(&bash)
.args(&["-c", cmd_flush_archives.as_str()])
.args(["-c", cmd_flush_archives.as_str()])
.check_run()?;
let cmd_flush_temp = format!("source {} && sdk flush temp", &sdkman_init_path);
run_type
.execute(&bash)
.args(&["-c", cmd_flush_temp.as_str()])
.args(["-c", cmd_flush_temp.as_str()])
.check_run()?;
}
@@ -428,7 +471,17 @@ pub fn run_bun(ctx: &ExecutionContext) -> Result<()> {
print_separator("Bun");
ctx.run_type().execute(&bun).arg("upgrade").check_run()
ctx.run_type().execute(bun).arg("upgrade").check_run()
}
/// Update dotfiles with `rcm(7)`.
///
/// See: <https://github.com/thoughtbot/rcm>
pub fn run_rcm(ctx: &ExecutionContext) -> Result<()> {
let rcup = require("rcup")?;
print_separator("rcm");
ctx.run_type().execute(rcup).arg("-v").check_run()
}
pub fn reboot() {

View File

@@ -26,7 +26,7 @@ pub fn run_chocolatey(ctx: &ExecutionContext) -> Result<()> {
args.insert(0, "choco");
}
let mut command = ctx.run_type().execute(&cmd);
let mut command = ctx.run_type().execute(cmd);
command.args(&args);
@@ -47,7 +47,7 @@ pub fn run_winget(ctx: &ExecutionContext) -> Result<()> {
return Err(SkipStep(String::from("Winget is disabled by default")).into());
}
ctx.run_type().execute(&winget).args(&["upgrade", "--all"]).check_run()
ctx.run_type().execute(&winget).args(["upgrade", "--all"]).check_run()
}
pub fn run_scoop(cleanup: bool, run_type: RunType) -> Result<()> {
@@ -55,34 +55,34 @@ pub fn run_scoop(cleanup: bool, run_type: RunType) -> Result<()> {
print_separator("Scoop");
run_type.execute(&scoop).args(&["update"]).check_run()?;
run_type.execute(&scoop).args(&["update", "*"]).check_run()?;
run_type.execute(&scoop).args(["update"]).check_run()?;
run_type.execute(&scoop).args(["update", "*"]).check_run()?;
if cleanup {
run_type.execute(&scoop).args(&["cleanup", "*"]).check_run()?;
run_type.execute(&scoop).args(["cleanup", "*"]).check_run()?;
}
Ok(())
}
fn get_wsl_distributions(wsl: &Path) -> Result<Vec<String>> {
let output = Command::new(wsl).args(&["--list", "-q"]).check_output()?;
let output = Command::new(&wsl).args(["--list", "-q"]).check_output()?;
Ok(output
.lines()
.filter(|s| !s.is_empty())
.map(|x| x.replace('\u{0}', "").replace('\r', ""))
.map(|x| x.replace(['\u{0}', '\r'], ""))
.collect())
}
fn upgrade_wsl_distribution(wsl: &Path, dist: &str, ctx: &ExecutionContext) -> Result<()> {
let topgrade = Command::new(&wsl)
.args(&["-d", dist, "bash", "-lc", "which topgrade"])
let topgrade = Command::new(wsl)
.args(["-d", dist, "bash", "-lc", "which topgrade"])
.check_output()
.map_err(|_| SkipStep(String::from("Could not find Topgrade installed in WSL")))?;
let mut command = ctx.run_type().execute(&wsl);
command
.args(&["-d", dist, "bash", "-c"])
.args(["-d", dist, "bash", "-c"])
.arg(format!("TOPGRADE_PREFIX={} exec {}", dist, topgrade));
if ctx.config().yes(Step::Wsl) {
@@ -134,7 +134,7 @@ pub fn windows_update(ctx: &ExecutionContext) -> Result<()> {
}
pub fn reboot() {
Command::new("shutdown").args(&["/R", "/T", "0"]).spawn().ok();
Command::new("shutdown").args(["/R", "/T", "0"]).spawn().ok();
}
pub fn insert_startup_scripts(ctx: &ExecutionContext, git_repos: &mut Repositories) -> Result<()> {

View File

@@ -26,7 +26,7 @@ impl Powershell {
let profile = path.as_ref().and_then(|path| {
Command::new(path)
.args(&["-NoProfile", "-Command", "Split-Path $profile"])
.args(["-NoProfile", "-Command", "Split-Path $profile"])
.check_output()
.map(|output| PathBuf::from(output.trim()))
.and_then(|p| p.require())
@@ -46,8 +46,8 @@ impl Powershell {
#[cfg(windows)]
pub fn has_module(powershell: &Path, command: &str) -> bool {
Command::new(&powershell)
.args(&[
Command::new(powershell)
.args([
"-NoProfile",
"-Command",
&format!("Get-Module -ListAvailable {}", command),
@@ -78,8 +78,9 @@ impl Powershell {
println!("Updating modules...");
ctx.run_type()
.execute(&powershell)
.args(&["-NoProfile", "-Command", &cmd.join(" ")])
.execute(powershell)
// This probably doesn't need `shell_words::join`.
.args(["-NoProfile", "-Command", &cmd.join(" ")])
.check_run()
}
@@ -99,14 +100,14 @@ impl Powershell {
let mut command = if let Some(sudo) = ctx.sudo() {
let mut command = ctx.run_type().execute(sudo);
command.arg(&powershell);
command.arg(powershell);
command
} else {
ctx.run_type().execute(&powershell)
ctx.run_type().execute(powershell)
};
command
.args(&[
.args([
"-NoProfile",
"-Command",
&format!(

View File

@@ -18,13 +18,13 @@ pub fn ssh_step(ctx: &ExecutionContext, hostname: &str) -> Result<()> {
}
let env = format!("TOPGRADE_PREFIX={}", hostname);
args.extend(&["env", &env, "$SHELL", "-lc", topgrade]);
args.extend(["env", &env, "$SHELL", "-lc", topgrade]);
if ctx.config().run_in_tmux() && !ctx.run_type().dry() {
#[cfg(unix)]
{
prepare_async_ssh_command(&mut args);
crate::tmux::run_command(ctx, &args.join(" "))?;
crate::tmux::run_command(ctx, &shell_words::join(args))?;
Err(SkipStep(String::from("Remote Topgrade launched in Tmux")).into())
}
@@ -42,11 +42,11 @@ pub fn ssh_step(ctx: &ExecutionContext, hostname: &str) -> Result<()> {
}
let env = format!("TOPGRADE_PREFIX={}", hostname);
args.extend(&["env", &env, "$SHELL", "-lc", topgrade]);
args.extend(["env", &env, "$SHELL", "-lc", topgrade]);
print_separator(format!("Remote ({})", hostname));
println!("Connecting to {}...", hostname);
ctx.run_type().execute(&ssh).args(&args).check_run()
ctx.run_type().execute(ssh).args(&args).check_run()
}
}

View File

@@ -113,7 +113,7 @@ impl<'a> TemporaryPowerOn<'a> {
ctx.run_type()
.execute(vagrant)
.args(&[subcommand, &vagrant_box.name])
.args([subcommand, &vagrant_box.name])
.current_dir(vagrant_box.path.clone())
.check_run()?;
Ok(TemporaryPowerOn {
@@ -140,7 +140,7 @@ impl<'a> Drop for TemporaryPowerOn<'a> {
self.ctx
.run_type()
.execute(self.vagrant)
.args(&[subcommand, &self.vagrant_box.name])
.args([subcommand, &self.vagrant_box.name])
.current_dir(self.vagrant_box.path.clone())
.check_run()
.ok();
@@ -198,7 +198,7 @@ pub fn topgrade_vagrant_box(ctx: &ExecutionContext, vagrant_box: &VagrantBox) ->
ctx.run_type()
.execute(&vagrant.path)
.current_dir(&vagrant_box.path)
.args(&["ssh", "-c", &command])
.args(["ssh", "-c", &command])
.check_run()
}
@@ -207,7 +207,7 @@ pub fn upgrade_vagrant_boxes(ctx: &ExecutionContext) -> Result<()> {
print_separator("Vagrant boxes");
let outdated = Command::new(&vagrant)
.args(&["box", "outdated", "--global"])
.args(["box", "outdated", "--global"])
.check_output()?;
let re = Regex::new(r"\* '(.*?)' for '(.*?)' is outdated").unwrap();
@@ -218,8 +218,8 @@ pub fn upgrade_vagrant_boxes(ctx: &ExecutionContext) -> Result<()> {
let _ = ctx
.run_type()
.execute(&vagrant)
.args(&["box", "update", "--box"])
.arg(&ele.get(1).unwrap().as_str())
.args(["box", "update", "--box"])
.arg(ele.get(1).unwrap().as_str())
.arg("--provider")
.arg(ele.get(2).unwrap().as_str())
.check_run();
@@ -228,7 +228,7 @@ pub fn upgrade_vagrant_boxes(ctx: &ExecutionContext) -> Result<()> {
if !found {
println!("No outdated boxes")
} else {
ctx.run_type().execute(&vagrant).args(&["box", "prune"]).check_run()?;
ctx.run_type().execute(&vagrant).args(["box", "prune"]).check_run()?;
}
Ok(())

View File

@@ -20,7 +20,7 @@ pub fn run_tpm(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
print_separator("tmux plugins");
run_type.execute(&tpm).arg("all").check_run()
run_type.execute(tpm).arg("all").check_run()
}
struct Tmux {
@@ -29,12 +29,10 @@ struct Tmux {
}
impl Tmux {
fn new(args: &Option<String>) -> Self {
fn new(args: Vec<String>) -> Self {
Self {
tmux: which("tmux").expect("Could not find tmux"),
args: args
.as_ref()
.map(|args| args.split_whitespace().map(String::from).collect()),
args: if args.is_empty() { None } else { Some(args) },
}
}
@@ -49,7 +47,7 @@ impl Tmux {
fn has_session(&self, session_name: &str) -> Result<bool, io::Error> {
Ok(self
.build()
.args(&["has-session", "-t", session_name])
.args(["has-session", "-t", session_name])
.output()?
.status
.success())
@@ -58,7 +56,7 @@ impl Tmux {
fn new_session(&self, session_name: &str) -> Result<bool, io::Error> {
Ok(self
.build()
.args(&["new-session", "-d", "-s", session_name, "-n", "dummy"])
.args(["new-session", "-d", "-s", session_name, "-n", "dummy"])
.spawn()?
.wait()?
.success())
@@ -66,7 +64,7 @@ impl Tmux {
fn run_in_session(&self, command: &str) -> Result<()> {
self.build()
.args(&["new-window", "-t", "topgrade", command])
.args(["new-window", "-t", "topgrade", command])
.spawn()?
.wait()?
.check()?;
@@ -75,7 +73,7 @@ impl Tmux {
}
}
pub fn run_in_tmux(args: &Option<String>) -> ! {
pub fn run_in_tmux(args: Vec<String>) -> ! {
let command = {
let mut command = vec![
String::from("env"),
@@ -83,7 +81,7 @@ pub fn run_in_tmux(args: &Option<String>) -> ! {
String::from("TOPGRADE_INSIDE_TMUX=1"),
];
command.extend(env::args());
command.join(" ")
shell_words::join(command)
};
let tmux = Tmux::new(args);
@@ -92,14 +90,14 @@ pub fn run_in_tmux(args: &Option<String>) -> ! {
tmux.new_session("topgrade").expect("Error creating a tmux session");
}
tmux.run_in_session(&command).expect("Error running topgrade in tmux");
tmux.run_in_session(&command).expect("Error running Topgrade in tmux");
tmux.build()
.args(&["kill-window", "-t", "topgrade:dummy"])
.args(["kill-window", "-t", "topgrade:dummy"])
.output()
.expect("Error killing the dummy tmux window");
if env::var("TMUX").is_err() {
let err = tmux.build().args(&["attach", "-t", "topgrade"]).exec();
let err = tmux.build().args(["attach", "-t", "topgrade"]).exec();
panic!("{:?}", err);
} else {
println!("Topgrade launched in a new tmux session");
@@ -108,9 +106,9 @@ pub fn run_in_tmux(args: &Option<String>) -> ! {
}
pub fn run_command(ctx: &ExecutionContext, command: &str) -> Result<()> {
Tmux::new(ctx.config().tmux_arguments())
Tmux::new(ctx.config().tmux_arguments()?)
.build()
.args(&["new-window", "-a", "-t", "topgrade:1", command])
.args(["new-window", "-a", "-t", "topgrade:1", command])
.env_remove("TMUX")
.spawn()?
.wait()?

View File

@@ -8,7 +8,7 @@ use std::path::Path;
use std::{path::PathBuf, process::Command};
fn list_toolboxes(toolbx: &Path) -> Result<Vec<String>> {
let output = Command::new(toolbx).args(&["list", "--containers"]).output()?;
let output = Command::new(toolbx).args(["list", "--containers"]).output()?;
let output_str = String::from_utf8(output.stdout)?;
let proc: Vec<String> = output_str
@@ -33,7 +33,7 @@ pub fn run_toolbx(ctx: &ExecutionContext) -> Result<()> {
debug!("Toolboxes to inspect: {:?}", toolboxes);
let mut topgrade_path = PathBuf::from("/run/host");
// Path of the running topgrade executable
// Path of the running Topgrade executable
// Skip 1 to eliminate the path root, otherwise push overwrites the path
topgrade_path.push(std::env::current_exe()?.components().skip(1).collect::<PathBuf>());
let topgrade_path = topgrade_path.to_str().unwrap();

View File

@@ -18,11 +18,6 @@ if exists(":PlugUpgrade")
endif
endif
if exists(":PackerUpdate")
echo "Packer"
PackerSync
endif
if exists("*dein#update()")
echo "dein#update()"
call dein#update()
@@ -43,4 +38,10 @@ if exists(":CocUpdateSync")
CocUpdateSync
endif
quitall
if exists(':PackerSync')
echo "Packer"
autocmd User PackerComplete quitall
PackerSync
else
quitall
endif

View File

@@ -1,7 +1,7 @@
use crate::error::{SkipStep, TopgradeError};
use anyhow::Result;
use crate::executor::{CommandExt, ExecutorOutput, RunType};
use crate::executor::{CommandExt, Executor, ExecutorOutput, RunType};
use crate::terminal::print_separator;
use crate::{
execution_context::ExecutionContext,
@@ -9,7 +9,7 @@ use crate::{
};
use directories::BaseDirs;
use log::debug;
use std::path::{Path, PathBuf};
use std::path::PathBuf;
use std::{
io::{self, Write},
process::Command,
@@ -40,19 +40,14 @@ fn nvimrc(base_dirs: &BaseDirs) -> Result<PathBuf> {
.or_else(|_| base_dir.join("nvim/init.lua").require())
}
fn upgrade(vim: &Path, vimrc: &Path, ctx: &ExecutionContext) -> Result<()> {
fn upgrade_script() -> Result<tempfile::NamedTempFile> {
let mut tempfile = tempfile::NamedTempFile::new()?;
tempfile.write_all(UPGRADE_VIM.replace('\r', "").as_bytes())?;
debug!("Wrote vim script to {:?}", tempfile.path());
Ok(tempfile)
}
let mut command = ctx.run_type().execute(&vim);
command
.args(&["-u"])
.arg(vimrc)
.args(&["-U", "NONE", "-V1", "-nNesS"])
.arg(tempfile.path());
fn upgrade(command: &mut Executor, ctx: &ExecutionContext) -> Result<()> {
if ctx.config().force_vim_plug_update() {
command.env("TOPGRADE_FORCE_PLUGUPDATE", "true");
}
@@ -88,17 +83,17 @@ pub fn upgrade_ultimate_vimrc(ctx: &ExecutionContext) -> Result<()> {
ctx.run_type()
.execute(&git)
.current_dir(&config_dir)
.args(&["reset", "--hard"])
.args(["reset", "--hard"])
.check_run()?;
ctx.run_type()
.execute(&git)
.current_dir(&config_dir)
.args(&["clean", "-d", "--force"])
.args(["clean", "-d", "--force"])
.check_run()?;
ctx.run_type()
.execute(&git)
.current_dir(&config_dir)
.args(&["pull", "--rebase"])
.args(["pull", "--rebase"])
.check_run()?;
ctx.run_type()
.execute(python)
@@ -114,13 +109,21 @@ pub fn upgrade_vim(base_dirs: &BaseDirs, ctx: &ExecutionContext) -> Result<()> {
let output = Command::new(&vim).arg("--version").check_output()?;
if !output.starts_with("VIM") {
return Err(SkipStep(String::from("vim binary might by actually nvim")).into());
return Err(SkipStep(String::from("vim binary might be actually nvim")).into());
}
let vimrc = vimrc(base_dirs)?;
print_separator("Vim");
upgrade(&vim, &vimrc, ctx)
upgrade(
ctx.run_type()
.execute(&vim)
.args(["-u"])
.arg(vimrc)
.args(["-U", "NONE", "-V1", "-nNesS"])
.arg(upgrade_script()?.path()),
ctx,
)
}
pub fn upgrade_neovim(base_dirs: &BaseDirs, ctx: &ExecutionContext) -> Result<()> {
@@ -128,7 +131,15 @@ pub fn upgrade_neovim(base_dirs: &BaseDirs, ctx: &ExecutionContext) -> Result<()
let nvimrc = nvimrc(base_dirs)?;
print_separator("Neovim");
upgrade(&nvim, &nvimrc, ctx)
upgrade(
ctx.run_type()
.execute(nvim)
.args(["-u"])
.arg(nvimrc)
.args(["--headless", "-V1", "-nS"])
.arg(upgrade_script()?.path()),
ctx,
)
}
pub fn run_voom(_base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {

View File

@@ -19,7 +19,7 @@ pub fn run_zr(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
print_separator("zr");
let cmd = format!("source {} && zr --update", zshrc(base_dirs).display());
run_type.execute(zsh).args(&["-l", "-c", cmd.as_str()]).check_run()
run_type.execute(zsh).args(["-l", "-c", cmd.as_str()]).check_run()
}
pub fn zshrc(base_dirs: &BaseDirs) -> PathBuf {
@@ -47,8 +47,8 @@ pub fn run_antigen(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
print_separator("antigen");
let cmd = format!("source {} && antigen selfupdate && antigen update", zshrc.display());
run_type.execute(zsh).args(&["-l", "-c", cmd.as_str()]).check_run()
let cmd = format!("source {} && (antigen selfupdate ; antigen update)", zshrc.display());
run_type.execute(zsh).args(["-l", "-c", cmd.as_str()]).check_run()
}
pub fn run_zgenom(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
@@ -62,7 +62,7 @@ pub fn run_zgenom(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
print_separator("zgenom");
let cmd = format!("source {} && zgenom selfupdate && zgenom update", zshrc.display());
run_type.execute(zsh).args(&["-l", "-c", cmd.as_str()]).check_run()
run_type.execute(zsh).args(["-l", "-c", cmd.as_str()]).check_run()
}
pub fn run_zplug(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
@@ -76,7 +76,7 @@ pub fn run_zplug(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
print_separator("zplug");
run_type.execute(zsh).args(&["-i", "-c", "zplug update"]).check_run()
run_type.execute(zsh).args(["-i", "-c", "zplug update"]).check_run()
}
pub fn run_zinit(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
@@ -91,7 +91,7 @@ pub fn run_zinit(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
print_separator("zinit");
let cmd = format!("source {} && zinit self-update && zinit update --all", zshrc.display(),);
run_type.execute(zsh).args(&["-i", "-c", cmd.as_str()]).check_run()
run_type.execute(zsh).args(["-i", "-c", cmd.as_str()]).check_run()
}
pub fn run_zi(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
@@ -111,7 +111,7 @@ pub fn run_zim(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
env::var("ZIM_HOME")
.or_else(|_| {
Command::new("zsh")
.args(&["-c", "[[ -n ${ZIM_HOME} ]] && print -n ${ZIM_HOME}"])
.args(["-c", "[[ -n ${ZIM_HOME} ]] && print -n ${ZIM_HOME}"])
.check_output()
})
.map(PathBuf::from)
@@ -122,7 +122,7 @@ pub fn run_zim(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
run_type
.execute(zsh)
.args(&["-i", "-c", "zimfw upgrade && zimfw update"])
.args(["-i", "-c", "zimfw upgrade && zimfw update"])
.check_run()
}
@@ -135,7 +135,7 @@ pub fn run_oh_my_zsh(ctx: &ExecutionContext) -> Result<()> {
let custom_dir = env::var::<_>("ZSH_CUSTOM")
.or_else(|_| {
Command::new("zsh")
.args(&["-c", "test $ZSH_CUSTOM && echo -n $ZSH_CUSTOM"])
.args(["-c", "test $ZSH_CUSTOM && echo -n $ZSH_CUSTOM"])
.check_output()
})
.map(PathBuf::from)

View File

@@ -104,7 +104,7 @@ impl Terminal {
command.arg("-t");
command.arg(format!("{}", timeout.as_millis()));
}
command.args(&["-a", "Topgrade", "Topgrade"]);
command.args(["-a", "Topgrade", "Topgrade"]);
command.arg(message.as_ref());
command.output().ok();
}
@@ -223,7 +223,7 @@ impl Terminal {
self.term.set_title("Topgrade - Awaiting user");
}
self.notify_desktop(&format!("{} failed", step_name), None);
self.notify_desktop(format!("{} failed", step_name), None);
self.term
.write_fmt(format_args!(

View File

@@ -2,7 +2,7 @@
.TH "topgrade" "8"
.SH NAME
.PP
topgrade \- upgrade everything
Topgrade \- Upgrade everything
.SH SYNOPSIS
.PP
topgrade [\fIoptions\f[]]
@@ -10,7 +10,7 @@ topgrade [\fIoptions\f[]]
.PP
Keeping your system up to date usually involves invoking multiple package managers.
This results in big, non-portable shell one-liners saved in your shell.
To remedy this, \fBtopgrade\fR detects which tools you use and runs the appropriate commands to update them.
To remedy this, \fBTopgrade\fR detects which tools you use and runs the appropriate commands to update them.
.SH OPTIONS
.TP
.B \-\-only <only>
@@ -75,6 +75,6 @@ A list of steps must be provided as a list of separate arguments, i.e. 'topgrade
.SH BUGS
For a list of bugs see <\fIhttps://github.com/r-darwish/topgrade/issues\fR>.
.SH AUTHOR
\fBtopgrade\fR is maintained by Roey Dror (\[aq]r\-darwish\[aq]) and many other contributors.
\fBTopgrade\fR is maintained by Roey Dror (\[aq]r\-darwish\[aq]) and many other contributors.
You can view the full list at
<\fIhttps://github.com/r-darwish/topgrade/graphs/contributors\fR>