From ffaf969e6eefaeaf54436f97a597a699335c3dfd Mon Sep 17 00:00:00 2001 From: Shun Sakai Date: Thu, 11 Jun 2020 19:12:15 +0900 Subject: [PATCH] Add completions for apk-tools Completion of options for each subcommand is not implemented. --- CHANGELOG.rst | 1 + share/completions/apk.fish | 55 ++++++++++++++++++++++ share/functions/__fish_print_packages.fish | 10 ++++ 3 files changed, 66 insertions(+) create mode 100644 share/completions/apk.fish diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 1d175333c..e9d54a38f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -115,6 +115,7 @@ Completions - Added completions for + - ``apk`` - ``asciidoctor`` - ``cmark`` - ``create_ap`` diff --git a/share/completions/apk.fish b/share/completions/apk.fish new file mode 100644 index 000000000..ebf269f97 --- /dev/null +++ b/share/completions/apk.fish @@ -0,0 +1,55 @@ +# Completions for apk (Alpine Package Keeper) + +# Package name +complete -f -c apk -n "__fish_seen_subcommand_from add info fetch dot" -a "(__fish_print_packages)" -d "Package" +complete -f -c apk -n "__fish_seen_subcommand_from del fix version manifest" -a "(__fish_print_packages --installed)" -d "Package" + +# Global options +complete -f -c apk -s h -l help -d "Show help" +complete -f -c apk -s p -l root -d "Install packages to DIR" +complete -f -c apk -s X -l repository -d "Use packages from REPO" +complete -f -c apk -s q -l quiet -d "Print less information" +complete -f -c apk -s v -l verbose -d "Print more information" +complete -f -c apk -s i -l interactive -d "Ask confirmation for certain operations" +complete -f -c apk -s V -l version -d "Print program version" +complete -f -c apk -l force-binary-stdout -d "Continue even if binary data is to be output" +complete -f -c apk -l force-broken-world -d "Continue even if 'world' cannot be satisfied" +complete -f -c apk -l force-non-repository -d "Continue even if packages may be lost on reboot" +complete -f -c apk -l force-old-apk -d "Continue even if packages use unsupported features" +complete -f -c apk -l force-overwrite -d "Overwrite files in other packages" +complete -f -c apk -l force-refresh -d "Don't use cached files" +complete -f -c apk -s U -l update-cache -d "Alias for --cache-max-age 1" +complete -f -c apk -l progress -d "Show a progress bar" +complete -f -c apk -l progress-fd -d "Write progress to FD" +complete -f -c apk -l no-progress -d "Disable progress bar even for TTYs" +complete -f -c apk -l purge -d "Delete also modified configuration files and uninstalled packages from cache" +complete -f -c apk -l allow-untrusted -d "Install packages with untrusted signature or no signature" +complete -f -c apk -l wait -d "Wait for TIME seconds to get an exclusive repository lock before failing" +complete -f -c apk -l keys-dir -d "Override directory of trusted keys" +complete -f -c apk -l repositories-file -d "Override repositories file" +complete -f -c apk -l no-network -d "Don't use network" +complete -f -c apk -l no-cache -d "Don't use any local cache path" +complete -f -c apk -l cache-dir -d "Override cache directory" +complete -f -c apk -l cache-max-age -d "Maximum AGE for index in cache before refresh" +complete -f -c apk -l arch -d "Use architecture with --root" +complete -f -c apk -l print-arch -d "Print default architecture" + +# Commands +complete -f -c apk -n __fish_use_subcommand -a add -d "Add packages" +complete -f -c apk -n __fish_use_subcommand -a del -d "Remove packages" +complete -f -c apk -n __fish_use_subcommand -a fix -d "Repair package" +complete -f -c apk -n __fish_use_subcommand -a update -d "Update repository indexes" +complete -f -c apk -n __fish_use_subcommand -a info -d "Give detailed information about packages" +complete -f -c apk -n __fish_use_subcommand -a list -d "List packages" +complete -f -c apk -n __fish_use_subcommand -a search -d "Search package" +complete -f -c apk -n __fish_use_subcommand -a upgrade -d "Upgrade installed packages" +complete -f -c apk -n __fish_use_subcommand -a cache -d "Manage local package cache" +complete -f -c apk -n __fish_use_subcommand -a version -d "Compare package versions" +complete -f -c apk -n __fish_use_subcommand -a index -d "Create repository index file" +complete -f -c apk -n __fish_use_subcommand -a fetch -d "Download packages" +complete -f -c apk -n __fish_use_subcommand -a audit -d "Audit the directories for changes" +complete -f -c apk -n __fish_use_subcommand -a verify -d "Verify package integrity and signature" +complete -f -c apk -n __fish_use_subcommand -a dot -d "Generate graphviz graphs" +complete -f -c apk -n __fish_use_subcommand -a policy -d "Show repository policy for packages" +complete -f -c apk -n __fish_use_subcommand -a stats -d "Show statistics about repositories and installations" +complete -f -c apk -n __fish_use_subcommand -a manifest -d "Show checksums of package contents" diff --git a/share/functions/__fish_print_packages.fish b/share/functions/__fish_print_packages.fish index b0b26bb13..63deab800 100644 --- a/share/functions/__fish_print_packages.fish +++ b/share/functions/__fish_print_packages.fish @@ -232,4 +232,14 @@ function __fish_print_packages end end + if type -q -f apk + if set -q only_installed + apk info + return + else + apk search -q + return + end + end + end