fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Fabian BoehmReformat share/**.fish with newlines collapsed78c948282

master
2.6 KiB38 linesraw
1function __fish_ansible_vault_no_subcommand -d 'Test if ansible-vault has yet to be given the subcommand'
2    commandline -pc | not string match --regex '[^-]\b(?:create|decrypt|edit|encrypt|encrypt_string|rekey|view)\b'
3end
4
5function __fish_ansible_vault_using_command
6    set -l cmd (string trim (__fish_ansible_vault_no_subcommand))
7    test -z "$cmd"
8    and return 1
9    contains -- "$cmd" $argv
10end
11
12# generic options
13complete -c ansible-vault -l version -d "Display version and exit"
14complete -c ansible-vault -s h -l help -f -d "Show help message and exit"
15complete -c ansible-vault -s v -l verbose -d "Verbose mode (-vvv for more, -vvvv to enable connection debugging)"
16complete -c ansible-vault -l ask-vault-pass -f -d "Ask for vault password"
17complete -c ansible-vault -l new-vault-id -r -d "the new vault identity to use for rekey"
18complete -c ansible-vault -l new-vault-password-file -r -d "New vault password file for rekey"
19complete -c ansible-vault -l vault-id -r -d "the vault identity to use"
20complete -c ansible-vault -l vault-password-file -r -d "Vault password file"
21
22# subcommands
23complete -c ansible-vault -n __fish_ansible_vault_no_subcommand -a decrypt -d 'Decrypt encrypted file or stdin'
24complete -c ansible-vault -n __fish_ansible_vault_no_subcommand -a encrypt -d 'Encrypt a file or stdin'
25complete -c ansible-vault -n __fish_ansible_vault_no_subcommand -ra create -d 'Create encrypted file'
26complete -c ansible-vault -n __fish_ansible_vault_no_subcommand -ra edit -d 'Edit encrypted file'
27complete -c ansible-vault -n __fish_ansible_vault_no_subcommand -ra rekey -d 'Rekey encrypted file'
28complete -c ansible-vault -n __fish_ansible_vault_no_subcommand -ra view -d 'View contents of something encrypted'
29complete -f -c ansible-vault -n __fish_ansible_vault_no_subcommand -a encrypt_string -d 'Encrypt string'
30
31# encrypt_string options
32complete -c ansible-vault -n '__fish_ansible_vault_using_command encrypt encrypt_string' -r -l stdin-name -f -d 'Specify the variable name for stdin'
33complete -c ansible-vault -n '__fish_ansible_vault_using_command encrypt encrypt_string' -r -s n -l name -f -d 'Specify the variable name'
34complete -c ansible-vault -n '__fish_ansible_vault_using_command encrypt encrypt_string' -s p -l prompt -d 'Prompt for the string to encrypt'
35
36# shared options
37complete -c ansible-vault -n '__fish_ansible_vault_using_command encrypt encrypt_string rekey edit create' -l encrypt-vault-id -r -d "the vault id used to encrypt (required if more than vault-id is provided)"
38complete -c ansible-vault -n '__fish_ansible_vault_using_command encrypt encrypt_string decrypt' -l output -r -d "Output file name for encrypt or decrypt; use - for stdout"