fix OpenWrt and opkg support (#5454)

* add OpenWrt and opkg support

Signed-off-by: Curtis Jiang <jqqqqqqqqqq@qq.com>

* fix opkg list

Signed-off-by: Curtis Jiang <jqqqqqqqqqq@qq.com>
This commit is contained in:
Curtis Jiang 2018-12-31 23:48:03 +08:00 committed by Fabian Homborg
parent 9b980f5e6e
commit f871951a87
2 changed files with 25 additions and 14 deletions

View File

@ -11,7 +11,16 @@ end
function __fish_opkg_use_package -d 'Test if opkg command should have packages as potential completion'
for i in (commandline -opc)
if contains -- $i contains upgrade install configure remove flag files search find info status download compare-versions print-architecture depends whatdepends whatdependsrec whatrecommends whatsuggests whatprovides whatconflicts whatreplaces
if contains -- $i contains install search find info status download compare-versions print-architecture depends whatdepends whatdependsrec whatrecommends whatsuggests whatprovides whatconflicts whatreplaces
return 0
end
end
return 1
end
function __fish_opkg_use_package_installed -d 'Test if opkg command should have installed packages as potential completion'
for i in (commandline -opc)
if contains -- $i contains upgrade configure remove flag files
return 0
end
end
@ -20,6 +29,8 @@ end
complete -c opkg -n '__fish_opkg_use_package' -a '(__fish_print_packages)' -d 'Package'
complete -c opkg -n '__fish_opkg_use_package_installed' -a '(__fish_print_packages --installed)' -d 'Package'
complete -f -n '__fish_opkg_no_subcommand' -c opkg -a 'update' -d 'Update list of available packages'
complete -f -n '__fish_opkg_no_subcommand' -c opkg -a 'upgrade' -d 'Upgrade packages'
complete -f -n '__fish_opkg_no_subcommand' -c opkg -a 'install' -d 'Install package(s)'

View File

@ -221,7 +221,7 @@ function __fish_print_packages
end
if type -q -f opkg
if not set -q only_installed
if set -q only_installed
opkg list-installed 2>/dev/null | sed -r 's/^([a-zA-Z0-9\-]+) - ([a-zA-Z0-9\-]+)/\1\t\2/g'
return
else