From 0640e7bae95cf0f2380482d4cca2cd1bed30aa64 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Sat, 26 Jan 2019 19:15:08 +0100 Subject: [PATCH] Move prt-get functions into the completion script These were not used elsewhere. Part of #5279. [ci skip] --- share/completions/prt-get.fish | 42 +++++++++++++++++++ share/functions/__fish_prt_no_subcommand.fish | 11 ----- share/functions/__fish_prt_packages.fish | 4 -- share/functions/__fish_prt_ports.fish | 5 --- share/functions/__fish_prt_use_package.fish | 9 ---- share/functions/__fish_prt_use_port.fish | 9 ---- 6 files changed, 42 insertions(+), 38 deletions(-) delete mode 100644 share/functions/__fish_prt_no_subcommand.fish delete mode 100644 share/functions/__fish_prt_packages.fish delete mode 100644 share/functions/__fish_prt_ports.fish delete mode 100644 share/functions/__fish_prt_use_package.fish delete mode 100644 share/functions/__fish_prt_use_port.fish diff --git a/share/completions/prt-get.fish b/share/completions/prt-get.fish index e689cb6bc..3b7f71580 100644 --- a/share/completions/prt-get.fish +++ b/share/completions/prt-get.fish @@ -1,4 +1,46 @@ #completion for prt-get +# A function to verify if prt-get (the crux package management tool) needs to be completed by a further command + +# a function to obtain a list of installed packages with prt-get +function __fish_prt_packages -d 'Obtain a list of installed packages' + prt-get listinst +end + +# a function to obtain a list of ports with prt-get + +function __fish_prt_ports -d 'Obtain a list of ports' + prt-get list +end + +function __fish_prt_no_subcommand -d 'Test if prt-get has yet to be given the command' + for i in (commandline -opc) + if contains -- $i install depinst grpinst update remove sysup lock unlock listlocked diff quickdiff search dsearch fsearch info path readme depends quickdep dependent deptree dup list printf listinst listorphans isinst current ls cat edit help dumpconfig version cache + return 1 + end + end + return 0 +end + + +# a function to verify if prt-get should have packages as potential completion +function __fish_prt_use_package -d 'Test if prt-get should have packages as potential completion' + for i in (commandline -opc) + if contains -- $i update remove lock unlock current + return 0 + end + end + return 1 +end + +# a function to test if prt-get should have ports as potential completions +function __fish_prt_use_port -d 'Test if prt-get should have ports as potential completion' + for i in (commandline -opc) + if contains -- $i install depinst grpinst diff depends quickdep dependent deptree isinst info path readme ls cat edit + return 0 + end + end + return 1 +end complete -f -c prt-get -n '__fish_prt_use_package' -a '(__fish_prt_packages)' -d 'Package' complete -f -c prt-get -n '__fish_prt_use_port' -a '(__fish_prt_ports)' -d 'Port' diff --git a/share/functions/__fish_prt_no_subcommand.fish b/share/functions/__fish_prt_no_subcommand.fish deleted file mode 100644 index 7a3b8e0b3..000000000 --- a/share/functions/__fish_prt_no_subcommand.fish +++ /dev/null @@ -1,11 +0,0 @@ -# A function to verify if prt-get (the crux package management tool) needs to be completed by a further command - -function __fish_prt_no_subcommand -d 'Test if prt-get has yet to be given the command' - for i in (commandline -opc) - if contains -- $i install depinst grpinst update remove sysup lock unlock listlocked diff quickdiff search dsearch fsearch info path readme depends quickdep dependent deptree dup list printf listinst listorphans isinst current ls cat edit help dumpconfig version cache - return 1 - end - end - return 0 -end - diff --git a/share/functions/__fish_prt_packages.fish b/share/functions/__fish_prt_packages.fish deleted file mode 100644 index 001f732c8..000000000 --- a/share/functions/__fish_prt_packages.fish +++ /dev/null @@ -1,4 +0,0 @@ -# a function to obtain a list of installed packages with prt-get -function __fish_prt_packages -d 'Obtain a list of installed packages' - prt-get listinst -end diff --git a/share/functions/__fish_prt_ports.fish b/share/functions/__fish_prt_ports.fish deleted file mode 100644 index 5024bcd6f..000000000 --- a/share/functions/__fish_prt_ports.fish +++ /dev/null @@ -1,5 +0,0 @@ -# a function to obtain a list of ports with prt-get - -function __fish_prt_ports -d 'Obtain a list of ports' - prt-get list -end diff --git a/share/functions/__fish_prt_use_package.fish b/share/functions/__fish_prt_use_package.fish deleted file mode 100644 index b52d30560..000000000 --- a/share/functions/__fish_prt_use_package.fish +++ /dev/null @@ -1,9 +0,0 @@ -# a function to verify if prt-get should have packages as potential completion -function __fish_prt_use_package -d 'Test if prt-get should have packages as potential completion' - for i in (commandline -opc) - if contains -- $i update remove lock unlock current - return 0 - end - end - return 1 -end diff --git a/share/functions/__fish_prt_use_port.fish b/share/functions/__fish_prt_use_port.fish deleted file mode 100644 index 855c61d73..000000000 --- a/share/functions/__fish_prt_use_port.fish +++ /dev/null @@ -1,9 +0,0 @@ -# a function to test if prt-get should have ports as potential completions -function __fish_prt_use_port -d 'Test if prt-get should have ports as potential completion' - for i in (commandline -opc) - if contains -- $i install depinst grpinst diff depends quickdep dependent deptree isinst info path readme ls cat edit - return 0 - end - end - return 1 -end