fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
5dc07c9e7
master
1function __fish_opam_using_command 2set -l cmd( commandline -xpc) 3if test ( count $cmd ) -gt 1 4if test $argv [ 1 ] = $cmd [ 2 ] 5return 0 6end 7end 8return 1 9end 10 11function __fish_opam_needs_command 12set -l cmd( commandline -xpc) 13if test ( count $cmd ) -eq 1 14return 0 15end 16return 1 17end 18 19# general flags 20## ones that work without any subcommand 21complete -f -c opam -l help -d"Display the manual for an OPAM command" 22complete -f -c opam -l version -d'Show version information' 23## ones that require at least a subcommand (but are shared by all) 24complete -f -c opam -n'not __fish_opam_needs_command' -l color -d'Colorize the output' -a'always never auto' 25complete -f -c opam -n'not __fish_opam_needs_command' -l'compat-mode-1.0' -d'Compatibility mode with OPAM 1.0' 26complete -f -c opam -n'not __fish_opam_needs_command' -l debug -d'Print debug message on stdout' 27complete -f -c opam -n'not __fish_opam_needs_command' -l git-version -d'Print the git version if it exists and exit' 28complete -f -c opam -n'not __fish_opam_needs_command' -l no-aspcud -d'Do not use the external aspcud solver, even if available' 29complete -f -c opam -n'not __fish_opam_needs_command' -l no-base-packages -d'Do not install base packages' 30complete -f -c opam -n'not __fish_opam_needs_command' -s q -l quiet -d'Be quiet when installing a new compiler' 31complete -f -c opam -n'not __fish_opam_needs_command' -s r -l root -d'Use ROOT as the current root path' 32complete -f -c opam -n'not __fish_opam_needs_command' -l strict -d'Fail whenever an error is found in a package definition or a configuration file' 33complete -f -c opam -n'not __fish_opam_needs_command' -l switch -d'Use SWITCH as the current compiler switch' 34complete -f -c opam -n'not __fish_opam_needs_command' -s v -l verbose -d'Be more verbose' 35complete -f -c opam -n'not __fish_opam_needs_command' -s y -l yes -d'Disable interactive mode and answer yes to all questions' 36 37# subcommands 38## config 39complete -f -c opam -n __fish_opam_needs_command -a config -d"Display configuration options for packages" 40### config flags 41complete -f -c opam -n'__fish_opam_using_command config' -s a -l all -d'Enable all the global and user configuration options' 42complete -f -c opam -n'__fish_opam_using_command config' -l csh -d'Use csh-compatible mode for configuring OPAM' 43complete -f -c opam -n'__fish_opam_using_command config' -l dot-profile -d'Name of the configuration file to update instead of ~/' 44complete -f -c opam -n'__fish_opam_using_command config' -s e -d'Backward-compatible option, equivalent to opam config env' 45complete -f -c opam -n'__fish_opam_using_command config' -l fish -d'Use fish-compatible mode for configuring OPAM' 46complete -f -c opam -n'__fish_opam_using_command config' -s g -l global -d'Enable all the global configuration options' 47complete -f -c opam -n'__fish_opam_using_command config' -s l -l list -d'List the current configuration' 48complete -f -c opam -n'__fish_opam_using_command config' -l no-complete -d'Do not load the auto-completion scripts in the environment' 49complete -f -c opam -n'__fish_opam_using_command config' -l no-switch-eval -d'Do not install `opam-switch-eval`' 50complete -f -c opam -n'__fish_opam_using_command config' -l ocamlinit -d'Modify ~/' 51complete -f -c opam -n'__fish_opam_using_command config' -l profile -d'Modify ~/. profile' 52complete -f -c opam -n'__fish_opam_using_command config' -s R -l rec -d'Recursive query' 53complete -f -c opam -n'__fish_opam_using_command config' -l sexp -d'Display environment variables as an s-expression' 54complete -f -c opam -n'__fish_opam_using_command config' -l sh -d'Use sh-compatible mode for configuring OPAM' 55complete -f -c opam -n'__fish_opam_using_command config' -s u -l user -d'Enable all the user configuration options' 56complete -f -c opam -n'__fish_opam_using_command config' -l zsh -d'Use zsh-compatible mode for configuring OPAM. DOMAINS' 57### config subcommands 58complete -f -c opam -n'__fish_opam_using_command config' -a env -d'Return PATH, MANPATH, OCAML_TOPLEVEL_PATH and CAML_LD_LIBRARY_PATH for compiler' 59complete -f -c opam -n'__fish_opam_using_command config' -a setup -d'Configure global and user parameters for OPAM' #TODO 60complete -f -c opam -n'__fish_opam_using_command config' -a exec -d'Execute the shell script given in parameter with the correct environment variables' 61complete -f -c opam -n'__fish_opam_using_command config' -a var -d'Return the value associated with the given variable' 62complete -f -c opam -n'__fish_opam_using_command config' -a list -d'Return the list of all variables defined in the listed packages' 63complete -f -c opam -n'__fish_opam_using_command config' -a subst -d'Substitute %{var}% variables' 64complete -f -c opam -n'__fish_opam_using_command config' -a includes -d'returns include options' 65complete -f -c opam -n'__fish_opam_using_command config' -a bytecomp -d'returns bytecode compile options' 66complete -f -c opam -n'__fish_opam_using_command config' -a asmcomp -d'returns assembly compile options' 67complete -f -c opam -n'__fish_opam_using_command config' -a bytelink -d'returns bytecode linking options' 68complete -f -c opam -n'__fish_opam_using_command config' -a report -d'Prints a summary of your setup, useful for bug-reports' 69 70# TODO all subcommands other than config (and admin?) 71complete -f -c opam -n __fish_opam_needs_command -a help -d"Display help about OPAM and OPAM commands" 72complete -f -c opam -n __fish_opam_needs_command -a init -d"Initialize OPAM state" 73complete -f -c opam -n __fish_opam_needs_command -a install -d"Install a list of packages" 74complete -f -c opam -n __fish_opam_needs_command -a list -d"Display the list of available packages" 75complete -f -c opam -n __fish_opam_needs_command -a pin -d"Pin a given package to a specific version" 76complete -f -c opam -n __fish_opam_needs_command -a reinstall -d"Reinstall a list of packages" 77complete -f -c opam -n __fish_opam_needs_command -a"remove uninstall" -d"Remove a list of packages" 78complete -f -c opam -n __fish_opam_needs_command -a"repository remote" -d"Manage OPAM repositories" 79complete -f -c opam -n __fish_opam_needs_command -a search -d"Search into the package list" 80complete -f -c opam -n __fish_opam_needs_command -a"show info" -d"Display information about specific packages" 81complete -f -c opam -n __fish_opam_needs_command -a switch -d"Manage multiple installation of compilers" 82complete -f -c opam -n __fish_opam_needs_command -a update -d"Update the list of available packages" 83complete -f -c opam -n __fish_opam_needs_command -a upgrade -d"Upgrade the installed package to latest version" 84## admin 85complete -f -c opam -n __fish_opam_needs_command -a admin -d"Administration tool for local repositories" 86complete -c opam -n'__fish_opam_using_command admin' -l help -d'Show this help in format FMT (pager, plain or groff)' 87complete -c opam -n'__fish_opam_using_command admin' -l version -d'Show version information' 88complete -f -c opam -n'__fish_opam_using_command admin' -a check -d"Check a local repo for errors" 89complete -f -c opam -n'__fish_opam_using_command admin' -a depexts -d"Add external dependencies" 90complete -f -c opam -n'__fish_opam_using_command admin' -a make -d"Initialize a repo for serving files" 91complete -f -c opam -n'__fish_opam_using_command admin' -a stats -d"Compute statistics" 92 93# opam switch 94set -l switchcommands create set remove export import reinstall list list-available show set-base set-description link 95complete -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' 96complete -c opam -f -n"__fish_seen_subcommand_from switch; and not __fish_seen_subcommand_from $switchcommands " -a set -d'Set the currently active switch' 97complete -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' 98complete -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' 99complete -c opam -n"__fish_seen_subcommand_from switch; and not __fish_seen_subcommand_from $switchcommands " -a import -d'Import a saved switch state' 100complete -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' 101complete -c opam -f -n"__fish_seen_subcommand_from switch; and not __fish_seen_subcommand_from $switchcommands " -a list -d'Lists installed switches' 102complete -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' 103complete -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' 104complete -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' 105complete -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' 106 107complete -c opam -f -n"__fish_seen_subcommand_from switch; and __fish_seen_subcommand_from set" -a'(opam switch list --short)' 108complete -c opam -f -n"__fish_seen_subcommand_from switch; and __fish_seen_subcommand_from remove" -a'(opam switch list --short)' 109 110complete -c opam -f -n"__fish_seen_subcommand_from switch; and __fish_seen_subcommand_from create" -a'(opam switch list-available --short)'