Skip to content

Commit

Permalink
Add completions for cargo-asm
Browse files Browse the repository at this point in the history
  • Loading branch information
mqudsi committed May 17, 2024
1 parent f4a79cc commit 0271d91
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions share/completions/cargo.fish
Original file line number Diff line number Diff line change
Expand Up @@ -814,3 +814,31 @@ complete -c cargo -n "__fish_seen_subcommand_from help" -s v -l verbose -d 'Use
complete -c cargo -n "__fish_seen_subcommand_from help" -l frozen -d 'Require Cargo.lock and cache are up to date'
complete -c cargo -n "__fish_seen_subcommand_from help" -l locked -d 'Require Cargo.lock is up to date'
complete -c cargo -n "__fish_seen_subcommand_from help" -l offline -d 'Run without accessing the network'

# Add completions for popular cargo addon `cargo-asm` (that at least one fish dev uses)
if command -q cargo-asm

# Flags (no parameters)
complete -c cargo -n "__fish_seen_subcommand_from asm" -l comments -d "Print asm comments"
complete -c cargo -n "__fish_seen_subcommand_from asm" -l debug-info -d "Generate asm w/ debug info even if not required"
complete -c cargo -n "__fish_seen_subcommand_from asm" -l debug-mode -d "Print output useful for debugging"
complete -c cargo -n "__fish_seen_subcommand_from asm" -l directives -d "Print asm directives"
complete -c cargo -n "__fish_seen_subcommand_from asm" -l help -s h -d "Print cargo-asm help info"
complete -c cargo -n "__fish_seen_subcommand_from asm" -l json -d "Serialize asm AST to JSON"
complete -c cargo -n "__fish_seen_subcommand_from asm" -l lib -d "Build only the lib target"
complete -c cargo -n "__fish_seen_subcommand_from asm" -l no-color -d "Disable color output"
complete -c cargo -n "__fish_seen_subcommand_from asm" -l no-default-features -d "Disable all cargo features on build"
complete -c cargo -n "__fish_seen_subcommand_from asm" -l rust -d "Interleave asm output w/ rust code"
complete -c cargo -n "__fish_seen_subcommand_from asm" -l version -s V -d "Print cargo-asm version info"

# Options (require a parameter)
complete -c cargo -n "__fish_seen_subcommand_from asm" -rl target -d "Build for target"
complete -c cargo -n "__fish_seen_subcommand_from asm" -rl asm-style -d "ASM style (default: intel)" -xa "intel att"
complete -c cargo -n "__fish_seen_subcommand_from asm" -rl build-type -d "Build type (default: release)" -xa "debug release"
complete -c cargo -n "__fish_seen_subcommand_from asm" -rl features -d "Cargo features to enable"
complete -c cargo -n "__fish_seen_subcommand_from asm" -rl manifest-path -d "Run cargo-asm in a different directory"

# Dynamically generate completions for the function/impl path to translate to asm (the reason these completions exist)
complete -c cargo -n "__fish_seen_subcommand_from asm" -xa "(cargo asm)"
# TODO: dynamically generate completions for --features and --target
end

0 comments on commit 0271d91

Please sign in to comment.