diff options
| author | Paul Buetow <paul@buetow.org> | 2025-11-01 23:12:20 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-11-01 23:12:20 +0200 |
| commit | c87e2837112c064da8528d38727dd7cad7acaa32 (patch) | |
| tree | 51612e1a43e6f6f73ea168d74285b5dfc4b74a53 /completions/geheim.fish | |
| parent | 28ccc70feeab8aef7bcafaea75e288e6e58c2034 (diff) | |
Add fish shell integration with dynamic command completion (v0.2.0)v0.2.0
Amp-Thread-ID: https://ampcode.com/threads/T-9aec59d6-cd27-4607-ac11-baac5f2ca758
Co-authored-by: Amp <amp@ampcode.com>
Diffstat (limited to 'completions/geheim.fish')
| -rw-r--r-- | completions/geheim.fish | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/completions/geheim.fish b/completions/geheim.fish new file mode 100644 index 0000000..c36ad03 --- /dev/null +++ b/completions/geheim.fish @@ -0,0 +1,33 @@ +# Fish completion for geheim +# Install to ~/.config/fish/completions/geheim.fish + +# Dynamically load commands from geheim +function __fish_geheim_commands + geheim commands 2>/dev/null +end + +# Get list of entries for completion +function __fish_geheim_entries + # Only run if PIN is set to avoid interactive prompt + if set -q PIN + geheim ls 2>/dev/null | string replace -r ';.*$' '' | string trim + end +end + +# Complete subcommands +complete -c geheim -f -n "__fish_use_subcommand" -a "(__fish_geheim_commands)" + +# Complete search terms for commands that need them +complete -c geheim -f -n "__fish_seen_subcommand_from search cat paste export pathexport open edit rm" -a "(__fish_geheim_entries)" + +# Complete file paths for import +complete -c geheim -n "__fish_seen_subcommand_from import" -F + +# Complete directory paths for import destination +complete -c geheim -n "__fish_seen_subcommand_from import; and __fish_is_nth_token 3" -F -a "(__fish_complete_directories)" + +# Force flag for import +complete -c geheim -n "__fish_seen_subcommand_from import; and __fish_is_nth_token 4" -f -a "force" + +# Complete directory paths for import_r +complete -c geheim -n "__fish_seen_subcommand_from import_r" -F -a "(__fish_complete_directories)" |
