fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
6d0cd3d9b
master
1# Apache Ant (1.9.5) completion for Fish Shell. 2 3function __fish_complete_ant_targets -d"Print list of targets from build.xml and imported files" 4function __get_buildfile -d"Get a buildfile that will be used by ant" 5set -l tokens$argv # tokens from 'commandline -xpc' 6set -l prev$tokens [ 1 ] 7set -l buildfile"build.xml" 8for tokenin $argv [ 2 .. -1 ] 9switch $prev 10case -buildfile -file -f 11set buildfile echo$token 12end 13set prev$token 14end 15# return last one 16echo $buildfile 17end 18function __parse_ant_targets_from_projecthelp -d"Parse ant targets from projecthelp" 19set -l buildfile$argv [ 1 ] # full path to buildfile 20set -l targets( ant -p -debug -f$buildfile 2> /dev/null| string match -r'^\s[[:graph:]].*$' ) 21for targetin $targets 22# Use [[:graph:]] and [[:print:]] to ignore ANSI escape code 23set -l tokens( string match -r'^\s([[:graph:]]+)(?:\s+([[:print:]]+))?' " $target " ) 24if test ( count $tokens ) -ge 3 25echo $tokens [ 2 ] \t $tokens [ 3 ] 26else if test ( count $tokens ) -ge 2 27echo $tokens [ 2 ] 28end 29end 30end 31function __get_ant_targets_from_projecthelp -d"Get ant targets from projecthelp" 32set -l buildfile$argv [ 1 ] # full path to buildfile 33 34set -l cache_dir( __fish_make_cache_dir ant_completions) 35set -l cache_file$cache_dir /( __fish_md5 -s$buildfile ) 36if test !-s " $cache_file " 37# generate cache file if empty 38__parse_ant_targets_from_projecthelp $buildfile > $cache_file 39end 40 41cat $cache_file 42end 43 44set -l tokens$argv 45set -l buildfile( __get_buildfile $tokens | path filter) 46or return 1 # return nothing if buildfile does not exist 47 48__get_ant_targets_from_projecthelp $buildfile 49end 50 51# completion for ant targets 52complete -x -c ant -a"(__fish_complete_ant_targets (commandline -xpc))" 53 54# Script Options: 55complete -f -c ant -l help -l h -d'print help message and ant help' 56complete -f -c ant -l noconfig -d'suppress sourcing of configuration files' 57complete -f -c ant -l usejikes -d'enable use of jikes by default' 58complete -f -c ant -l execdebug -d'print ant exec line generated by this launch script' 59# Options: 60complete -f -c ant -o help -s h -d'print help message' 61complete -f -c ant -o projecthelp -s p -d'print project help information' 62complete -f -c ant -o version -d'print the version information' 63complete -f -c ant -o diagnostics -d'print diagnostic information' 64complete -f -c ant -o quiet -s q -d'be extra quiet' 65complete -f -c ant -o silent -s S -d'print nothing but task outputs and build failures' 66complete -f -c ant -o verbose -s v -d'be extra verbose' 67complete -f -c ant -o debug -s d -d'print debugging information' 68complete -f -c ant -o emacs -s e -d'produce logging information without adornments' 69complete -f -c ant -o noinput -d'do not allow interactive input' 70complete -f -c ant -s D -d'use value for given property like -D<property>=<value>' 71complete -f -c ant -o keep-going -s k -d'execute all targets that do not depend on failed target(s)' 72complete -f -c ant -o nouserlib -d'Run ant without using jar files from ${user.home}/.ant/lib' 73complete -f -c ant -o noclasspath -d'Run ant without using CLASSPATH' 74complete -f -c ant -o autoproxy -d'Java1.5+: use the OS proxy settings' 75complete -r -c ant -o lib -d'specifies a path to search for jars and classes' 76complete -r -c ant -o logfile -s l -d'use given file for log' 77complete -r -c ant -o logger -d'the class which is to perform logging' 78complete -r -c ant -o listener -d'add an instance of class as a project listener' 79complete -r -c ant -o buildfile -o file -s f -d'use given buildfile' 80complete -r -c ant -o propertyfile -d'load properties from file, -D properties takes precedence' 81complete -r -c ant -o inputhandler -d'the class which will handle input requests' 82complete -r -c ant -o find -s s -d'search for buildfile towards the root and use it' 83complete -r -c ant -o nice -d'A niceness value for the main thread' 84complete -r -c ant -o main -d'override Ant\'s normal entry point'