mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-02 07:07:46 +00:00
add completion for cargo packages (#169)
This commit is contained in:
parent
51699e4b4a
commit
77b74c02ef
1 changed files with 34 additions and 25 deletions
|
@ -14,6 +14,15 @@ def "nu-complete cargo examples" [] {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def "nu-complete cargo packages" [] {
|
||||||
|
let metadata = (cargo metadata --format-version=1)
|
||||||
|
if $metadata == '' {
|
||||||
|
[]
|
||||||
|
} else {
|
||||||
|
$metadata | from json | get workspace_members | split column ' ' | get column1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def "nu-complete cargo profiles" [] {
|
def "nu-complete cargo profiles" [] {
|
||||||
open Cargo.toml | get profile | transpose | get column0
|
open Cargo.toml | get profile | transpose | get column0
|
||||||
}
|
}
|
||||||
|
@ -23,29 +32,29 @@ def "nu-complete cargo features" [] {
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "cargo run" [
|
extern "cargo run" [
|
||||||
...args: any # arguments
|
...args: any # arguments
|
||||||
--bin: string@"nu-complete cargo bins" # Name of the bin target to run
|
--bin: string@"nu-complete cargo bins" # Name of the bin target to run
|
||||||
--example: string@"nu-complete cargo examples" # Name of the example target to run
|
--example: string@"nu-complete cargo examples" # Name of the example target to run
|
||||||
--quiet(-q) # Do not print cargo log messages
|
--quiet(-q) # Do not print cargo log messages
|
||||||
--package(-p): string # Package with the target to run
|
--package(-p): string@"nu-complete cargo packages"# Package with the target to run
|
||||||
--jobs(-j): number # Number of parallel jobs, defaults to # of CPUs
|
--jobs(-j): number # Number of parallel jobs, defaults to # of CPUs
|
||||||
--release # Build artifacts in release mode, with optimizations
|
--release # Build artifacts in release mode, with optimizations
|
||||||
--profile: string@"nu-complete cargo profiles" # Build artifacts with the specified profile
|
--profile: string@"nu-complete cargo profiles" # Build artifacts with the specified profile
|
||||||
--features: string@"nu-complete cargo features"# Space or comma separated list of features to activate
|
--features: string@"nu-complete cargo features" # Space or comma separated list of features to activate
|
||||||
--all-features # Activate all available features
|
--all-features # Activate all available features
|
||||||
--no-default-features # Do not activate the `default` feature
|
--no-default-features # Do not activate the `default` feature
|
||||||
--target: string # Build for the target triple
|
--target: string # Build for the target triple
|
||||||
--target-dir: path # Directory for all generated artifacts
|
--target-dir: path # Directory for all generated artifacts
|
||||||
--manifest-path: path # Path to Cargo.toml
|
--manifest-path: path # Path to Cargo.toml
|
||||||
--message-format: string # Error format
|
--message-format: string # Error format
|
||||||
--unit-graph # Output build graph in JSON (unstable)
|
--unit-graph # Output build graph in JSON (unstable)
|
||||||
--ignore-rust-version # Ignore `rust-version` specification in packages
|
--ignore-rust-version # Ignore `rust-version` specification in packages
|
||||||
--verbose(-v) # Use verbose output (-vv very verbose/build.rs output)
|
--verbose(-v) # Use verbose output (-vv very verbose/build.rs output)
|
||||||
--color: string # Coloring: auto, always, never
|
--color: string # Coloring: auto, always, never
|
||||||
--frozen # Require Cargo.lock and cache are up to date
|
--frozen # Require Cargo.lock and cache are up to date
|
||||||
--locked # Require Cargo.lock is up to date
|
--locked # Require Cargo.lock is up to date
|
||||||
--offline # Run without accessing the network
|
--offline # Run without accessing the network
|
||||||
--config: string # Override a configuration value (unstable)
|
--config: string # Override a configuration value (unstable)
|
||||||
-Z: string # Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details
|
-Z: string # Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details
|
||||||
--help(-h) # Prints help information
|
--help(-h) # Prints help information
|
||||||
]
|
]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue