1
Fork 0
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:
ZetaNumbers 2022-03-02 15:36:42 +03:00 committed by GitHub
parent 51699e4b4a
commit 77b74c02ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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" [] {
open Cargo.toml | get profile | transpose | get column0
}
@ -27,7 +36,7 @@ extern "cargo 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
--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
--release # Build artifacts in release mode, with optimizations
--profile: string@"nu-complete cargo profiles" # Build artifacts with the specified profile