From f254692759aa564420702a54e76feb133b50c25d Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Fri, 31 Dec 2021 04:02:08 +0700 Subject: [PATCH] completions/opam: add completions for "opam switch" --- share/completions/opam.fish | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/share/completions/opam.fish b/share/completions/opam.fish index fb3f4c4f3..1738586bd 100644 --- a/share/completions/opam.fish +++ b/share/completions/opam.fish @@ -102,3 +102,22 @@ complete -f -c opam -n '__fish_opam_using_command admin' -a check -d "Check a lo complete -f -c opam -n '__fish_opam_using_command admin' -a depexts -d "Add external dependencies." complete -f -c opam -n '__fish_opam_using_command admin' -a make -d "Initialize a repo for serving files." complete -f -c opam -n '__fish_opam_using_command admin' -a stats -d "Compute statistics." + +# opam switch +set -l switchcommands create set remove export import reinstall list list-available show set-base set-description link +complete -c opam -f -n "__fish_seen_subcommand_from switch; and not __fish_seen_subcommand_from $switchcommands" -a 'create' -d 'Create a new switch, and install the given compiler there' +complete -c opam -f -n "__fish_seen_subcommand_from switch; and not __fish_seen_subcommand_from $switchcommands" -a 'set' -d 'Set the currently active switch' +complete -c opam -f -n "__fish_seen_subcommand_from switch; and not __fish_seen_subcommand_from $switchcommands" -a 'remove' -d 'Remove the given switch from disk' +complete -c opam -n "__fish_seen_subcommand_from switch; and not __fish_seen_subcommand_from $switchcommands" -a 'export' -d 'Save the current switch state to a file' +complete -c opam -n "__fish_seen_subcommand_from switch; and not __fish_seen_subcommand_from $switchcommands" -a 'import' -d 'Import a saved switch state' +complete -c opam -f -n "__fish_seen_subcommand_from switch; and not __fish_seen_subcommand_from $switchcommands" -a 'reinstall' -d 'Reinstall the given compiler switch and all its packages' +complete -c opam -f -n "__fish_seen_subcommand_from switch; and not __fish_seen_subcommand_from $switchcommands" -a 'list' -d 'Lists installed switches' +complete -c opam -f -n "__fish_seen_subcommand_from switch; and not __fish_seen_subcommand_from $switchcommands" -a 'list-available' -d 'Lists base packages that can be used to create a new switch' +complete -c opam -f -n "__fish_seen_subcommand_from switch; and not __fish_seen_subcommand_from $switchcommands" -a 'show' -d 'Prints the name of the current switch' +complete -c opam -f -n "__fish_seen_subcommand_from switch; and not __fish_seen_subcommand_from $switchcommands" -a 'set-base' -d 'Sets the packages forming the immutable base for the selected switch' +complete -c opam -f -n "__fish_seen_subcommand_from switch; and not __fish_seen_subcommand_from $switchcommands" -a 'link' -d 'Sets a local alias for a given switch' + +complete -c opam -f -n "__fish_seen_subcommand_from switch; and __fish_seen_subcommand_from set" -a '(opam switch list --short)' +complete -c opam -f -n "__fish_seen_subcommand_from switch; and __fish_seen_subcommand_from remove" -a '(opam switch list --short)' + +complete -c opam -f -n "__fish_seen_subcommand_from switch; and __fish_seen_subcommand_from create" -a '(opam switch list-available --short)'