mirror of
https://github.com/ClementTsang/bottom
synced 2024-11-10 14:44:18 +00:00
bump clap and add nushell/fig completions (#1300)
* add nushell and fig completion generation * now bump clap * bump cargo-action too * add rust-version key and set to 1.70.0, N-2
This commit is contained in:
parent
6256742f81
commit
5d455354dd
5 changed files with 70 additions and 46 deletions
6
.github/workflows/build_releases.yml
vendored
6
.github/workflows/build_releases.yml
vendored
|
@ -144,7 +144,7 @@ jobs:
|
|||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Build
|
||||
uses: ClementTsang/cargo-action@v0.0.4
|
||||
uses: ClementTsang/cargo-action@v0.0.5
|
||||
env:
|
||||
BTM_GENERATE: true
|
||||
BTM_BUILD_RELEASE_CALLER: ${{ inputs.caller }}
|
||||
|
@ -341,7 +341,7 @@ jobs:
|
|||
|
||||
# TODO: Could I use the previous jobs to skip this call?
|
||||
- name: Build
|
||||
uses: ClementTsang/cargo-action@v0.0.4
|
||||
uses: ClementTsang/cargo-action@v0.0.5
|
||||
env:
|
||||
BTM_GENERATE: true
|
||||
BTM_BUILD_RELEASE_CALLER: ${{ inputs.caller }}
|
||||
|
@ -439,7 +439,7 @@ jobs:
|
|||
|
||||
# TODO: Could I use the previous jobs to skip this call?
|
||||
- name: Build
|
||||
uses: ClementTsang/cargo-action@v0.0.4
|
||||
uses: ClementTsang/cargo-action@v0.0.5
|
||||
env:
|
||||
BTM_GENERATE: true
|
||||
BTM_BUILD_RELEASE_CALLER: ${{ inputs.caller }}
|
||||
|
|
17
.github/workflows/ci.yml
vendored
17
.github/workflows/ci.yml
vendored
|
@ -106,7 +106,7 @@ jobs:
|
|||
run: cargo fmt --all -- --check
|
||||
|
||||
- name: Build tests
|
||||
uses: ClementTsang/cargo-action@v0.0.4
|
||||
uses: ClementTsang/cargo-action@v0.0.5
|
||||
with:
|
||||
command: test
|
||||
args: --no-run --locked ${{ matrix.features }} --target=${{ matrix.info.target }}
|
||||
|
@ -116,7 +116,7 @@ jobs:
|
|||
RUST_BACKTRACE: full
|
||||
|
||||
- name: Run tests
|
||||
uses: ClementTsang/cargo-action@v0.0.4
|
||||
uses: ClementTsang/cargo-action@v0.0.5
|
||||
with:
|
||||
command: test
|
||||
args: --no-fail-fast ${{ matrix.features }} --target=${{ matrix.info.target }} -- --nocapture --quiet
|
||||
|
@ -126,7 +126,7 @@ jobs:
|
|||
RUST_BACKTRACE: full
|
||||
|
||||
- name: Run clippy
|
||||
uses: ClementTsang/cargo-action@v0.0.4
|
||||
uses: ClementTsang/cargo-action@v0.0.5
|
||||
with:
|
||||
command: clippy
|
||||
args: ${{ matrix.features }} --all-targets --workspace --target=${{ matrix.info.target }} -- -D warnings
|
||||
|
@ -235,7 +235,8 @@ jobs:
|
|||
os: "ubuntu-latest",
|
||||
target: "aarch64-linux-android",
|
||||
cross: true,
|
||||
rust: 1.67.0, # See https://github.com/cross-rs/cross/issues/1222 for more details
|
||||
rust: stable,
|
||||
cross-version: "git:d6511b7b166c18640f81b8f6a74d9eef380f7ded",
|
||||
no-default-features: true,
|
||||
}
|
||||
|
||||
|
@ -257,22 +258,22 @@ jobs:
|
|||
cache-all-crates: true
|
||||
|
||||
- name: Try building with only default features enabled
|
||||
uses: ClementTsang/cargo-action@v0.0.4
|
||||
uses: ClementTsang/cargo-action@v0.0.5
|
||||
if: ${{ matrix.info.no-default-features != true }}
|
||||
with:
|
||||
command: build
|
||||
args: --all-targets --verbose --target=${{ matrix.info.target }} --locked
|
||||
use-cross: ${{ matrix.info.cross }}
|
||||
cross-version: 0.2.5
|
||||
cross-version: ${{ matrix.info.cross-version || '0.2.5' }}
|
||||
|
||||
- name: Try building with no features enabled
|
||||
uses: ClementTsang/cargo-action@v0.0.4
|
||||
uses: ClementTsang/cargo-action@v0.0.5
|
||||
if: ${{ matrix.info.no-default-features == true }}
|
||||
with:
|
||||
command: build
|
||||
args: --all-targets --verbose --target=${{ matrix.info.target }} --locked --no-default-features
|
||||
use-cross: ${{ matrix.info.cross }}
|
||||
cross-version: 0.2.5
|
||||
cross-version: ${{ matrix.info.cross-version || '0.2.5' }}
|
||||
|
||||
completion:
|
||||
name: "CI Pass Check"
|
||||
|
|
59
Cargo.lock
generated
59
Cargo.lock
generated
|
@ -45,16 +45,15 @@ checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5"
|
|||
|
||||
[[package]]
|
||||
name = "anstream"
|
||||
version = "0.3.2"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163"
|
||||
checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"anstyle-parse",
|
||||
"anstyle-query",
|
||||
"anstyle-wincon",
|
||||
"colorchoice",
|
||||
"is-terminal",
|
||||
"utf8parse",
|
||||
]
|
||||
|
||||
|
@ -84,9 +83,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anstyle-wincon"
|
||||
version = "1.0.2"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c677ab05e09154296dd37acecd46420c17b9713e8366facafa8fc0885167cf4c"
|
||||
checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"windows-sys",
|
||||
|
@ -157,6 +156,8 @@ dependencies = [
|
|||
"cfg-if",
|
||||
"clap",
|
||||
"clap_complete",
|
||||
"clap_complete_fig",
|
||||
"clap_complete_nushell",
|
||||
"clap_mangen",
|
||||
"concat-string",
|
||||
"core-foundation",
|
||||
|
@ -238,36 +239,55 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.3.23"
|
||||
version = "4.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "03aef18ddf7d879c15ce20f04826ef8418101c7e528014c3eeea13321047dca3"
|
||||
checksum = "6a13b88d2c62ff462f88e4a121f17a82c1af05693a2f192b5c38d14de73c19f6"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.3.23"
|
||||
version = "4.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8ce6fffb678c9b80a70b6b6de0aad31df727623a70fd9a842c30cd573e2fa98"
|
||||
checksum = "2bb9faaa7c2ef94b2743a21f5a29e6f0010dff4caa69ac8e9d6cf8b6fa74da08"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
"clap_lex",
|
||||
"once_cell",
|
||||
"strsim 0.10.0",
|
||||
"terminal_size",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_complete"
|
||||
version = "4.3.2"
|
||||
version = "4.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5fc443334c81a804575546c5a8a79b4913b50e28d69232903604cada1de817ce"
|
||||
checksum = "4110a1e6af615a9e6d0a36f805d5c99099f8bab9b8042f5bc1fa220a4a89e36f"
|
||||
dependencies = [
|
||||
"clap",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_complete_fig"
|
||||
version = "4.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e9bae21b3f6eb417ad3054c8b1094aa0542116eba4979b1b271baefbfa6b965"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"clap_complete",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_complete_nushell"
|
||||
version = "4.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "787093c7ce9278e9f7ae55cbdba76a2d6610fe809e54db4c6d61a65bc0258d15"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"clap_complete",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_lex"
|
||||
version = "0.5.0"
|
||||
|
@ -276,9 +296,9 @@ checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b"
|
|||
|
||||
[[package]]
|
||||
name = "clap_mangen"
|
||||
version = "0.2.12"
|
||||
version = "0.2.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f2e32b579dae093c2424a8b7e2bea09c89da01e1ce5065eb2f0a6f1cc15cc1f"
|
||||
checksum = "cf8e5f34d85d9e0bbe2491d100a7a7c1007bb2467b518080bfe311e8947197a9"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"roff",
|
||||
|
@ -638,17 +658,6 @@ dependencies = [
|
|||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "is-terminal"
|
||||
version = "0.4.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"rustix 0.38.9",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.10.5"
|
||||
|
|
11
Cargo.toml
11
Cargo.toml
|
@ -31,6 +31,7 @@ exclude = [
|
|||
"Cross.toml",
|
||||
"rustfmt.toml",
|
||||
]
|
||||
rust-version = "1.70.0"
|
||||
|
||||
[[bin]]
|
||||
name = "btm"
|
||||
|
@ -79,7 +80,7 @@ default = ["deploy"]
|
|||
anyhow = "1.0.75"
|
||||
backtrace = "0.3.69"
|
||||
cfg-if = "1.0.0"
|
||||
clap = { version = "4.3.23", features = ["default", "cargo", "wrap_help"] }
|
||||
clap = { version = "4.4.2", features = ["default", "cargo", "wrap_help"] }
|
||||
concat-string = "1.0.1"
|
||||
crossterm = "0.27.0"
|
||||
ctrlc = { version = "3.4.0", features = ["termination"] }
|
||||
|
@ -139,9 +140,11 @@ cargo-husky = { version = "1.5.0", default-features = false, features = [
|
|||
predicates = "3.0.3"
|
||||
|
||||
[build-dependencies]
|
||||
clap = { version = "4.3.23", features = ["default", "cargo", "wrap_help"] }
|
||||
clap_complete = "4.3.2"
|
||||
clap_mangen = "0.2.12"
|
||||
clap = { version = "4.4.2", features = ["default", "cargo", "wrap_help"] }
|
||||
clap_complete = "4.4.1"
|
||||
clap_complete_fig = "4.4.0"
|
||||
clap_complete_nushell = "4.4.0"
|
||||
clap_mangen = "0.2.13"
|
||||
|
||||
[package.metadata.deb]
|
||||
section = "utility"
|
||||
|
|
23
build.rs
23
build.rs
|
@ -3,7 +3,9 @@ use std::{
|
|||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use clap_complete::{generate_to, shells::Shell};
|
||||
use clap_complete::{generate_to, shells::Shell, Generator};
|
||||
use clap_complete_fig::Fig;
|
||||
use clap_complete_nushell::Nushell;
|
||||
|
||||
include!("src/args.rs");
|
||||
|
||||
|
@ -19,6 +21,13 @@ fn create_dir(dir: &Path) -> io::Result<()> {
|
|||
res
|
||||
}
|
||||
|
||||
fn generate_completions<G>(to_generate: G, cmd: &mut Command, out_dir: &Path) -> io::Result<PathBuf>
|
||||
where
|
||||
G: Generator,
|
||||
{
|
||||
generate_to(to_generate, cmd, "btm", out_dir)
|
||||
}
|
||||
|
||||
fn btm_generate() -> io::Result<()> {
|
||||
const ENV_KEY: &str = "BTM_GENERATE";
|
||||
|
||||
|
@ -35,11 +44,13 @@ fn btm_generate() -> io::Result<()> {
|
|||
|
||||
// Generate completions
|
||||
let mut app = build_app();
|
||||
generate_to(Shell::Bash, &mut app, "btm", &completion_out_dir)?;
|
||||
generate_to(Shell::Zsh, &mut app, "btm", &completion_out_dir)?;
|
||||
generate_to(Shell::Fish, &mut app, "btm", &completion_out_dir)?;
|
||||
generate_to(Shell::PowerShell, &mut app, "btm", &completion_out_dir)?;
|
||||
generate_to(Shell::Elvish, &mut app, "btm", &completion_out_dir)?;
|
||||
generate_completions(Shell::Bash, &mut app, &completion_out_dir)?;
|
||||
generate_completions(Shell::Zsh, &mut app, &completion_out_dir)?;
|
||||
generate_completions(Shell::Fish, &mut app, &completion_out_dir)?;
|
||||
generate_completions(Shell::PowerShell, &mut app, &completion_out_dir)?;
|
||||
generate_completions(Shell::Elvish, &mut app, &completion_out_dir)?;
|
||||
generate_completions(Fig, &mut app, &completion_out_dir)?;
|
||||
generate_completions(Nushell, &mut app, &completion_out_dir)?;
|
||||
|
||||
// Generate manpage
|
||||
let app = app.name("btm");
|
||||
|
|
Loading…
Reference in a new issue