aboutsummaryrefslogtreecommitdiffhomepage
path: root/share
diff options
context:
space:
mode:
authorGravatar Siteshwar Vashisht <siteshwar@gmail.com>2013-12-07 09:50:59 +0530
committerGravatar Siteshwar Vashisht <siteshwar@gmail.com>2013-12-07 09:50:59 +0530
commit659541f4a527aaab416407368418bc6d92552b1e (patch)
treea1604a6f6fb8dbfb47c2d394c440e3a37fef4bf9 /share
parent2271526d2f0f0463cb6379ac8be0af7db4f51c40 (diff)
parent0e7acaa3c4676dca7204deae85c08c2b2e426bb9 (diff)
Merge branch 'master' into fish_config_angular
Diffstat (limited to 'share')
l---------[-rw-r--r--]share/completions/..fish2
-rw-r--r--share/completions/adb.fish140
-rw-r--r--share/completions/brew.fish73
-rw-r--r--share/completions/eselect.fish74
-rw-r--r--share/completions/git.fish8
-rw-r--r--share/completions/modprobe.fish2
-rw-r--r--share/completions/perl.fish2
-rw-r--r--share/completions/rc-service.fish20
-rw-r--r--share/completions/rc-update.fish33
-rw-r--r--share/completions/scp.fish2
-rw-r--r--share/completions/service.fish10
-rw-r--r--share/completions/source.fish1
-rw-r--r--share/functions/__fish_complete_cd.fish12
-rw-r--r--share/functions/__fish_complete_man.fish28
-rw-r--r--share/functions/__fish_complete_service_actions.fish7
-rw-r--r--share/functions/__fish_config_interactive.fish9
-rw-r--r--share/functions/__fish_git_prompt.fish53
-rw-r--r--share/functions/__fish_number_of_cmd_args_wo_opts.fish4
-rw-r--r--share/functions/__fish_print_cmd_args.fish3
-rw-r--r--share/functions/__fish_print_cmd_args_without_options.fish3
-rw-r--r--share/functions/__fish_print_service_names.fish10
-rw-r--r--share/functions/fish_default_key_bindings.fish13
-rw-r--r--share/functions/type.fish27
-rwxr-xr-xshare/tools/create_manpage_completions.py30
-rw-r--r--share/tools/web_config/sample_prompts/informative_git.fish4
-rwxr-xr-xshare/tools/web_config/webconfig.py8
26 files changed, 515 insertions, 63 deletions
diff --git a/share/completions/..fish b/share/completions/..fish
index dcb48a1e..952c2618 100644..120000
--- a/share/completions/..fish
+++ b/share/completions/..fish
@@ -1 +1 @@
-complete -c . -x -a "(__fish_complete_suffix .fish)"
+source.fish \ No newline at end of file
diff --git a/share/completions/adb.fish b/share/completions/adb.fish
new file mode 100644
index 00000000..0eef3421
--- /dev/null
+++ b/share/completions/adb.fish
@@ -0,0 +1,140 @@
+# Completions for Android adb command
+
+function __fish_adb_no_subcommand --description 'Test if adb has yet to be given the subcommand'
+ for i in (commandline -opc)
+ if contains -- $i connect disconnect devices push pull sync shell emu logcat install uninstall jdwp forward bugreport backup restore version help wait-for-device start-server kill-server remount reboot get-state get-serialno get-devpath status-window root usb tcpip ppp
+ return 1
+ end
+ end
+ return 0
+end
+
+function __fish_adb_get_devices --description 'Run adb devices and parse output'
+ # This seems reasonably portable for all the platforms adb runs on
+ set -l count (ps x | grep -c adb)
+ set -l TAB \t
+ # Don't run adb devices unless the server is already started - it takes a while to init
+ if [ $count -gt 1 ]
+ # The tail is to strip the header line, the sed is to massage the -l format
+ # into a simple "identifier <TAB> modelname" format which is what we want for complete
+ adb devices -l | tail -n +2 | sed -E -e "s/([^ ]+) +./\1$TAB/" -e "s/$TAB.*model:([^ ]+).*/$TAB\1/"
+ end
+end
+
+function __fish_adb_run_command --description 'Runs adb with any -s parameters already given on the command line'
+ set -l sopt
+ set -l sopt_is_next
+ set -l cmd (commandline -poc)
+ set -e cmd[1]
+ for i in $cmd
+ if test $sopt_is_next
+ set sopt -s $i
+ break
+ else
+ switch $i
+ case -s
+ set sopt_is_next 1
+ end
+ end
+ end
+
+ # If no -s option, see if there's a -d or -e instead
+ if test -z "$sopt"
+ if contains -- -d $cmd
+ set sopt '-d'
+ else if contains -- -e $cmd
+ set sopt '-e'
+ end
+ end
+
+ # adb returns CRLF (seemingly) so strip CRs
+ adb $sopt shell $argv | sed s/\r//
+end
+
+function __fish_adb_list_packages
+ __fish_adb_run_command pm list packages | sed s/package://
+end
+
+
+function __fish_adb_list_uninstallable_packages
+ # -3 doesn't exactly mean show uninstallable, but it's the closest you can get to with pm list
+ __fish_adb_run_command pm list packages -3 | sed s/package://
+end
+
+# Generic options, must come before command
+complete -n '__fish_adb_no_subcommand' -c adb -s s -x -a "(__fish_adb_get_devices)" -d 'Device to communicate with'
+complete -n '__fish_adb_no_subcommand' -c adb -s d -d 'Communicate with first USB device'
+complete -n '__fish_adb_no_subcommand' -c adb -s e -d 'Communicate with emulator'
+
+# Commands
+complete -f -n '__fish_adb_no_subcommand' -c adb -a 'connect' -d 'Connect to device'
+complete -f -n '__fish_adb_no_subcommand' -c adb -a 'disconnect' -d 'Disconnect from device'
+complete -f -n '__fish_adb_no_subcommand' -c adb -a 'devices' -d 'List all connected devices'
+complete -f -n '__fish_adb_no_subcommand' -c adb -a 'push' -d 'Copy file to device'
+complete -f -n '__fish_adb_no_subcommand' -c adb -a 'pull' -d 'Copy file from device'
+complete -f -n '__fish_adb_no_subcommand' -c adb -a 'sync' -d 'Copy host->device only if changed'
+complete -f -n '__fish_adb_no_subcommand' -c adb -a 'shell' -d 'Run remote shell [command]'
+complete -f -n '__fish_adb_no_subcommand' -c adb -a 'emu' -d 'Run emulator console command'
+complete -f -n '__fish_adb_no_subcommand' -c adb -a 'logcat' -d 'View device log'
+complete -f -n '__fish_adb_no_subcommand' -c adb -a 'install' -d 'Install package'
+complete -f -n '__fish_adb_no_subcommand' -c adb -a 'uninstall' -d 'Uninstall package'
+complete -f -n '__fish_adb_no_subcommand' -c adb -a 'jdwp' -d 'List PIDs of processes hosting a JDWP transport'
+complete -f -n '__fish_adb_no_subcommand' -c adb -a 'forward' -d 'Port forwarding'
+complete -f -n '__fish_adb_no_subcommand' -c adb -a 'bugreport' -d 'Return bugreport information'
+complete -f -n '__fish_adb_no_subcommand' -c adb -a 'backup' -d 'Perform device backup'
+complete -f -n '__fish_adb_no_subcommand' -c adb -a 'restore' -d 'Restore device from backup'
+complete -f -n '__fish_adb_no_subcommand' -c adb -a 'version' -d 'Show adb version'
+complete -f -n '__fish_adb_no_subcommand' -c adb -a 'help' -d 'Show adb help'
+complete -f -n '__fish_adb_no_subcommand' -c adb -a 'wait-for-device' -d 'Block until device is online'
+complete -f -n '__fish_adb_no_subcommand' -c adb -a 'start-server' -d 'Ensure that there is a server running'
+complete -f -n '__fish_adb_no_subcommand' -c adb -a 'kill-server' -d 'Kill the server if it is running'
+complete -f -n '__fish_adb_no_subcommand' -c adb -a 'remount' -d 'Remounts the /system partition on the device read-write'
+complete -f -n '__fish_adb_no_subcommand' -c adb -a 'reboot' -d 'Reboots the device, optionally into the bootloader or recovery program'
+complete -f -n '__fish_adb_no_subcommand' -c adb -a 'get-state' -d 'Prints state of the device'
+complete -f -n '__fish_adb_no_subcommand' -c adb -a 'get-serialno' -d 'Prints serial number of the device'
+complete -f -n '__fish_adb_no_subcommand' -c adb -a 'get-devpath' -d 'Prints device path'
+complete -f -n '__fish_adb_no_subcommand' -c adb -a 'status-window' -d 'Continuously print the device status'
+complete -f -n '__fish_adb_no_subcommand' -c adb -a 'root' -d 'Restart the adbd daemon with root permissions'
+complete -f -n '__fish_adb_no_subcommand' -c adb -a 'usb' -d 'Restart the adbd daemon listening on USB'
+complete -f -n '__fish_adb_no_subcommand' -c adb -a 'tcpip' -d 'Restart the adbd daemon listening on TCP'
+complete -f -n '__fish_adb_no_subcommand' -c adb -a 'ppp' -d 'Run PPP over USB'
+
+# install options
+complete -n '__fish_seen_subcommand_from install' -c adb -s l -d 'Forward-lock the app'
+complete -n '__fish_seen_subcommand_from install' -c adb -s r -d 'Reinstall the app keeping its data'
+complete -n '__fish_seen_subcommand_from install' -c adb -s s -d 'Install on SD card instead of internal storage'
+complete -n '__fish_seen_subcommand_from install' -c adb -l 'algo' -d 'Algorithm name'
+complete -n '__fish_seen_subcommand_from install' -c adb -l 'key' -d 'Hex-encoded key'
+complete -n '__fish_seen_subcommand_from install' -c adb -l 'iv' -d 'Hex-encoded iv'
+
+# uninstall
+complete -n '__fish_seen_subcommand_from uninstall' -c adb -s k -d 'Keep the data and cache directories'
+complete -n '__fish_seen_subcommand_from uninstall' -c adb -f -u -a "(__fish_adb_list_uninstallable_packages)"
+
+# devices
+complete -n '__fish_seen_subcommand_from devices' -c adb -s l -d 'Also list device qualifiers'
+
+# disconnect
+complete -n '__fish_seen_subcommand_from disconnect' -c adb -x -a "(__fish_adb_get_devices)" -d 'Device to disconnect'
+
+# backup
+complete -n '__fish_seen_subcommand_from backup' -c adb -s f -d 'File to write backup data to'
+complete -n '__fish_seen_subcommand_from backup' -c adb -o 'apk' -d 'Enable backup of the .apks themselves'
+complete -n '__fish_seen_subcommand_from backup' -c adb -o 'noapk' -d 'Disable backup of the .apks themselves (default)'
+complete -n '__fish_seen_subcommand_from backup' -c adb -o 'obb' -d 'Enable backup of any installed apk expansion'
+complete -n '__fish_seen_subcommand_from backup' -c adb -o 'noobb' -d 'Disable backup of any installed apk expansion (default)'
+complete -n '__fish_seen_subcommand_from backup' -c adb -o 'shared' -d 'Enable backup of the device\'s shared storage / SD card contents'
+complete -n '__fish_seen_subcommand_from backup' -c adb -o 'noshared' -d 'Disable backup of the device\'s shared storage / SD card contents (default)'
+complete -n '__fish_seen_subcommand_from backup' -c adb -o 'all' -d 'Back up all installed applications'
+complete -n '__fish_seen_subcommand_from backup' -c adb -o 'system' -d 'Include system applications in -all (default)'
+complete -n '__fish_seen_subcommand_from backup' -c adb -o 'nosystem' -d 'Exclude system applications in -all'
+complete -n '__fish_seen_subcommand_from backup' -c adb -f -a "(__fish_adb_list_packages)" -d 'Package(s) to backup'
+
+# reboot
+complete -n '__fish_seen_subcommand_from reboot' -c adb -x -a 'bootloader recovery'
+
+# forward
+complete -n '__fish_seen_subcommand_from forward' -c adb -l 'list' -d 'List all forward socket connections'
+complete -n '__fish_seen_subcommand_from forward' -c adb -l 'no-rebind' -d 'Fails the forward if local is already forwarded'
+complete -n '__fish_seen_subcommand_from forward' -c adb -l 'remove' -d 'Remove a specific forward socket connection'
+complete -n '__fish_seen_subcommand_from forward' -c adb -l 'remove-all' -d 'Remove all forward socket connections'
diff --git a/share/completions/brew.fish b/share/completions/brew.fish
index fe1ee764..803d81f0 100644
--- a/share/completions/brew.fish
+++ b/share/completions/brew.fish
@@ -30,6 +30,14 @@ function __fish_brew_outdated_formulas
brew outdated
end
+function __fish_brew_pinned_formulas
+ brew list --pinned
+end
+
+function __fish_brew_taps
+ brew tap
+end
+
############
# commands #
@@ -39,6 +47,15 @@ end
complete -f -c brew -n '__fish_brew_needs_command' -a audit -d 'Check formula'
complete -f -c brew -n '__fish_brew_using_command audit' -a '(__fish_brew_formulae)'
+# bottle
+
+complete -f -c brew -n '__fish_brew_needs_command' -a bottle -d 'Create a binary package'
+complete -f -c brew -n '__fish_brew_using_command bottle' -l 'homebrew-developer' -d 'Output developer debug information'
+complete -f -c brew -n '__fish_brew_using_command bottle' -l 'no-revision' -d 'Do not bump the bottle revision number'
+complete -f -c brew -n '__fish_brew_using_command bottle' -l 'rb' -d 'Write bottle block to a Ruby source file'
+complete -f -c brew -n '__fish_brew_using_command bottle' -l 'write' -d 'Write bottle block to formula file'
+complete -f -c brew -n '__fish_brew_using_command bottle' -l 'merge' -d 'Merge multiple bottle outputs'
+
# cat
complete -f -c brew -n '__fish_brew_needs_command' -a cat -d 'Display formula'
complete -f -c brew -n '__fish_brew_using_command cat' -a '(__fish_brew_formulae)'
@@ -46,8 +63,9 @@ complete -f -c brew -n '__fish_brew_using_command cat' -a '(__fish_brew_formulae
# cleanup
complete -f -c brew -n '__fish_brew_needs_command' -a cleanup -d 'Remove old installed versions'
complete -f -c brew -n '__fish_brew_using_command cleanup' -l force -d 'Remove out-of-date keg-only brews as well'
-complete -f -c brew -n '__fish_brew_using_command cleanup' -s n -d 'Dry run'
-complete -f -c brew -n '__fish_brew_using_command cleanup' -s s -d 'Scrubs the cache'
+complete -f -c brew -n '__fish_brew_using_command cleanup' -l dry-run -d 'Show what files would be removed'
+complete -f -c brew -n '__fish_brew_using_command cleanup' -s n -d 'Show what files would be removed'
+complete -f -c brew -n '__fish_brew_using_command cleanup' -s s -d 'Scrub the cache'
complete -f -c brew -n '__fish_brew_using_command cleanup' -a '(__fish_brew_installed_formulas)'
# create
@@ -55,6 +73,8 @@ complete -f -c brew -n '__fish_brew_needs_command' -a create -d 'Create new form
complete -f -c brew -n '__fish_brew_using_command create' -l cmake -d 'Use template for CMake-style build'
complete -f -c brew -n '__fish_brew_using_command create' -l autotools -d 'Use template for Autotools-style build'
complete -f -c brew -n '__fish_brew_using_command create' -l no-fetch -d 'Don\'t download URL'
+complete -f -c brew -n '__fish_brew_using_command create' -l set-name -d 'Override name autodetection'
+complete -f -c brew -n '__fish_brew_using_command create' -l set-version -d 'Override version autodetection'
# deps
complete -f -c brew -n '__fish_brew_needs_command' -a deps -d 'Show a formula\'s dependencies'
@@ -62,6 +82,7 @@ complete -f -c brew -n '__fish_brew_using_command deps' -l 1 -d 'Show only 1 lev
complete -f -c brew -n '__fish_brew_using_command deps' -s n -d 'Show in topological order'
complete -f -c brew -n '__fish_brew_using_command deps' -l tree -d 'Show dependencies as tree'
complete -f -c brew -n '__fish_brew_using_command deps' -l all -d 'Show dependencies for all formulae'
+complete -f -c brew -n '__fish_brew_using_command deps' -l installed -d 'Show dependencies for installed formulae'
complete -f -c brew -n '__fish_brew_using_command deps' -a '(__fish_brew_formulae)'
# diy
@@ -70,7 +91,10 @@ complete -f -c brew -n '__fish_brew_using_command diy' -l set-name -d 'Set name
complete -f -c brew -n '__fish_brew_using_command diy' -l set-version -d 'Set version of package'
complete -f -c brew -n '__fish_brew_needs_command' -a 'doctor' -d 'Check your system for problems'
+
+# edit
complete -f -c brew -n '__fish_brew_needs_command' -a 'edit' -d 'Open brew/formula for editing'
+complete -f -c brew -n '__fish_brew_using_command edit' -a '(__fish_brew_formulae)'
# fetch
complete -f -c brew -n '__fish_brew_needs_command' -a fetch -d 'Download source for formula'
@@ -78,6 +102,7 @@ complete -f -c brew -n '__fish_brew_using_command fetch' -l force -d 'Remove a p
complete -f -c brew -n '__fish_brew_using_command fetch' -l HEAD -d 'Download the HEAD version from a VCS'
complete -f -c brew -n '__fish_brew_using_command fetch' -l deps -d 'Also download dependencies'
complete -f -c brew -n '__fish_brew_using_command fetch' -s v -d 'Make HEAD checkout verbose'
+complete -f -c brew -n '__fish_brew_using_command fetch' -l build-from-source -d 'Fetch source package instead of bottle'
complete -f -c brew -n '__fish_brew_using_command fetch' -a '(__fish_brew_formulae)'
complete -f -c brew -n '__fish_brew_needs_command' -a 'help' -d 'Display help'
@@ -101,25 +126,42 @@ complete -f -c brew -n '__fish_brew_using_command install' -l fresh -d 'Don\'t r
complete -f -c brew -n '__fish_brew_using_command install' -l use-clang -d 'Attempt to compile using clang'
complete -f -c brew -n '__fish_brew_using_command install' -l use-gcc -d 'Attempt to compile using GCC'
complete -f -c brew -n '__fish_brew_using_command install' -l use-llvm -d 'Attempt to compile using the LLVM'
+complete -f -c brew -n '__fish_brew_using_command install' -l cc -a "clang gcc-4.0 gcc-4.2 gcc-4.3 gcc-4.4 gcc-4.5 gcc-4.6 gcc-4.7 gcc-4.8 gcc-4.9 llvm-gcc" -d 'Attempt to compile using the specified compiler'
complete -f -c brew -n '__fish_brew_using_command install' -l build-from-source -d 'Compile from source even if a bottle is provided'
complete -f -c brew -n '__fish_brew_using_command install' -l devel -d 'Install the development version of formula'
complete -f -c brew -n '__fish_brew_using_command install' -l HEAD -d 'Install the HEAD version from VCS'
complete -f -c brew -n '__fish_brew_using_command install' -l interactive -d 'Download and patch formula, then open a shell'
+complete -f -c brew -n '__fish_brew_using_command install' -l env -a "std super" -d 'Force the specified build environment'
+complete -f -c brew -n '__fish_brew_using_command install' -l build-bottle -d 'Optimize for a generic CPU architecture'
+complete -f -c brew -n '__fish_brew_using_command install' -l bottle-arch -a 'core core2 penryn g3 g4 g4e g5' -d 'Optimize for the specified CPU architecture'
complete -c brew -n '__fish_brew_using_command install' -a '(__fish_brew_formulae)'
# link
complete -f -c brew -n '__fish_brew_needs_command' -a 'link ln' -d 'Symlink installed formula'
+complete -f -c brew -n '__fish_brew_using_command link' -l overwrite -d 'Overwrite existing files'
+complete -f -c brew -n '__fish_brew_using_command ln' -l overwrite -d 'Overwrite existing files'
+complete -f -c brew -n '__fish_brew_using_command link' -l dry-run -d 'Show what files would be linked or overwritten'
+complete -f -c brew -n '__fish_brew_using_command ln' -l dry-run -d 'Show what files would be linked or overwritten'
+complete -f -c brew -n '__fish_brew_using_command link' -l force -d 'Allow keg-only formulae to be linked'
+complete -f -c brew -n '__fish_brew_using_command ln' -l force -d 'Allow keg-only formulae to be linked'
complete -f -c brew -n '__fish_brew_using_command link' -a '(__fish_brew_installed_formulas)'
complete -f -c brew -n '__fish_brew_using_command ln' -a '(__fish_brew_installed_formulas)'
+# linkapps
+complete -f -c brew -n '__fish_brew_needs_command' -a linkapps -d 'Symlink .app bundles into /Applications'
+complete -f -c brew -n '__fish_brew_using_command linkapps' -l local -d 'Link .app bundles into ~/Applications instead'
+
# list
complete -f -c brew -n '__fish_brew_needs_command' -a 'list ls' -d 'List all installed formula'
complete -f -c brew -n '__fish_brew_using_command list' -l unbrewed -d 'List all files in the Homebrew prefix not installed by brew'
complete -f -c brew -n '__fish_brew_using_command list' -l versions -d 'Show the version number'
+complete -f -c brew -n '__fish_brew_using_command list' -l pinned -d 'Show the versions of pinned formulae'
complete -c brew -n '__fish_brew_using_command list' -a '(__fish_brew_formulae)'
+
#ls
complete -f -c brew -n '__fish_brew_using_command ls' -l unbrewed -d 'List all files in the Homebrew prefix not installed by brew'
complete -f -c brew -n '__fish_brew_using_command ls' -l versions -d 'Show the version number'
+complete -f -c brew -n '__fish_brew_using_command ls' -l pinned -d 'Show the versions of pinned formulae'
complete -c brew -n '__fish_brew_using_command ls' -a '(__fish_brew_formulae)'
# log
@@ -132,12 +174,19 @@ complete -c brew -n '__fish_brew_using_command missing' -a '(__fish_brew_formula
# options
complete -f -c brew -n '__fish_brew_needs_command' -a options -d 'Display install options for formula'
+complete -f -c brew -n '__fish_brew_using_command options' -l compact -d 'Show all options as a space-delimited list'
+complete -f -c brew -n '__fish_brew_using_command options' -l all -d 'Show options for all formulae'
+complete -f -c brew -n '__fish_brew_using_command options' -l installed -d 'Show options for all installed formulae'
complete -c brew -n '__fish_brew_using_command options' -a '(__fish_brew_formulae)' -d 'formula'
# outdated
complete -f -c brew -n '__fish_brew_needs_command' -a outdated -d 'Show formula that have updated versions'
complete -f -c brew -n '__fish_brew_using_command outdated' -l quiet -d 'Display only names'
+# pin
+complete -f -c brew -n '__fish_brew_needs_command' -a pin -d 'Pin the specified formulae to their current versions'
+complete -f -c brew -n '__fish_brew_using_command pin' -a '(__fish_brew_installed_formulas)' -d 'formula'
+
# prune
complete -f -c brew -n '__fish_brew_needs_command' -a prune -d 'Remove dead symlinks'
@@ -148,12 +197,17 @@ complete -f -c brew -n '__fish_brew_using_command search' -l fink -d 'Search on
complete -f -c brew -n '__fish_brew_using_command -S' -l macports -d 'Search on MacPorts'
complete -f -c brew -n '__fish_brew_using_command -S' -l fink -d 'Search on Fink'
+# sh
+complete -f -c brew -n '__fish_brew_needs_command' -a sh -d 'Instantiate a Homebrew build enviornment'
+complete -f -c brew -n '__fish_brew_using_command sh' -l env=std -d 'Use stdenv instead of superenv'
+
# tap
complete -f -c brew -n '__fish_brew_needs_command' -a tap -d 'Tap a new formula repository on GitHub'
+complete -f -c brew -n '__fish_brew_using_command tap' -l repair -d 'Create and prune tap symlinks as appropriate'
# test
complete -f -c brew -n '__fish_brew_needs_command' -a test -d 'Run tests for formula'
-complete -c brew -n '__fish_brew_using_command test' -a '(__fish_brew_formulae)' -d 'formula'
+complete -f -c brew -n '__fish_brew_using_command test' -a '(__fish_brew_installed_formulas)' -d 'formula'
# uninstall
complete -f -c brew -n '__fish_brew_needs_command' -a 'uninstall remove rm' -d 'Uninstall formula'
@@ -166,10 +220,19 @@ complete -f -c brew -n '__fish_brew_using_command rm' -l force -d 'Delete all in
# unlink
complete -f -c brew -n '__fish_brew_needs_command' -a unlink -d 'Unlink formula'
-complete -c brew -n '__fish_brew_using_command unlink' -a '(__fish_brew_installed_formulas)'
+complete -f -c brew -n '__fish_brew_using_command unlink' -a '(__fish_brew_installed_formulas)'
+
+# unlinkapps
+complete -f -c brew -n '__fish_brew_needs_command' -a unlinkapps -d 'Remove links created by brew linkapps'
+complete -f -c brew -n '__fish_brew_using_command unlinkapps' -l local -d 'Remove links from ~/Applications created by brew linkapps'
+
+# unpin
+complete -f -c brew -n '__fish_brew_needs_command' -a unpin -d 'Unpin specified formulae'
+complete -f -c brew -n '__fish_brew_using_command unpin' -a '(__fish_brew_pinned_formulas)'
# untap
complete -f -c brew -n '__fish_brew_needs_command' -a untap -d 'Remove a tapped repository'
+complete -f -c brew -n '__fish_brew_using_command untap' -a '(__fish_brew_taps)'
# update
complete -f -c brew -n '__fish_brew_needs_command' -a update -d 'Fetch newest version of Homebrew and formulas'
@@ -182,6 +245,7 @@ complete -f -c brew -n '__fish_brew_using_command upgrade' -a '(__fish_brew_outd
# uses
complete -f -c brew -n '__fish_brew_needs_command' -a uses -d 'Show formulas that depend on specified formula'
complete -f -c brew -n '__fish_brew_using_command uses' -l installed -d 'List only installed formulae'
+complete -f -c brew -n '__fish_brew_using_command uses' -l recursive -d 'Resolve more than one level of dependencies'
complete -c brew -n '__fish_brew_using_command uses' -a '(__fish_brew_formulae)'
# versions
@@ -194,6 +258,7 @@ complete -c brew -n '__fish_brew_using_command versions' -a '(__fish_brew_formul
# switches #
############
complete -f -c brew -n '__fish_brew_needs_command' -a '-v --version' -d 'Print version number of brew'
+complete -f -c brew -n '__fish_brew_needs_command' -l env -x -d 'Show Homebrew a summary of the build environment'
complete -f -c brew -n '__fish_brew_needs_command' -l repository -x -d 'Display where Homebrew\'s .git directory is located'
complete -f -c brew -n '__fish_brew_needs_command' -l config -x -d 'Show Homebrew and system configuration'
diff --git a/share/completions/eselect.fish b/share/completions/eselect.fish
new file mode 100644
index 00000000..5ecdcd6f
--- /dev/null
+++ b/share/completions/eselect.fish
@@ -0,0 +1,74 @@
+function __fish_eselect_cmd
+ eselect --brief --colour=no $argv
+end
+
+function __fish_complete_eselect_modules
+ set -l sedregexp 's/^ ([a-zA-Z0-9_-]*)[ ]*/\1\t/g'
+ __fish_eselect_cmd modules list | sgrep '^ ' | sed -r $sedregexp
+end
+
+function __fish_complete_eselect_actions
+ set -l sedregexp 's/^ ([a-zA-Z0-9_-]*)[ ]*/\1\t/g'
+ set -l cmdl (commandline -poc)
+ __fish_eselect_cmd $cmdl[2..-1] usage | sgrep '^ [^ -]' | sed -r $sedregexp
+end
+
+function __fish_complete_eselect_action_options
+ set -l parseregexp 's/^ ([a-zA-Z0-9_-]*)[ ]*/\1\t/g'
+ set -l cmdl (commandline -poc)
+
+ # Disable further php completion
+ if [ (__fish_print_cmd_args_without_options)[2] = 'php' ]
+ return
+ end
+
+ switch $cmdl[-1]
+ case -'*'
+ return
+ end
+
+ set -l findregexp '/^ '$cmdl[-1]'/,/^ [^ ]/p'
+
+ set cmdl[-1] usage
+ __fish_eselect_cmd $cmdl[2..-1] | sed -n -re $findregexp | sgrep '^ --' | sed -re $parseregexp
+end
+
+function __fish_complete_eselect_targets
+ set -l sedregexp 's/^ \[([0-9]+)\][ ]*/\1\t/g'
+ set -l cmdl (commandline -poc)
+
+ # Disable further php completion
+ # https://github.com/fish-shell/fish-shell/pull/1131
+ if [ (__fish_print_cmd_args_without_options)[2] = 'php' ]
+ return
+ end
+
+ switch $cmdl[-1]
+ case -'*'
+ set cmdl[-2] list
+ case '*'
+ set cmdl[-1] list
+ end
+
+ eselect --colour=no $cmdl[2..-1] | sgrep '^ [^ -]' | sed -r $sedregexp
+end
+
+complete -c eselect -n "test (__fish_number_of_cmd_args_wo_opts) = 1" \
+ -xa '(__fish_complete_eselect_modules)'
+
+complete -c eselect -n "test (__fish_number_of_cmd_args_wo_opts) = 1" \
+ -l brief -d 'Make output shorter'
+
+complete -c eselect -n "test (__fish_number_of_cmd_args_wo_opts) = 1" \
+ -l colour \
+ -d "=<yes|no|auto> Enable or disable colour output (default 'auto')"
+
+complete -c eselect -n "test (__fish_number_of_cmd_args_wo_opts) = 2" \
+ -xa '(__fish_complete_eselect_actions)'
+
+complete -c eselect -n "test (__fish_number_of_cmd_args_wo_opts) = 3" \
+ -xa '(__fish_complete_eselect_targets)'
+
+complete -c eselect -n "test (__fish_number_of_cmd_args_wo_opts) = 3" \
+ -xa '(__fish_complete_eselect_action_options)'
+
diff --git a/share/completions/git.fish b/share/completions/git.fish
index d4b9fcf3..8647bea3 100644
--- a/share/completions/git.fish
+++ b/share/completions/git.fish
@@ -19,7 +19,11 @@ function __fish_git_remotes
end
function __fish_git_modified_files
- command git status -s | grep -e "^ M" | sed "s/^ M //"
+ command git ls-files -m --exclude-standard ^/dev/null
+end
+
+function __fish_git_add_files
+ command git ls-files -mo --exclude-standard ^/dev/null
end
function __fish_git_ranges
@@ -110,12 +114,14 @@ complete -c git -n '__fish_git_using_command add' -l refresh -d "Don't add the f
complete -c git -n '__fish_git_using_command add' -l ignore-errors -d 'Ignore errors'
complete -c git -n '__fish_git_using_command add' -l ignore-missing -d 'Check if any of the given files would be ignored'
complete -f -c git -n '__fish_git_using_command add; and __fish_contains_opt -s p patch' -a '(__fish_git_modified_files)'
+complete -f -c git -n '__fish_git_using_command add' -a '(__fish_git_add_files)'
# TODO options
### checkout
complete -f -c git -n '__fish_git_needs_command' -a checkout -d 'Checkout and switch to a branch'
complete -f -c git -n '__fish_git_using_command checkout' -a '(__fish_git_branches)' --description 'Branch'
complete -f -c git -n '__fish_git_using_command checkout' -a '(__fish_git_tags)' --description 'Tag'
+complete -f -c git -n '__fish_git_using_command checkout' -a '(__fish_git_modified_files)' --description 'File'
complete -f -c git -n '__fish_git_using_command checkout' -s b -d 'Create a new branch'
complete -f -c git -n '__fish_git_using_command checkout' -s t -l track -d 'Track a new branch'
# TODO options
diff --git a/share/completions/modprobe.fish b/share/completions/modprobe.fish
index f36af1c6..540fa5a2 100644
--- a/share/completions/modprobe.fish
+++ b/share/completions/modprobe.fish
@@ -2,7 +2,7 @@
# Completions for the modprobe command
#
-complete -c modprobe -d Module -a "(/sbin/modprobe -l | sed -e 's/\/.*\/\([^\/.]*\).*/\1/')"
+complete -c modprobe --no-files -d Module -a "(find /lib/modules/(uname -r)/kernel -type f | sed -e 's/\/.*\/\([^\/.]*\).*/\1/')"
complete -c modprobe -s v -l verbose --description "Print messages about what the program is doing"
complete -c modprobe -s C -l config --description "Configuration file" -r
complete -c modprobe -s c -l showconfig --description "Dump configuration file"
diff --git a/share/completions/perl.fish b/share/completions/perl.fish
index 6266981d..cb4a543f 100644
--- a/share/completions/perl.fish
+++ b/share/completions/perl.fish
@@ -2,7 +2,7 @@ begin
set -l unicode 'commandline | sgrep -qe "-[a-zA-Z]*C[a-zA-Z]*\$"'
set -l noopt 'commandline | not sgrep -qe "-[a-zA-Z]*C[a-zA-Z]*\$"'
set -l modules "(find (perl -lE'print for @INC') -name '*.pm' -printf '%P\n' \
- | awk '{ gsub(\"/\", \"::\") } !/-/' RS=.pm\n | sort | uniq)"
+ | awk '{ gsub(\"/\", \"::\") } /[^-.]/' RS=.pm\n | sort | uniq)"
complete -c perl -s 0 -n $noopt --description 'Specify record separator'
complete -c perl -s a -n $noopt --description 'Turn on autosplit mode'
complete -c perl -s c -n $noopt --description 'Check syntax'
diff --git a/share/completions/rc-service.fish b/share/completions/rc-service.fish
new file mode 100644
index 00000000..a8885686
--- /dev/null
+++ b/share/completions/rc-service.fish
@@ -0,0 +1,20 @@
+# First argument is the names of the service, i.e. a file in /etc/init.d
+complete -c rc-service -n "test (__fish_number_of_cmd_args_wo_opts) = 1" \
+ -xa "(__fish_print_service_names)" --description "Service name"
+
+# The second argument is what action to take with the service
+complete -c rc-service -n "test (__fish_number_of_cmd_args_wo_opts) -gt 1" \
+ -xa "(__fish_complete_service_actions)"
+
+# Complete rc-service the options
+complete -c rc-service -s e -l exists -d 'Tests if the service exists or not'
+complete -c rc-service -s i -l ifexists \
+ -d 'If the service exists, then run the command'
+complete -c rc-service -s l -l list -d 'List all available services'
+complete -c rc-service -s r -l resolve \
+ -d 'Resolve the service name to an init script'
+complete -c rc-service -s h -l help -d 'Display the help output'
+complete -c rc-service -s C -l nocolor -d 'Disable color output'
+complete -c rc-service -s V -l version -d 'Display software version'
+complete -c rc-service -s v -l verbose -d 'Run verbosely'
+complete -c rc-service -s q -l quiet -d 'Run quietly (Does not affect errors)'
diff --git a/share/completions/rc-update.fish b/share/completions/rc-update.fish
new file mode 100644
index 00000000..f2339699
--- /dev/null
+++ b/share/completions/rc-update.fish
@@ -0,0 +1,33 @@
+function __fish_complete_rc-update_actions
+ set -l actions add \
+ 'Add the service to the runlevel or the current one if non given'
+ set -l actions $actions del \
+ 'Delete the service from the runlevel or the current one if non given'
+ set -l actions $actions show \
+ 'Show all enabled services and the runlevels they belong to'
+ printf "%s\t%s\n" $actions
+end
+
+function __fish_complete_rc-update_runlevels
+ set -l levels sysinit \
+ 'First startup runlevel' \
+ boot \
+ 'Second startup runlevel' \
+ default \
+ 'Last startup runlevel' \
+ shutdown \
+ 'Runlevel for stutting down'
+ printf "%s\t%s\n" $levels
+end
+
+# The first argument is what action to take with the service
+complete -c rc-update -n "test (__fish_number_of_cmd_args_wo_opts) = 1" \
+ -xa "(__fish_complete_rc-update_actions)"
+
+# The second argument is the names of the service, i.e. a file in /etc/init.d
+complete -c rc-update -n "test (__fish_number_of_cmd_args_wo_opts) = 2" \
+ -xa "(__fish_print_service_names)" --description "Service name"
+
+# The third argument is the names of the service, i.e. a file in /etc/init.d
+complete -c rc-update -n "test (__fish_number_of_cmd_args_wo_opts) = 3" \
+ -xa "(__fish_complete_rc-update_runlevels)"
diff --git a/share/completions/scp.fish b/share/completions/scp.fish
index f7e131f5..f791b8af 100644
--- a/share/completions/scp.fish
+++ b/share/completions/scp.fish
@@ -31,7 +31,7 @@ complete -c scp -d "Remote Path" -n "commandline -ct|sgrep -o '.*:'" -a "
commandline -ct|sgrep -o '.*:'
)(
#Get the list of remote files from the specified ssh server
- ssh -o \"BatchMode yes\" (commandline -ct|sed -ne 's/\(.*\):.*/\1/p') ls\ -dp\ (commandline -ct|sed -ne 's/.*://p')\* 2> /dev/null
+ ssh (commandline -c|sgrep -o '\-P [0-9]*'|tr P p) -o \"BatchMode yes\" (commandline -ct|sed -ne 's/\(.*\):.*/\1/p') ls\ -dp\ (commandline -ct|sed -ne 's/.*://p')\* 2> /dev/null
)
"
diff --git a/share/completions/service.fish b/share/completions/service.fish
index 2f361437..4914f97b 100644
--- a/share/completions/service.fish
+++ b/share/completions/service.fish
@@ -1,13 +1,5 @@
-function __fish_service_print_names
- if type -f systemctl >/dev/null
- command systemctl list-units -t service | cut -d ' ' -f 1 | grep '\.service$' | sed -e 's/\.service$//'
- end
-
- command ls /etc/init.d
-end
-
# Fist argument is the names of the service, i.e. a file in /etc/init.d
-complete -c service -n "test (count (commandline -poc)) = 1" -xa "(__fish_service_print_names)" --description "Service name"
+complete -c service -n "test (count (commandline -poc)) = 1" -xa "(__fish_print_service_names)" --description "Service name"
#The second argument is what action to take with the service
complete -c service -n "test (count (commandline -poc)) -gt 1" -xa '$__fish_service_commands'
diff --git a/share/completions/source.fish b/share/completions/source.fish
new file mode 100644
index 00000000..dcb48a1e
--- /dev/null
+++ b/share/completions/source.fish
@@ -0,0 +1 @@
+complete -c . -x -a "(__fish_complete_suffix .fish)"
diff --git a/share/functions/__fish_complete_cd.fish b/share/functions/__fish_complete_cd.fish
index f54b5aaa..1975eab2 100644
--- a/share/functions/__fish_complete_cd.fish
+++ b/share/functions/__fish_complete_cd.fish
@@ -30,9 +30,13 @@ function __fish_complete_cd -d "Completions for the cd command"
for i in $mycdpath
# Move to the initial directory first,
# in case the CDPATH directory is relative
-
- builtin cd $wd
- builtin cd $i
+ builtin cd $wd ^/dev/null
+ builtin cd $i ^/dev/null
+
+ if test $status -ne 0
+ # directory does not exists or missing permission
+ continue
+ end
# What we would really like to do is skip descriptions if all
# valid paths are in the same directory, but we don't know how to
@@ -45,5 +49,5 @@ function __fish_complete_cd -d "Completions for the cd command"
end
end
- builtin cd $wd
+ builtin cd $wd ^/dev/null
end
diff --git a/share/functions/__fish_complete_man.fish b/share/functions/__fish_complete_man.fish
index a5e4fa40..59c8c24e 100644
--- a/share/functions/__fish_complete_man.fish
+++ b/share/functions/__fish_complete_man.fish
@@ -21,7 +21,33 @@ function __fish_complete_man
set section $section"[^)]*"
# Do the actual search
- apropos (commandline -ct) ^/dev/null | sgrep \^(commandline -ct) | sed -n -e 's/\([^ ]*\).*(\('$section'\)) *- */\1'\t'\2: /p'
+ apropos (commandline -ct) ^/dev/null | awk '
+ BEGIN { FS="[\t ]- "; OFS="\t"; }
+ # BSD/Darwin
+ /^[^( \t]+\('$section'\)/ {
+ split($1, pages, ", ");
+ for (i in pages) {
+ page = pages[i];
+ sub(/[ \t]+/, "", page);
+ paren = index(page, "(");
+ name = substr(page, 1, paren - 1);
+ sect = substr(page, paren + 1, length(page) - paren - 1);
+ print name, sect ": " $2;
+ }
+ }
+ # Linux
+ /^[^( \t]+ \('$section'\)/ {
+ split($1, t, " ");
+ sect = substr(t[2], 2, length(t[2]) - 2);
+ print t[1], sect ": " $2;
+ }
+ # Solaris
+ /^[^( \t]+\t+[^\(\t]/ {
+ split($1, t, " ");
+ sect = substr(t[3], 2, length(t[3]) - 2);
+ print t[2], sect ": " $2;
+ }
+ '
end
end
diff --git a/share/functions/__fish_complete_service_actions.fish b/share/functions/__fish_complete_service_actions.fish
new file mode 100644
index 00000000..ab91f786
--- /dev/null
+++ b/share/functions/__fish_complete_service_actions.fish
@@ -0,0 +1,7 @@
+function __fish_complete_service_actions -d "Print a list of all basic service \
+ actions"
+ set -l actions start 'Start the service'
+ set -l actions $actions stop 'Stop the service'
+ set -l actions $actions restart 'Restart the service'
+ printf "%s\t%s\n" $actions
+end
diff --git a/share/functions/__fish_config_interactive.fish b/share/functions/__fish_config_interactive.fish
index d9ee0700..b9afedd4 100644
--- a/share/functions/__fish_config_interactive.fish
+++ b/share/functions/__fish_config_interactive.fish
@@ -137,6 +137,15 @@ function __fish_config_interactive -d "Initializations that should be performed
end
+ #
+ # Generate man page completions if not present
+ #
+
+ if not test -d $configdir/fish/generated_completions
+ #fish_update_completions is a function, so it can not be directly run in background.
+ eval "$__fish_bin_dir/fish -c 'fish_update_completions > /dev/null ^/dev/null' &"
+ end
+
#
# Print a greeting
#
diff --git a/share/functions/__fish_git_prompt.fish b/share/functions/__fish_git_prompt.fish
index 4ca32c6e..0619a097 100644
--- a/share/functions/__fish_git_prompt.fish
+++ b/share/functions/__fish_git_prompt.fish
@@ -2,7 +2,7 @@
#
# Written by Kevin Ballard <kevin@sb.org>
# Updated by Brian Gernhardt <brian@gernhardtsoftware.com>
-#
+#
# This is heavily based off of the git-prompt.bash script that ships with
# git, which is Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>.
# The act of porting the code, along with any new code, are Copyright (C) 2012
@@ -51,6 +51,7 @@
# __fish_git_prompt_showupstream to a space-separated list of values:
#
# verbose show number of commits ahead/behind (+/-) upstream
+# name if verbose, then also show the upstream abbrev name
# informative similar to verbose, but shows nothing when equal (fish only)
# legacy don't use the '--count' option available in recent versions
# of git-rev-list
@@ -155,7 +156,8 @@
#
# The separator before the upstream information can be customized via
# __fish_git_prompt_char_upstream_prefix. It is colored like the rest of
-# the upstream information. It defaults to nothing ().
+# the upstream information. It normally defaults to nothing () and defaults
+# to a space ( ) when __fish_git_prompt_showupstream contains verbose.
#
#
# Turning on __fish_git_prompt_showcolorhints changes the colors as follows to
@@ -178,6 +180,7 @@ function __fish_git_prompt_show_upstream --description "Helper function for __fi
set -l upstream git
set -l legacy
set -l verbose
+ set -l name
# Default to informative if show_informative_status is set
if test -n "$__fish_git_prompt_show_informative_status"
@@ -202,7 +205,7 @@ function __fish_git_prompt_show_upstream --description "Helper function for __fi
set upstream svn+git # default upstream is SVN if available, else git
# Save the config key (without .url) for later use
- set -l remote_prefix (/bin/sh -c 'echo "${1%.url}"' -- $key)
+ set -l remote_prefix (echo $key | sed 's/\.url$//')
set svn_prefix $svn_prefix $remote_prefix
end
end
@@ -222,6 +225,8 @@ function __fish_git_prompt_show_upstream --description "Helper function for __fi
case legacy
set legacy 1
set -e informative
+ case name
+ set name 1
case none
return
end
@@ -237,11 +242,11 @@ function __fish_git_prompt_show_upstream --description "Helper function for __fi
set -l svn_upstream (git log --first-parent -1 --grep="^git-svn-id: \($svn_url_pattern\)" ^/dev/null)
if test (count $svn_upstream) -ne 0
echo $svn_upstream[-1] | read -l _ svn_upstream _
- set svn_upstream (/bin/sh -c 'echo "${1%@*}"' -- $svn_upstream)
+ set svn_upstream (echo $svn_upstream | sed 's/@.*//')
set -l cur_prefix
for i in (seq (count $svn_remote))
set -l remote $svn_remote[$i]
- set -l mod_upstream (/bin/sh -c 'echo "${1#$2}"' -- $svn_upstream $remote)
+ set -l mod_upstream (echo $svn_upstream | sed "s|$remote||")
if test "$svn_upstream" != "$mod_upstream"
# we found a valid remote
set svn_upstream $mod_upstream
@@ -258,14 +263,14 @@ function __fish_git_prompt_show_upstream --description "Helper function for __fi
set upstream git-svn
end
else
- set upstream (/bin/sh -c 'val=${1#/branches}; echo "${val#/}"' -- $svn_upstream)
+ set upstream (echo $svn_upstream | sed 's|/branches||; s|/||g')
# Use fetch config to fix upstream
set -l fetch_val (command git config "$cur_prefix".fetch)
if test -n "$fetch_val"
set -l IFS :
echo "$fetch_val" | read -l trunk pattern
- set upstream (/bin/sh -c 'echo "${1%/$2}"' -- $pattern $trunk)/$upstream
+ set upstream (echo $pattern | sed -e "s|/$trunk\$||") /$upstream
end
end
else if test $upstream = svn+git
@@ -291,17 +296,27 @@ function __fish_git_prompt_show_upstream --description "Helper function for __fi
# calculate the result
if test -n "$verbose"
+ # Verbose has a space by default
+ set -l prefix "$___fish_git_prompt_char_upstream_prefix"
+ # Using two underscore version to check if user explicitly set to nothing
+ if not set -q __fish_git_prompt_char_upstream_prefix
+ set -l prefix " "
+ end
+
echo $count | read -l behind ahead
switch "$count"
case '' # no upstream
case "0 0" # equal to upstream
- echo "$___fish_git_prompt_char_upstream_prefix$___fish_git_prompt_char_upstream_equal"
+ echo "$prefix$___fish_git_prompt_char_upstream_equal"
case "0 *" # ahead of upstream
- echo "$___fish_git_prompt_char_upstream_prefix$___fish_git_prompt_char_upstream_ahead$ahead"
+ echo "$prefix$___fish_git_prompt_char_upstream_ahead$ahead"
case "* 0" # behind upstream
- echo "$___fish_git_prompt_char_upstream_prefix$___fish_git_prompt_char_upstream_behind$behind"
+ echo "$prefix$___fish_git_prompt_char_upstream_behind$behind"
case '*' # diverged from upstream
- echo "$___fish_git_prompt_char_upstream_prefix$___fish_git_prompt_char_upstream_diverged$ahead-$behind"
+ echo "$prefix$___fish_git_prompt_char_upstream_diverged$ahead-$behind"
+ end
+ if test -n "$count" -a -n "$name"
+ echo " "(command git rev-parse --abbrev-ref "$upstream" ^/dev/null)
end
else if test -n "$informative"
echo $count | read -l behind ahead
@@ -356,6 +371,7 @@ function __fish_git_prompt --description "Prompt function for Git"
set -l informative_status
__fish_git_prompt_validate_chars
+ __fish_git_prompt_validate_colors
if test "true" = $inside_worktree
if test -n "$__fish_git_prompt_show_informative_status"
@@ -388,8 +404,6 @@ function __fish_git_prompt --description "Prompt function for Git"
end
end
- __fish_git_prompt_validate_colors
-
set -l branch_color $___fish_git_prompt_color_branch
set -l branch_done $___fish_git_prompt_color_branch_done
if test -n "$__fish_git_prompt_showcolorhints"
@@ -411,7 +425,7 @@ function __fish_git_prompt --description "Prompt function for Git"
if test -n "$u"
set u "$___fish_git_prompt_color_untrackedfiles$u$___fish_git_prompt_color_untrackedfiles_done"
end
- set b (/bin/sh -c 'echo "${1#refs/heads/}"' -- $b)
+ set b (echo $b | sed 's|refs/heads/||')
if test -n "$b"
set b "$branch_color$b$branch_done"
end
@@ -657,21 +671,12 @@ function __fish_git_prompt_set_color
set default_done "$argv[3]"
end
- if test (count $user_variable) -eq 2
- set user_variable_bright $user_variable[2]
- set user_variable $user_variable[1]
- end
-
set -l variable _$user_variable_name
set -l variable_done "$variable"_done
if not set -q $variable
if test -n "$user_variable"
- if test -n "$user_variable_bright"
- set -g $variable (set_color --bold $user_variable)
- else
- set -g $variable (set_color $user_variable)
- end
+ set -g $variable (set_color $user_variable)
set -g $variable_done (set_color normal)
else
set -g $variable $default
diff --git a/share/functions/__fish_number_of_cmd_args_wo_opts.fish b/share/functions/__fish_number_of_cmd_args_wo_opts.fish
new file mode 100644
index 00000000..83e3d2fa
--- /dev/null
+++ b/share/functions/__fish_number_of_cmd_args_wo_opts.fish
@@ -0,0 +1,4 @@
+function __fish_number_of_cmd_args_wo_opts
+ count (__fish_print_cmd_args_without_options)
+end
+
diff --git a/share/functions/__fish_print_cmd_args.fish b/share/functions/__fish_print_cmd_args.fish
new file mode 100644
index 00000000..eaafe65a
--- /dev/null
+++ b/share/functions/__fish_print_cmd_args.fish
@@ -0,0 +1,3 @@
+function __fish_print_cmd_args
+ commandline -poc
+end
diff --git a/share/functions/__fish_print_cmd_args_without_options.fish b/share/functions/__fish_print_cmd_args_without_options.fish
new file mode 100644
index 00000000..dadabc2a
--- /dev/null
+++ b/share/functions/__fish_print_cmd_args_without_options.fish
@@ -0,0 +1,3 @@
+function __fish_print_cmd_args_without_options
+ __fish_print_cmd_args | grep '^[^-]'
+end
diff --git a/share/functions/__fish_print_service_names.fish b/share/functions/__fish_print_service_names.fish
new file mode 100644
index 00000000..3eeb0015
--- /dev/null
+++ b/share/functions/__fish_print_service_names.fish
@@ -0,0 +1,10 @@
+function __fish_print_service_names -d 'All services known to the system'
+ if type -f systemctl >/dev/null
+ command systemctl list-units -t service | cut -d ' ' -f 1 | grep '\.service$' | sed -e 's/\.service$//'
+ else if type -f rc-service
+ command rc-service -l
+ else
+ command ls /etc/init.d
+ end
+end
+
diff --git a/share/functions/fish_default_key_bindings.fish b/share/functions/fish_default_key_bindings.fish
index 44821f36..a46d3f94 100644
--- a/share/functions/fish_default_key_bindings.fish
+++ b/share/functions/fish_default_key_bindings.fish
@@ -32,6 +32,12 @@ function fish_default_key_bindings -d "Default (Emacs-like) key bindings for fis
bind \e\[H beginning-of-line
bind \e\[F end-of-line
+ # for PuTTY
+ # https://github.com/fish-shell/fish-shell/issues/180
+ bind \e\[1~ beginning-of-line
+ bind \e\[3~ delete-char
+ bind \e\[4~ end-of-line
+
# OS X SnowLeopard doesn't have these keys. Don't show an annoying error message.
bind -k home beginning-of-line 2> /dev/null
bind -k end end-of-line 2> /dev/null
@@ -79,8 +85,8 @@ function fish_default_key_bindings -d "Default (Emacs-like) key bindings for fis
bind \ef forward-word
bind \e\[1\;5C forward-word
bind \e\[1\;5D backward-word
- bind \e\[1\;9A history-token-search-backward # iTerm2
- bind \e\[1\;9B history-token-search-forward # iTerm2
+ bind \e\[1\;9A history-token-search-backward # iTerm2
+ bind \e\[1\;9B history-token-search-forward # iTerm2
bind \e\[1\;9C forward-word #iTerm2
bind \e\[1\;9D backward-word #iTerm2
bind \ed forward-kill-word
@@ -99,6 +105,9 @@ function fish_default_key_bindings -d "Default (Emacs-like) key bindings for fis
bind \ed 'set -l cmd (commandline); if test -z "$cmd"; echo; dirh; commandline -f repaint; else; commandline -f kill-word; end'
bind \cd delete-or-exit
+ # Allow reading manpages by pressing F1
+ bind -k f1 'man (basename (commandline -po; echo))[1] ^/dev/null; or echo -n \a'
+
# This will make sure the output of the current command is paged using the less pager when you press Meta-p
bind \ep '__fish_paginate'
diff --git a/share/functions/type.fish b/share/functions/type.fish
index 6eb1a66f..4a4c7703 100644
--- a/share/functions/type.fish
+++ b/share/functions/type.fish
@@ -117,22 +117,29 @@ function type --description "Print the type of a command"
end
- set -l path (which $i ^/dev/null)
- if test -x (echo $path)
- set res 0
- set found 1
- switch $mode
- case normal
- printf (_ '%s is %s\n') $i $path
+ set -l paths
+ if test $selection != multi
+ set paths (which $i ^/dev/null)
+ else
+ set paths (which -a $i ^/dev/null)
+ end
+ for path in $paths
+ if test -x (echo $path)
+ set res 0
+ set found 1
+ switch $mode
+ case normal
+ printf (_ '%s is %s\n') $i $path
case type
echo (_ 'file')
case path
echo $path
- end
- if test $selection != multi
- continue
+ end
+ if test $selection != multi
+ continue
+ end
end
end
diff --git a/share/tools/create_manpage_completions.py b/share/tools/create_manpage_completions.py
index dc67f4c8..7b1879dd 100755
--- a/share/tools/create_manpage_completions.py
+++ b/share/tools/create_manpage_completions.py
@@ -17,9 +17,18 @@ Redistributions in binary form must reproduce the above copyright notice, this l
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
-import string, sys, re, os.path, gzip, traceback, getopt, errno, codecs
+import string, sys, re, os.path, bz2, gzip, traceback, getopt, errno, codecs
from deroff import Deroffer
+lzma_available = True
+try:
+ try:
+ import lzma
+ except ImportError:
+ from backports import lzma
+except ImportError:
+ lzma_available = False
+
# Whether we're Python 3
IS_PY3 = sys.version_info[0] >= 3
@@ -717,6 +726,16 @@ def parse_manpage_at_path(manpage_path, output_directory):
fd = gzip.open(manpage_path, 'r')
manpage = fd.read()
if IS_PY3: manpage = manpage.decode('latin-1')
+ elif manpage_path.endswith('.bz2'):
+ fd = bz2.BZ2File(manpage_path, 'r')
+ manpage = fd.read()
+ if IS_PY3: manpage = manpage.decode('latin-1')
+ elif manpage_path.endswith('.xz') or manpage_path.endswith('.lzma'):
+ if not lzma_available:
+ return
+ fd = lzma.LZMAFile(str(manpage_path), 'r')
+ manpage = fd.read()
+ if IS_PY3: manpage = manpage.decode('latin-1')
else:
if IS_PY3:
fd = open(manpage_path, 'r', encoding='latin-1')
@@ -816,6 +835,15 @@ def parse_and_output_man_pages(paths, output_directory, show_progress):
last_progress_string_length = 0
if show_progress and not WRITE_TO_STDOUT:
print("Parsing man pages and writing completions to {0}".format(output_directory))
+
+ man_page_suffixes = set([os.path.splitext(m)[1][1:] for m in paths])
+ lzma_xz_occurs = "xz" in man_page_suffixes or "lzma" in man_page_suffixes
+ if lzma_xz_occurs and not lzma_available:
+ add_diagnostic('At least one man page is compressed with lzma or xz, but the "lzma" module is not available.'
+ ' Any man page compressed with either will be skipped.',
+ NOT_VERBOSE)
+ flush_diagnostics(sys.stderr)
+
for manpage_path in paths:
index += 1
diff --git a/share/tools/web_config/sample_prompts/informative_git.fish b/share/tools/web_config/sample_prompts/informative_git.fish
index 466b4051..5ac27767 100644
--- a/share/tools/web_config/sample_prompts/informative_git.fish
+++ b/share/tools/web_config/sample_prompts/informative_git.fish
@@ -4,7 +4,7 @@
set -g __fish_git_prompt_show_informative_status 1
set -g __fish_git_prompt_hide_untrackedfiles 1
-set -g __fish_git_prompt_color_branch magenta bold
+set -g __fish_git_prompt_color_branch magenta --bold
set -g __fish_git_prompt_showupstream "informative"
set -g __fish_git_prompt_char_upstream_ahead "↑"
set -g __fish_git_prompt_char_upstream_behind "↓"
@@ -20,7 +20,7 @@ set -g __fish_git_prompt_color_dirtystate blue
set -g __fish_git_prompt_color_stagedstate yellow
set -g __fish_git_prompt_color_invalidstate red
set -g __fish_git_prompt_color_untrackedfiles $fish_color_normal
-set -g __fish_git_prompt_color_cleanstate green bold
+set -g __fish_git_prompt_color_cleanstate green --bold
function fish_prompt --description 'Write out the prompt'
diff --git a/share/tools/web_config/webconfig.py b/share/tools/web_config/webconfig.py
index 22b9069a..889ae21e 100755
--- a/share/tools/web_config/webconfig.py
+++ b/share/tools/web_config/webconfig.py
@@ -15,9 +15,15 @@ else:
import http.server as SimpleHTTPServer
import socketserver as SocketServer
from urllib.parse import parse_qs
+
+# Disable CLI web browsers
+term = os.environ.pop('TERM', None)
import webbrowser
+if term:
+ os.environ['TERM'] = term
+
import subprocess
-import re, socket, os, sys, cgi, select, time, glob
+import re, socket, cgi, select, time, glob
try:
import json
except ImportError: