aboutsummaryrefslogtreecommitdiffhomepage
path: root/share
diff options
context:
space:
mode:
authorGravatar Łukasz Niemier <lukasz@niemier.pl>2012-11-18 11:23:22 +0100
committerGravatar Łukasz Niemier <lukasz@niemier.pl>2012-11-18 11:23:22 +0100
commit47df1ae40adecd0a02fc7dd06ab0745cb18c3fe0 (patch)
tree13bf3e8fdcae60fdfb5fa5e26c95818dc7a49790 /share
parentb79854ad1aa814d9d35d76a1929b4726fa4bffa5 (diff)
Remove trailing whitespaces and change tabs to spaces
Diffstat (limited to 'share')
-rw-r--r--share/completions/abook.fish2
-rw-r--r--share/completions/adduser.fish2
-rw-r--r--share/completions/dvipdf.fish6
-rw-r--r--share/completions/dvipdfm.fish8
-rw-r--r--share/completions/find.fish6
-rw-r--r--share/completions/kill.fish2
-rw-r--r--share/completions/killall.fish2
-rw-r--r--share/completions/latexmk.fish2
-rw-r--r--share/completions/lpadmin.fish4
-rw-r--r--share/completions/mocp.fish2
-rw-r--r--share/completions/pactree.fish2
-rw-r--r--share/completions/pkgfile.fish2
-rw-r--r--share/completions/ps2pdf.fish6
-rw-r--r--share/completions/rfkill.fish2
-rw-r--r--share/completions/setxkbmap.fish2
-rw-r--r--share/completions/tree.fish14
-rw-r--r--share/completions/xdg-mime.fish2
-rw-r--r--share/completions/xrandr.fish10
-rw-r--r--share/completions/xrdb.fish4
-rw-r--r--share/functions/__fish_complete_atool.fish2
-rw-r--r--share/functions/__fish_complete_cd.fish2
-rw-r--r--share/functions/__fish_complete_list.fish2
-rw-r--r--share/functions/__fish_complete_lpr.fish14
-rw-r--r--share/functions/__fish_complete_pacman.fish2
-rw-r--r--share/functions/__fish_complete_python.fish6
-rw-r--r--share/functions/__fish_complete_subcommand.fish2
-rw-r--r--share/functions/__fish_complete_svn.fish34
-rw-r--r--share/functions/__fish_complete_svn_diff.fish2
-rw-r--r--share/functions/__fish_complete_tex.fish2
-rw-r--r--share/functions/__fish_make_completion_signals.fish2
-rw-r--r--share/functions/__fish_print_help.fish2
-rw-r--r--share/functions/dirh.fish2
-rw-r--r--share/functions/funced.fish4
-rw-r--r--share/functions/history.fish34
-rwxr-xr-xshare/tools/create_manpage_completions.py176
-rwxr-xr-xshare/tools/deroff.py158
36 files changed, 263 insertions, 263 deletions
diff --git a/share/completions/abook.fish b/share/completions/abook.fish
index 8b983beb..97b144b0 100644
--- a/share/completions/abook.fish
+++ b/share/completions/abook.fish
@@ -3,7 +3,7 @@ complete -c abook -s h -d 'Show usage'
complete -c abook -s C -l config -d 'Use an alternative configuration file' -r
complete -c abook -l datafile -d 'Use an alternative addressbook file' -r
complete -c abook -l mutt-query -d 'Make a query for mutt' -x
-complete -c abook -l add-email -d 'Read email message from stdin and add the sender'
+complete -c abook -l add-email -d 'Read email message from stdin and add the sender'
complete -c abook -l add-email-quiet -d 'Same as --add-email. Without confirmation'
complete -c abook -l convert -d 'Convert address book files'
diff --git a/share/completions/adduser.fish b/share/completions/adduser.fish
index 9704625c..33d28182 100644
--- a/share/completions/adduser.fish
+++ b/share/completions/adduser.fish
@@ -14,7 +14,7 @@ complete -c adduser -l gecos --description 'Set the gecos field for the new entr
complete -c adduser -l gid --description 'When creating a group, this option forces the new groupid to be the given number' -r
complete -c adduser -l group --description 'When combined with --system, a group with the same name and ID as the system user is created'
complete -c adduser -l help --description 'Display brief instructions'
-complete -c adduser -l home --description 'Use specified directory as the user\'s home directory' -x -a '(__fish_complete_directories)'
+complete -c adduser -l home --description 'Use specified directory as the user\'s home directory' -x -a '(__fish_complete_directories)'
complete -c adduser -l shell --description 'Use shell as the user\'s login shell, rather than the default specified by the configuration file' -x -a '(cat /etc/shells)'
complete -c adduser -l ingroup --description 'Add the new user to GROUP instead of a usergroup or the default group defined by USERS_GID in the configuration file' -x -a '(cat /etc/group|cut -d : -f 1)'
complete -c adduser -l no-create-home --description 'Do not create the home directory, even if it doesni\'t exist'
diff --git a/share/completions/dvipdf.fish b/share/completions/dvipdf.fish
index 8c8a8354..300bb811 100644
--- a/share/completions/dvipdf.fish
+++ b/share/completions/dvipdf.fish
@@ -1,3 +1,3 @@
-complete -c dvipdf -x -a "(
- __fish_complete_suffix .dvi
- )"
+complete -c dvipdf -x -a "(
+ __fish_complete_suffix .dvi
+ )"
diff --git a/share/completions/dvipdfm.fish b/share/completions/dvipdfm.fish
index c49b469e..94f6668c 100644
--- a/share/completions/dvipdfm.fish
+++ b/share/completions/dvipdfm.fish
@@ -1,4 +1,4 @@
-complete -c dvipdfm -x -a "
-(
- __fish_complete_suffix .dvi
-)"
+complete -c dvipdfm -x -a "
+(
+ __fish_complete_suffix .dvi
+)"
diff --git a/share/completions/find.fish b/share/completions/find.fish
index 63f9d874..28b5471a 100644
--- a/share/completions/find.fish
+++ b/share/completions/find.fish
@@ -36,9 +36,9 @@ complete -c find -o cmin --description "File status last changed specified numbe
complete -c find -o cnewer --description "File status last changed more recently than file was modified" -r
complete -c find -o ctime --description "File status last changed specified number of days ago" -r
-complete -c find -o empty --description "File is empty and is either a regular file or a directory"
-complete -c find -o executable --description "File is executable"
-complete -c find -o false --description "Always false"
+complete -c find -o empty --description "File is empty and is either a regular file or a directory"
+complete -c find -o executable --description "File is executable"
+complete -c find -o false --description "Always false"
complete -c find -o fstype --description "File is on filesystem of specified type" -a "(__fish_print_filesystems)" -r
complete -c find -o gid --description "Numeric group id of file" -r
complete -c find -o group --description "Group name of file" -a "(__fish_complete_groups)"
diff --git a/share/completions/kill.fish b/share/completions/kill.fish
index cd7d2353..955795fb 100644
--- a/share/completions/kill.fish
+++ b/share/completions/kill.fish
@@ -6,7 +6,7 @@ for i in $__kill_signals
complete -c kill -o $number -d $name
complete -c kill -o $name -d $name
complete -c kill -o s -x -a \"$number\tSend\ $name\ signal\"
- complete -c kill -o s -x -a \"$name\tSend\ $name\ signal\"
+ complete -c kill -o s -x -a \"$name\tSend\ $name\ signal\"
end
complete -c kill -xa '(__fish_complete_pids)'
diff --git a/share/completions/killall.fish b/share/completions/killall.fish
index dc5fec39..ae70c900 100644
--- a/share/completions/killall.fish
+++ b/share/completions/killall.fish
@@ -6,7 +6,7 @@ for i in $__kill_signals
complete -c killall -o $number -d $name
complete -c killall -o $name -d $name
complete -c killall -o s -x -a \"$number\tSend\ $name\ signal\"
- complete -c killall -o s -x -a \"$name\tSend\ $name\ signal\"
+ complete -c killall -o s -x -a \"$name\tSend\ $name\ signal\"
end
complete -c killall -xa '(__fish_complete_proc)'
diff --git a/share/completions/latexmk.fish b/share/completions/latexmk.fish
index 6b2c33e1..07818dfe 100644
--- a/share/completions/latexmk.fish
+++ b/share/completions/latexmk.fish
@@ -48,7 +48,7 @@ complete -c latexmk -o print=ps -d 'when file is to be printed, print the ps
complete -c latexmk -o print=pdf -d 'when file is to be printed, print the pdf file'
complete -c latexmk -o pv -d 'preview document'
complete -c latexmk -o pv- -d 'turn off preview mode'
-complete -c latexmk -o pvc -d 'preview document and continuously update'
+complete -c latexmk -o pvc -d 'preview document and continuously update'
complete -c latexmk -o pvc- -d 'turn off -pvc'
complete -c latexmk -o quiet -d 'silence progress messages from called programs'
complete -c latexmk -o r -r -d 'Read custom RC file'
diff --git a/share/completions/lpadmin.fish b/share/completions/lpadmin.fish
index f542086c..099309b9 100644
--- a/share/completions/lpadmin.fish
+++ b/share/completions/lpadmin.fish
@@ -6,8 +6,8 @@ complete -c lpadmin -s r -d 'Removes the named printer from class. If the result
complete -c lpadmin -s v -d 'Sets the device-uri attribute of the printer queue' -r
complete -c lpadmin -s D -d 'Provides a textual description of the destination' -x
-complete -c lpadmin -s E -d 'Enables the destination and accepts jobs'
-complete -c lpadmin -s L -d 'Provides a textual location of the destination' -x
+complete -c lpadmin -s E -d 'Enables the destination and accepts jobs'
+complete -c lpadmin -s L -d 'Provides a textual location of the destination' -x
complete -c lpadmin -s P -d 'Specifies a PostScript Printer Description file to use with the printer' -xa "(__fish_complete_suffix .ppd; __fish_complete_suffix .ppd.gz)"
complete -c lpadmin -s o -xa cupsIPPSupplies=true -d 'Specifies whether IPP supply level values should be reported'
complete -c lpadmin -s o -xa cupsIPPSupplies=false -d 'Specifies whether IPP supply level values should be reported'
diff --git a/share/completions/mocp.fish b/share/completions/mocp.fish
index 6d44169f..19020abf 100644
--- a/share/completions/mocp.fish
+++ b/share/completions/mocp.fish
@@ -23,7 +23,7 @@ complete -c mocp -s U -l unpause -d "Unpause"
complete -c mocp -s G -l toggle-pause -d "Toggle between play/pause"
complete -c mocp -s v -l volume -d "(+/-)LEVEL Adjust PCM volume" -xa '+ -'
complete -c mocp -s y -l sync -d "Synchronize the playlist with other clients"
-complete -c mocp -s n -l nosync -d "Don't synchronize the playlist with other client's"
+complete -c mocp -s n -l nosync -d "Don't synchronize the playlist with other client's"
complete -c mocp -s A -l ascii -d "Use ASCII characters to draw lines"
complete -c mocp -s i -l info -d "Print the information about the currently played file"
complete -c mocp -s Q -l format -rf -d "Print the formatted information about the currently played file"
diff --git a/share/completions/pactree.fish b/share/completions/pactree.fish
index 43cb881c..81c37d72 100644
--- a/share/completions/pactree.fish
+++ b/share/completions/pactree.fish
@@ -1,4 +1,4 @@
-complete -c pactree -xa "(pacman -Sl | cut --delim ' ' --fields 2- | tr ' ' \t | sort)"
+complete -c pactree -xa "(pacman -Sl | cut --delim ' ' --fields 2- | tr ' ' \t | sort)"
complete -c pactree -s b -l dbpath -d 'Set an alternate database location' -xa '(__fish_complete_directories)'
complete -c pactree -s c -l color -d 'Colorize output'
complete -c pactree -s d -l depth -d 'Limit the depth of recursion' -x
diff --git a/share/completions/pkgfile.fish b/share/completions/pkgfile.fish
index d76a7977..e8af0b0f 100644
--- a/share/completions/pkgfile.fish
+++ b/share/completions/pkgfile.fish
@@ -3,7 +3,7 @@ complete -c pkgfile -s h -l help -d 'show this help message and exit'
complete -c pkgfile -s b -l binaries -d 'only show files in a {s}bin/ directory. Works with -s, -l'
complete -c pkgfile -s c -l case-sensitive -d 'make searches case sensitive'
complete -c pkgfile -s g -l glob -d 'allow the use of * and ? as wildcards'
-complete -c pkgfile -s r -l regex -d 'allow the use of regex in searches'
+complete -c pkgfile -s r -l regex -d 'allow the use of regex in searches'
complete -c pkgfile -s R -l repo -d 'search only in the specified repository' -xa '(cat /etc/pacman.conf|grep "^\[" | sed "s/\[\|]//g")'
complete -c pkgfile -s v -l verbose -d 'enable verbose output'
complete -c pkgfile -s i -l info -d 'provides information about the package owning a file' -r
diff --git a/share/completions/ps2pdf.fish b/share/completions/ps2pdf.fish
index 05975ced..036b0c1d 100644
--- a/share/completions/ps2pdf.fish
+++ b/share/completions/ps2pdf.fish
@@ -1,3 +1,3 @@
-complete -c ps2pdf -x -a "(
- __fish_complete_suffix .ps
- )"
+complete -c ps2pdf -x -a "(
+ __fish_complete_suffix .ps
+ )"
diff --git a/share/completions/rfkill.fish b/share/completions/rfkill.fish
index a8b78661..4ee6cf3c 100644
--- a/share/completions/rfkill.fish
+++ b/share/completions/rfkill.fish
@@ -1,4 +1,4 @@
-complete -c rfkill -xa 'block unblock list event help' -n 'not __fish_seen_subcommand_from block unblock list event help'
+complete -c rfkill -xa 'block unblock list event help' -n 'not __fish_seen_subcommand_from block unblock list event help'
complete -c rfkill -n '__fish_seen_subcommand_from block unblock list' -d 'device group' -xa "all wifi wlan bluetooth uwb ultrawideband wimax wwan gps fm (rfkill list | tr : \t)"
complete -c rfkill -l version -d 'Print version'
diff --git a/share/completions/setxkbmap.fish b/share/completions/setxkbmap.fish
index b3561346..71aab63e 100644
--- a/share/completions/setxkbmap.fish
+++ b/share/completions/setxkbmap.fish
@@ -13,7 +13,7 @@ complete -c setxkbmap -o keymap -d 'Specifies name of keymap to load' -xa "(c
complete -c setxkbmap -o layout -d 'Specifies layout used to choose component names' -xa "(__fish_complete_setxkbmap layout)"
complete -c setxkbmap -o model -d 'Specifies model used to choose component names' -xa "(__fish_complete_setxkbmap model)"
complete -c setxkbmap -o option -d 'Adds an option used to choose component names' -xa "(__fish_complete_list , '__fish_complete_setxkbmap option')"
-complete -c setxkbmap -o print -d 'Print a complete xkb_keymap description and exit'
+complete -c setxkbmap -o print -d 'Print a complete xkb_keymap description and exit'
complete -c setxkbmap -o query -d 'Print the current layout settings and exit'
complete -c setxkbmap -o rules -d 'Name of rules file to use' -x
complete -c setxkbmap -o symbols -d 'Specifies symbols component name' -xa "(cat /usr/share/X11/xkb/symbols.dir | sed -r $filter)"
diff --git a/share/completions/tree.fish b/share/completions/tree.fish
index 919e9938..b32fb3fc 100644
--- a/share/completions/tree.fish
+++ b/share/completions/tree.fish
@@ -1,5 +1,5 @@
-
+
## Listing options
complete -c tree -s a -d 'All files are listed'
complete -c tree -s d -d 'List directories only'
@@ -16,7 +16,7 @@ complete -c tree -l filelimit -r -d 'Do not descend dirs with more than # files
complete -c tree -l timefmt -x -d 'Print and format time according to the format <f>'
complete -c tree -s o -r -d 'Output to file instead of stdout'
-## File options
+## File options
complete -c tree -s q -d 'Print non-printable characters as \'?\''
complete -c tree -s N -d 'Print non-printable characters as is'
complete -c tree -s Q -d 'Quote filenames with double quotes'
@@ -32,27 +32,27 @@ complete -c tree -l inodes -d 'Print inode number of each file'
complete -c tree -l device -d 'Print device ID number to which each file belongs'
-## Sorting options
+## Sorting options
complete -c tree -s v -d 'Sort files alphanumerically by version'
complete -c tree -s r -d 'Sort files in reverse alphanumeric order'
complete -c tree -s t -d 'Sort files by last modification time'
complete -c tree -s c -d 'Sort files by last status change time'
complete -c tree -s U -d 'Leave files unsorted'
complete -c tree -l dirsfirst -d 'List directories before files (-U disables)'
-
-## Graphics options
+
+## Graphics options
complete -c tree -s i -d 'Don\'t print indentation lines'
complete -c tree -s A -d 'Print ANSI lines graphic indentation lines'
complete -c tree -s S -d 'Print with ASCII graphics indentation lines'
complete -c tree -s n -d 'Turn colorization off always (-C overrides)'
complete -c tree -s C -d 'Turn colorization on always'
-## XML/HTML options
+## XML/HTML options
complete -c tree -s X -d 'Prints out an XML representation of the tree'
complete -c tree -s H -r -d 'Prints out HTML format with baseHREF as top directory'
complete -c tree -s T -r -d 'Replace the default HTML title and H1 header with string'
complete -c tree -l nolinks -d 'Turn off hyperlinks in HTML output'
-
+
## Miscellaneous options
complete -c tree -l version -d 'Print version and exit'
complete -c tree -l help -d 'Print usage and this help message and exit'
diff --git a/share/completions/xdg-mime.fish b/share/completions/xdg-mime.fish
index 13ff942c..e2b597dc 100644
--- a/share/completions/xdg-mime.fish
+++ b/share/completions/xdg-mime.fish
@@ -18,7 +18,7 @@ complete -c xdg-mime -d 'Mimetype' -n '__fish_seen_subcommand_from def
# complete xdg-mime install
complete -c xdg-mime -d 'Add filetype description' -n 'contains_seq xdg-mime install -- (commandline -cop)' -r
complete -c xdg-mime -d 'Set mode' -n 'contains_seq xdg-mime install -- (commandline -cop)' -l mode -xa 'user system'
-complete -c xdg-mime -d 'Disable vendor check' -n 'contains_seq xdg-mime install -- (commandline -cop)' -l novendor
+complete -c xdg-mime -d 'Disable vendor check' -n 'contains_seq xdg-mime install -- (commandline -cop)' -l novendor
# complete xdg-mime uninstall
complete -c xdg-mime -d 'Remove filetype description' -n 'contains_seq xdg-mime uninstall -- (commandline -cop)' -r
diff --git a/share/completions/xrandr.fish b/share/completions/xrandr.fish
index a49fd2b4..a05c832f 100644
--- a/share/completions/xrandr.fish
+++ b/share/completions/xrandr.fish
@@ -6,11 +6,11 @@ complete -c xrandr -s v -l version -d 'Print out the RandR version reported by t
complete -c xrandr -s q -l query -d 'Display the current state of the system'
complete -c xrandr -s d -o display -d 'Select X display to use' -x
complete -c xrandr -l screen -d 'Select which screen to manipulate' -x
-complete -c xrandr -l q1 -d 'Use RandR version 1.1 protocol'
-complete -c xrandr -l q12 -d 'Use RandR version 1.2 protocol'
+complete -c xrandr -l q1 -d 'Use RandR version 1.1 protocol'
+complete -c xrandr -l q12 -d 'Use RandR version 1.2 protocol'
set -l ver (xrandr -v | grep RandR | sed 's/^.\+\s\([0-9\.]\+\)$/\1/')
-if not expr match $ver '^[0-9.]*$' >/dev/null
+if not expr match $ver '^[0-9.]*$' >/dev/null
set ver 10
end
@@ -25,7 +25,7 @@ if expr $ver '>' 1.1
complete -c xrandr -l prop -l properties -d 'Display the contents of properties for each output'
complete -c xrandr -l fb -d 'Set screen size' -x
complete -c xrandr -l fbmm -d 'Set reported physical screen size' -x
- complete -c xrandr -l dpi -d 'Set dpi to calculate reported physical screen size'
+ complete -c xrandr -l dpi -d 'Set dpi to calculate reported physical screen size'
complete -c xrandr -l newmode -d 'Add new mode' -r
complete -c xrandr -l rmmode -d 'Removes a mode from the server' -xa '(__fish_print_xrandr_modes)'
complete -c xrandr -l addmode -d 'Add a mode to the set of valid modes for an output' -xa '(__fish_print_xrandr_outputs)'
@@ -53,7 +53,7 @@ end
if expr $ver '>' 1.2
complete -c xrandr -l noprimary -d 'Don\'t define a primary output.'
complete -c xrandr -l current -d 'Print current screen configuration'
- complete -c xrandr -l panning -d 'Set panning: widthxheight[+x+y[/track_widthxtrack_height+track_x+track_y[/border_left/border_top/border_right/border_bottom]]]' -x
+ complete -c xrandr -l panning -d 'Set panning: widthxheight[+x+y[/track_widthxtrack_height+track_x+track_y[/border_left/border_top/border_right/border_bottom]]]' -x
complete -c xrandr -l transform -d 'Set transformation matrix: a,b,c,d,e,f,g,h,i for [ [a,b,c], [d,e,f], [g,h,i] ]' -x
complete -c xrandr -l scale -d 'Set scren scale' -x
complete -c xrandr -l primary -d 'Set the output as primary'
diff --git a/share/completions/xrdb.fish b/share/completions/xrdb.fish
index bddafb5f..edb5b291 100644
--- a/share/completions/xrdb.fish
+++ b/share/completions/xrdb.fish
@@ -16,6 +16,6 @@ complete -c xrdb -o symbols -d 'show preprocessor symbols'
complete -c xrdb -o remove -d 'remove resources'
complete -c xrdb -o retain -d 'avoid server reset (avoid using this)'
complete -c xrdb -o quiet -d 'don\'t warn about duplicates'
-#complete -c xrdb -s Dname[=value],
-#complete -c xrdb -s Uname,
+#complete -c xrdb -s Dname[=value],
+#complete -c xrdb -s Uname,
#complete -c xrdb -s Idirectory -d 'passed to preprocessor'
diff --git a/share/functions/__fish_complete_atool.fish b/share/functions/__fish_complete_atool.fish
index 62f6dd05..896129a6 100644
--- a/share/functions/__fish_complete_atool.fish
+++ b/share/functions/__fish_complete_atool.fish
@@ -27,7 +27,7 @@ function __fish_complete_atool --description 'Complete atool' --argument-names c
complete -c $cmd -s S -l simulate -d 'simulation mode - no filesystem changes are made'
complete -c $cmd -s o -l option -x -d 'override a configuration optioni (KEY=VALUE)'
complete -c $cmd -l config -r -d 'load configuration defaults from file'
-
+
switch $cmd
case als aunpack acat
complete -c $cmd -a '(__fish_complete_atool_archive_contents)' -d 'Achive content'
diff --git a/share/functions/__fish_complete_cd.fish b/share/functions/__fish_complete_cd.fish
index cb10b7cf..9ca3e93b 100644
--- a/share/functions/__fish_complete_cd.fish
+++ b/share/functions/__fish_complete_cd.fish
@@ -18,7 +18,7 @@ function __fish_complete_cd -d "Completions for the cd command"
else
set mycdpath $CDPATH
end
-
+
# Note how this works: we evaluate $ctoken*/
# That trailing slash ensures that we only expand directories
diff --git a/share/functions/__fish_complete_list.fish b/share/functions/__fish_complete_list.fish
index e9a97bb7..c02a561e 100644
--- a/share/functions/__fish_complete_list.fish
+++ b/share/functions/__fish_complete_list.fish
@@ -1,6 +1,6 @@
function __fish_complete_list --argument div cmd prefix iprefix
if not set -q cmd[1]
- echo "Usage:
+ echo "Usage:
__fish_complete_list <separator> <function> <prefix> <itemprefix>
where:
separator - a symbol, separating individual entries
diff --git a/share/functions/__fish_complete_lpr.fish b/share/functions/__fish_complete_lpr.fish
index 930a2139..c6b2cbf4 100644
--- a/share/functions/__fish_complete_lpr.fish
+++ b/share/functions/__fish_complete_lpr.fish
@@ -2,26 +2,26 @@ function __fish_complete_lpr -d 'Complete lpr common options' --argument-names c
complete -c $cmd -s E -d 'Forces encryption when connecting to the server'
complete -c $cmd -s U -d 'Specifies an alternate username' -xa '(__fish_complete_users)'
- switch $cmd
+ switch $cmd
case lpr lpq lprm
complete -c $cmd -s P -d 'Specifies an alternate printer or class name' -xa '(__fish_print_lpr_printers)'
end
- switch $cmd
- case lpq cancel
+ switch $cmd
+ case lpq cancel
complete -c $cmd -s a -d 'Apply command to all printers'
end
- switch $cmd
+ switch $cmd
case lpq cancel lpmove lpstat lprm lpoptions lp reject accept cupsaccept cupsreject cupsenable cupsdisable
complete -c $cmd -s h -d 'Specifies an alternate server' -xa '(__fish_print_hostnames)'
end
-
- switch $cmd
+
+ switch $cmd
case lp lpr
complete -c $cmd -s o -d 'Sets a job option' -xa '(__fish_complete_lpr_option)'
complete -c $cmd -s m -d 'Send an email on job completion'
-
+
complete -c $cmd -s o -xa landscape -d 'Landscape mode'
complete -c $cmd -s o -xa "media=a4 media=letter media=legal" -d 'Media size'
complete -c $cmd -s o -xa page-ranges= -d 'Page ranges'
diff --git a/share/functions/__fish_complete_pacman.fish b/share/functions/__fish_complete_pacman.fish
index 70cd6522..9967df3a 100644
--- a/share/functions/__fish_complete_pacman.fish
+++ b/share/functions/__fish_complete_pacman.fish
@@ -71,7 +71,7 @@ function __fish_complete_pacman -d 'Complete pacman (ARCH package manager)' --ar
# Query and sync options
for condition in query sync
- complete -c $progname -n $$condition -s g -l groups -d 'Display all packages in GROUP' -xa "$listgroups"
+ complete -c $progname -n $$condition -s g -l groups -d 'Display all packages in GROUP' -xa "$listgroups"
complete -c $progname -n $$condition -s i -l info -d 'Display information on PACKAGE'
complete -c $progname -n $$condition -s q -l quiet -d 'Show less information'
complete -c $progname -n $$condition -s s -l search -r -d 'Search packages for regexp'
diff --git a/share/functions/__fish_complete_python.fish b/share/functions/__fish_complete_python.fish
index 33bc2cb6..899add7f 100644
--- a/share/functions/__fish_complete_python.fish
+++ b/share/functions/__fish_complete_python.fish
@@ -17,18 +17,18 @@ function __fish_complete_python -d 'Make completion for python' --argument-names
complete -c $cmd -s x -d 'Skip first line of source, allowing use of non-Unix forms of #!cmd'
complete -c $cmd -a "(__fish_complete_suffix .py)"
complete -c $cmd -a '-' -d 'Read program from stdin'
-
+
switch (eval $cmd -V 2>| sed 's/^.*\s\(.\).*/\1/')
case 2
complete -c $cmd -s 3 -d 'Warn about Python 3.x incompatibilities that 2to3 cannot trivially fix'
complete -c $cmd -s t --description "Warn on mixed tabs and spaces"
complete -c $cmd -s Q -x -a "old new warn warnall" --description "Division control"
-
+
case 3
complete -c $cmd -s q --description 'Don\'t print version and copyright messages on interactive startup'
complete -c $cmd -s X -x -d 'Set implementation-specific option'
complete -c $cmd -s b -d 'Issue warnings about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str'
complete -c $cmd -o bb -d 'Issue errors'
-
+
end
end
diff --git a/share/functions/__fish_complete_subcommand.fish b/share/functions/__fish_complete_subcommand.fish
index e263684a..ace0db2d 100644
--- a/share/functions/__fish_complete_subcommand.fish
+++ b/share/functions/__fish_complete_subcommand.fish
@@ -32,7 +32,7 @@ function __fish_complete_subcommand -d "Complete subcommand"
case '-*'
case '*=*'
case '*'
-
+
set had_cmd 1
set res $i
end
diff --git a/share/functions/__fish_complete_svn.fish b/share/functions/__fish_complete_svn.fish
index 52b4392e..51030313 100644
--- a/share/functions/__fish_complete_svn.fish
+++ b/share/functions/__fish_complete_svn.fish
@@ -1,5 +1,5 @@
-function __fish_complete_svn -d 'Complete svn and its wrappers' --argument-names svn
+function __fish_complete_svn -d 'Complete svn and its wrappers' --argument-names svn
function _svn_cmpl_ -d 'Make a completion for a subcommand' --no-scope-shadowing --argument-names subcommand
set -e argv[1]
complete -c $svn -n "__fish_seen_subcommand_from $subcommand" $argv
@@ -16,17 +16,17 @@ function __fish_complete_svn -d 'Complete svn and its wrappers' --argument-names
set -l cleanup cleanup
set -l commit 'ci commit'
set -l copy 'cp copy'
- set -l diff 'di diff'
+ set -l diff 'di diff'
set -l export export
- set -l help '\? h help'
+ set -l help '\? h help'
set -l import import
set -l info info
- set -l list 'ls list'
+ set -l list 'ls list'
set -l lock lock
set -l log log
set -l merge merge
set -l mergeinfo mergeinfo
- set -l mkdir mkdir
+ set -l mkdir mkdir
set -l move 'mv move ren rename'
set -l patch patch
set -l propdel 'pd pdel propdel'
@@ -39,8 +39,8 @@ function __fish_complete_svn -d 'Complete svn and its wrappers' --argument-names
set -l resolve resolve
set -l resolved resolved
set -l revert revert
- set -l stat 'st stat status'
- set -l switch 'sw switch'
+ set -l stat 'st stat status'
+ set -l switch 'sw switch'
set -l unlock unlock
set -l update 'up update'
set -l upgrade upgrade
@@ -97,7 +97,7 @@ function __fish_complete_svn -d 'Complete svn and its wrappers' --argument-names
# local commands
#
for cmd in $commit $copy $import $lock $mkdir $move $propedit $remove
- if not test $cmd = lock
+ if not test $cmd = lock
_svn_cmpl_ $cmd -l editor-cmd -x --description 'Use ARG as external editor'
end
_svn_cmpl_ $cmd -l message -s m --description 'Specify log message'
@@ -142,7 +142,7 @@ function __fish_complete_svn -d 'Complete svn and its wrappers' --argument-names
_svn_cmpl_ $cmd -l change -s c -d 'The change made in revision ARG' -xa '(__fish_print_svn_rev)'
end
- for cmd in $blame $cat $checkout $copy $diff $export $info $list $log $merge $mergeinfo $move $propedit $propget $propdel $proplist $propset $switch $update
+ for cmd in $blame $cat $checkout $copy $diff $export $info $list $log $merge $mergeinfo $move $propedit $propget $propdel $proplist $propset $switch $update
_svn_cmpl_ $cmd -l revision -s r -d 'Which revision the target is first looked up' -xa '(__fish_print_svn_rev)'
end
@@ -169,8 +169,8 @@ function __fish_complete_svn -d 'Complete svn and its wrappers' --argument-names
_svn_cmpl_ $cmd -l extensions -s x -d 'Ignore eol style' -xa '-w --ignore-eol-style'
_svn_cmpl_ $cmd -l extensions -s x -d 'Show C function name' -xa '-p --shoe-c-function'
- # Next completion doesn't work, since fish doesn't respect -x key
- #_svn_cmpl_ $cmd -l extensions -n '__fish_seen_subcommand_from --diff-cmd' -xa '(__fish_complete_svn_diff)'
+ # Next completion doesn't work, since fish doesn't respect -x key
+ #_svn_cmpl_ $cmd -l extensions -n '__fish_seen_subcommand_from --diff-cmd' -xa '(__fish_complete_svn_diff)'
end
for cmd in $cleanup $merge $switch $update
@@ -185,28 +185,28 @@ function __fish_complete_svn -d 'Complete svn and its wrappers' --argument-names
_svn_cmpl_ $cmd -l no-ignore -d 'Disregard default and svn:ignore property ignores'
end
- for cmd in $merge $patch
+ for cmd in $merge $patch
_svn_cmpl_ $cmd -l dry-run --description 'Try operation but make no changes'
end
- for cmd in $merge $switch
+ for cmd in $merge $switch
_svn_cmpl_ $cmd -l ignore-ancestry --description 'Ignore ancestry when calculating merges'
end
- for cmd in $diff $log
+ for cmd in $diff $log
_svn_cmpl_ $cmd -l internal-diff --description 'Override diff-cmd specified in config file'
_svn_cmpl_ $cmd -l diff-cmd --description 'Use external diff command' -xa "(complete -C(commandline -ct))"
end
- for cmd in $add $import
+ for cmd in $add $import
_svn_cmpl_ $cmd -l no-auto-props --description 'Disable automatic properties'
end
- for cmd in $switch $update
+ for cmd in $switch $update
_svn_cmpl_ $cmd -l set-depth --description 'Set new working copy depth' -xa 'exclude empty files immediates infinity'
end
- for cmd in $blame $log
+ for cmd in $blame $log
_svn_cmpl_ $cmd -l use-merge-history -s g -d 'Use/display additional information from merge history'
end
diff --git a/share/functions/__fish_complete_svn_diff.fish b/share/functions/__fish_complete_svn_diff.fish
index 1969c164..ada2dd0e 100644
--- a/share/functions/__fish_complete_svn_diff.fish
+++ b/share/functions/__fish_complete_svn_diff.fish
@@ -2,7 +2,7 @@ function __fish_complete_svn_diff --description 'Complete "svn diff" arguments'
set -l cmdl (commandline -cop)
#set -l cmdl svn diff --diff-cmd diff --extensions '-a -b'
set -l diff diff
-set -l args
+set -l args
while set -q cmdl[1]
switch $cmdl[1]
case --diff-cmd
diff --git a/share/functions/__fish_complete_tex.fish b/share/functions/__fish_complete_tex.fish
index 1c8876fe..1334ddda 100644
--- a/share/functions/__fish_complete_tex.fish
+++ b/share/functions/__fish_complete_tex.fish
@@ -14,7 +14,7 @@ function __fish_complete_tex -d "Common completions for all tex commands"
complete -c $argv -o interaction=nonstopmode -d "Set interation mode"
complete -c $argv -o interaction=scrollmode -d "Set interation mode"
complete -c $argv -o interaction=errorstopmode -d "Set interation mode"
- complete -c $argv -o output-directory= -x -a "(__fish_complete_directories (commandline -ct))" -d "Output directory"
+ complete -c $argv -o output-directory= -x -a "(__fish_complete_directories (commandline -ct))" -d "Output directory"
complete -c $argv -o shell-escape -d "Enable \write18{SHELL COMMAND}"
complete -c $argv -o no-shell-escape -d "Disable \write18{SHELL COMMAND}"
complete -c $argv -o src-specials -d "Insert source specials into the DVI file"
diff --git a/share/functions/__fish_make_completion_signals.fish b/share/functions/__fish_make_completion_signals.fish
index a8d97819..81347569 100644
--- a/share/functions/__fish_make_completion_signals.fish
+++ b/share/functions/__fish_make_completion_signals.fish
@@ -2,7 +2,7 @@ function __fish_make_completion_signals --description 'Make list of kill signals
set -q __kill_signals; and return 0
if kill -L ^/dev/null >/dev/null
- # Debian and some related systems use 'kill -L' to write out a numbered list
+ # Debian and some related systems use 'kill -L' to write out a numbered list
# of signals. Use this to complete on both number _and_ on signal name.
complete -c kill -s L --description "List codes and names of available signals"
set -g __kill_signals (kill -L | sed -e 's/\([0-9][0-9]*\) *\([A-Z,0-9][A-Z,0-9]*\)/\1 \2\n/g;s/ +/ /g' | sed -e 's/^ \+//' | sgrep -E '^[^ ]+')
diff --git a/share/functions/__fish_print_help.fish b/share/functions/__fish_print_help.fish
index 07df075c..8e4d3000 100644
--- a/share/functions/__fish_print_help.fish
+++ b/share/functions/__fish_print_help.fish
@@ -8,7 +8,7 @@ function __fish_print_help --description "Print help message for the specified f
case '*'
set item $argv[1]
end
-
+
# Do nothing if the file does not exist
if not test -e "$__fish_datadir/man/man1/$item.1"
return
diff --git a/share/functions/dirh.fish b/share/functions/dirh.fish
index 639e920a..44244e8c 100644
--- a/share/functions/dirh.fish
+++ b/share/functions/dirh.fish
@@ -25,7 +25,7 @@ function dirh --description "Print the current directory history (the back- and
set_color $fish_color_history_current
echo -n -e $current$separator
set_color normal
-
+
# BSD seq 0 outputs '1 0' instead of nothing
if count $dirnext > /dev/null
for i in (seq (echo (count $dirnext)) -1 1)
diff --git a/share/functions/funced.fish b/share/functions/funced.fish
index f35a72fa..399439fd 100644
--- a/share/functions/funced.fish
+++ b/share/functions/funced.fish
@@ -11,7 +11,7 @@ function funced --description 'Edit function definition'
case -e --editor
set editor $argv[2]
set -e argv[2]
-
+
case -i --interactive
set interactive 1
@@ -83,7 +83,7 @@ function funced --description 'Edit function definition'
if eval $editor $tmpname
. $tmpname
end
- set -l stat $status
+ set -l stat $status
rm -f $tmpname >/dev/null
return $stat
end
diff --git a/share/functions/history.fish b/share/functions/history.fish
index 73fea995..b943719e 100644
--- a/share/functions/history.fish
+++ b/share/functions/history.fish
@@ -12,7 +12,7 @@ function history --description "Deletes an item from history"
set -l search_mode none
- if test $argc -gt 0
+ if test $argc -gt 0
for i in (seq $argc)
switch $argv[$i]
case --delete
@@ -43,7 +43,7 @@ function history --description "Deletes an item from history"
# Note this may end up passing --search twice to the builtin,
# but that's harmless
builtin history --search $argv
-
+
case delete
# Interactively delete history
set -l found_items ""
@@ -57,43 +57,43 @@ function history --description "Deletes an item from history"
#Save changes after deleting item
builtin history --save
- return 0
+ return 0
end
-
+
set found_items_count (count $found_items)
- if test $found_items_count -gt 0
+ if test $found_items_count -gt 0
echo "[0] cancel"
echo "[1] all"
echo
-
+
for i in (seq $found_items_count)
printf "[%s] %s \n" (math $i + 1) $found_items[$i]
end
-
+
read --local --prompt "echo 'Delete which entries? > '" choice
set choice (echo $choice | tr " " "\n")
-
+
for i in $choice
-
+
# Skip empty input, for example, if the user just hits return
if test -z $i
continue
end
-
- #Following two validations could be embedded with "and" but I find the syntax kind of weird.
+
+ #Following two validations could be embedded with "and" but I find the syntax kind of weird.
if not echo $i | grep -E -q "^[0-9]+\$"
- printf "Invalid input: %s\n" $i
- continue
+ printf "Invalid input: %s\n" $i
+ continue
end
-
+
if test $i -gt (math $found_items_count + 1)
- printf "Invalid input : %s\n" $i
+ printf "Invalid input : %s\n" $i
continue
end
-
+
if test $i = "0"
printf "Cancel\n"
- return
+ return
else
if test $i = "1"
for item in $found_items
diff --git a/share/tools/create_manpage_completions.py b/share/tools/create_manpage_completions.py
index 7b0c6de9..775fa5c3 100755
--- a/share/tools/create_manpage_completions.py
+++ b/share/tools/create_manpage_completions.py
@@ -4,10 +4,10 @@
# Run me like this: ./create_manpage_completions.py /usr/share/man/man1/* > man_completions.fish
"""
-<OWNER> = Siteshwar Vashisht
-<YEAR> = 2012
+<OWNER> = Siteshwar Vashisht
+<YEAR> = 2012
-Copyright (c) 2012, Siteshwar Vashisht
+Copyright (c) 2012, Siteshwar Vashisht
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
@@ -47,7 +47,7 @@ def add_diagnostic(dgn, msg_verbosity = VERY_VERBOSE):
# Add a diagnostic message, if msg_verbosity <= VERBOSITY
if msg_verbosity <= VERBOSITY:
diagnostic_output.append(' '*diagnostic_indent + dgn)
-
+
def flush_diagnostics(where):
if diagnostic_output:
output_str = '\n'.join(diagnostic_output) + '\n'
@@ -77,7 +77,7 @@ def unquoteSingleQuotes(data):
if data[0] == '`' and data[len(data)-1] == '\'':
data = data[1:len(data)-1]
return data
-
+
# Make a string of characters that are deemed safe in fish without needing to be escaped
# Note that space is not included
@@ -88,7 +88,7 @@ def fish_escape_single_quote(str):
# If it has no non-safe chars, there's nothing to do
if g_fish_safe_chars.issuperset(str):
return str
-
+
str = str.replace('\\', '\\\\') # Replace one backslash with two
str = str.replace("'", "\\'") # Replace one single quote with a backslash-single-quote
return "'" + str + "'"
@@ -107,10 +107,10 @@ def builtcommand(options, description):
fish_options = []
for option in man_optionlist:
option = option.strip()
-
+
# Skip some problematic cases
if option in ['-', '--']: continue
-
+
if option.startswith('--'):
# New style long option (--recursive)
fish_options.append('-l ' + fish_escape_single_quote(option[2:]))
@@ -120,29 +120,29 @@ def builtcommand(options, description):
elif option.startswith('-') and len(option) > 2:
# Old style long option (-recursive)
fish_options.append('-o ' + fish_escape_single_quote(option[1:]))
-
+
# Determine which options are new (not already in existing_options)
# Then add those to the existing options
existing_options = already_output_completions.setdefault(CMDNAME, set())
fish_options = [opt for opt in fish_options if opt not in existing_options]
existing_options.update(fish_options)
-
+
# Maybe it's all for naught
if not fish_options: return
-
- first_period = description.find(".")
+
+ first_period = description.find(".")
if first_period >= 45 or (first_period == -1 and len(description) > 45):
description = description[:45] + '... [See Man Page]'
elif first_period >= 0:
description = description[:first_period]
-
+
# Escape some more things
description = fish_escape_single_quote(description)
escaped_cmd = fish_escape_single_quote(CMDNAME)
-
+
output_complete_command(escaped_cmd, fish_options, description, built_command_output)
-
+
def removeGroffFormatting(data):
# data = data.replace("\fI","")
@@ -193,7 +193,7 @@ class Type1ManParser(ManParser):
def parseManPage(self, manpage):
options_section_regex = re.compile( "\.SH \"OPTIONS\"(.*?)(\.SH|\Z)", re.DOTALL)
options_section_matched = re.search( options_section_regex, manpage)
-
+
options_section = options_section_matched.group(0)
# print options_section
options_parts_regex = re.compile("\.PP(.*?)\.RE", re.DOTALL)
@@ -208,7 +208,7 @@ class Type1ManParser(ManParser):
elif (self.fallback2(options_section) ):
return True
return False
-
+
while (options_matched != None):
# print len(options_matched.groups())
# print options_matched.group()
@@ -222,7 +222,7 @@ class Type1ManParser(ManParser):
# print data
if (len (data) > 1): #and len(data[1]) <= 300):
optionName = data[0].strip()
-
+
if ( optionName.find("-") == -1):
add_diagnostic(optionName + " doesn't contain - ")
# return False
@@ -232,7 +232,7 @@ class Type1ManParser(ManParser):
optionDescription = data[1].strip().replace("\n"," ")
# print >> sys.stderr, "Option: ", optionName," Description: ", optionDescription , '\n'
builtcommand(optionName, optionDescription)
-
+
else:
add_diagnostic('Unable to split option from description')
return False
@@ -283,7 +283,7 @@ class Type1ManParser(ManParser):
return False
while options_matched != None:
data = options_matched.group(1)
-
+
# print "Data is : ", data
data = removeGroffFormatting(data)
data = data.strip()
@@ -293,7 +293,7 @@ class Type1ManParser(ManParser):
# data = re.sub(trailing_num_regex, "", data)
optionName = re.sub(trailing_num_regex, "", data[0].strip())
-
+
if ('-' not in optionName):
add_diagnostic(optionName + " doesn't contain -")
else:
@@ -311,7 +311,7 @@ class Type1ManParser(ManParser):
options_section = options_section[options_matched.end()-3:]
options_matched = re.search(options_parts_regex, options_section)
return True
-
+
def name(self):
return "Type1"
@@ -328,7 +328,7 @@ class Type2ManParser(ManParser):
def parseManPage(self, manpage):
options_section_regex = re.compile( "\.SH OPTIONS(.*?)(\.SH|\Z)", re.DOTALL)
options_section_matched = re.search( options_section_regex, manpage)
-
+
# if (options_section_matched == None):
# print "Falling Back"
# options_section_regex = re.compile( "\.SH OPTIONS(.*?)$", re.DOTALL)
@@ -372,13 +372,13 @@ class Type2ManParser(ManParser):
else:
# print >> sys.stderr, data
add_diagnostic('Unable to split option from description')
-
+
# return False
options_section = options_section[options_matched.end()-3:]
options_matched = re.search(options_parts_regex, options_section)
-
+
def name(self):
return "Type2"
@@ -396,7 +396,7 @@ class Type3ManParser(ManParser):
def parseManPage(self, manpage):
options_section_regex = re.compile( "\.SH DESCRIPTION(.*?)(\.SH|\Z)", re.DOTALL)
options_section_matched = re.search( options_section_regex, manpage)
-
+
options_section = options_section_matched.group(1)
# print options_section
# sys.exit(1)
@@ -452,7 +452,7 @@ class Type4ManParser(ManParser):
def parseManPage(self, manpage):
options_section_regex = re.compile( "\.SH FUNCTION LETTERS(.*?)(\.SH|\Z)", re.DOTALL)
options_section_matched = re.search( options_section_regex, manpage)
-
+
options_section = options_section_matched.group(1)
# print options_section
# sys.exit(1)
@@ -499,7 +499,7 @@ class TypeDarwinManParser(ManParser):
def isMyType(self, manpage):
options_section_matched = compileAndSearch("\.S[hH] DESCRIPTION", manpage)
return options_section_matched != None
-
+
def trim_groff(self, line):
# Remove initial period
if line.startswith('.'):
@@ -508,49 +508,49 @@ class TypeDarwinManParser(ManParser):
while re.match('[A-Z][a-z]\s', line):
line = line[3:]
return line
-
+
# Replace some groff escapes. There's a lot we don't bother to handle.
def groff_replace_escapes(self, line):
line = line.replace('\\ ', ' ')
line = line.replace('\& ', '')
return line
-
+
def is_option(self, line):
return line.startswith('.It Fl')
-
+
def parseManPage(self, manpage):
got_something = False
lines = manpage.splitlines()
# Discard lines until we get to ".sh Description"
while lines and not (lines[0].startswith('.Sh DESCRIPTION') or lines[0].startswith('.SH DESCRIPTION')):
lines.pop(0)
-
+
while lines:
# Pop until we get to the next option
while lines and not self.is_option(lines[0]):
lines.pop(0)
-
+
if not lines:
continue
-
+
# Get the line and clean it up
line = lines.pop(0)
line = self.groff_replace_escapes(line)
line = self.trim_groff(line)
line = line.strip()
if not line: continue
-
+
# Extract the name
name = line.split(None, 2)[0]
-
+
# Extract the description
desc = ''
while lines and not self.is_option(lines[0]):
# print "*", lines[0]
desc = desc + lines.pop(0)
-
+
# print "name: ", name
-
+
if name == '-':
# Skip double -- arguments
continue
@@ -561,9 +561,9 @@ class TypeDarwinManParser(ManParser):
elif len(name) == 1:
builtcommand('-' + name, desc)
got_something = True
-
+
return got_something
-
+
def name(self):
return "Darwin man parser"
@@ -571,25 +571,25 @@ class TypeDarwinManParser(ManParser):
class TypeDeroffManParser(ManParser):
def isMyType(self, manpage):
return True # We're optimists
-
+
def is_option(self, line):
return line.startswith('-')
-
+
def could_be_description(self, line):
return len(line) > 0 and not line.startswith('-')
-
+
def parseManPage(self, manpage):
d = Deroffer()
d.deroff(manpage)
output = d.get_output()
lines = output.split('\n')
-
+
got_something = False
-
+
# Discard lines until we get to DESCRIPTION or OPTIONS
while lines and not (lines[0].startswith('DESCRIPTION') or lines[0].startswith('OPTIONS') or lines[0].startswith('COMMAND OPTIONS')):
lines.pop(0)
-
+
# Look for BUGS and stop there
for idx in range(len(lines)):
line = lines[idx]
@@ -597,32 +597,32 @@ class TypeDeroffManParser(ManParser):
# Drop remaining elements
lines[idx:] = []
break
-
+
while lines:
# Pop until we get to the next option
while lines and not self.is_option(lines[0]):
line = lines.pop(0)
-
+
if not lines:
continue
-
+
options = lines.pop(0)
-
+
# Pop until we get to either an empty line or a line starting with -
description = ''
while lines and self.could_be_description(lines[0]):
if description: description += ' '
description += lines.pop(0)
-
+
builtcommand(options, description)
got_something = True
-
+
return got_something
-
-
+
+
def name(self):
return "Deroffing man parser"
-
+
# Return whether the file at the given path is overwritable
# Raises IOError if it cannot be opened
def file_is_overwritable(path):
@@ -633,16 +633,16 @@ def file_is_overwritable(path):
line = line.strip()
if not line:
continue
-
+
# We look in the initial run of lines that start with #
if not line.startswith('#'):
break
-
+
# See if this contains the magic word
if 'Autogenerated' in line:
result = True
break
-
+
file.close()
return result
@@ -658,7 +658,7 @@ def file_missing_or_overwritable(path):
else:
# Something else happened
return False
-
+
# Delete the file if it is autogenerated
def cleanup_autogenerated_file(path):
try:
@@ -678,7 +678,7 @@ def parse_manpage_at_path(manpage_path, yield_to_dirs, output_directory):
# Set up some diagnostics
add_diagnostic('Considering ' + manpage_path)
diagnostic_indent += 1
-
+
if manpage_path.endswith('.gz'):
fd = gzip.open(manpage_path, 'r')
manpage = fd.read()
@@ -692,32 +692,32 @@ def parse_manpage_at_path(manpage_path, yield_to_dirs, output_directory):
fd.close()
manpage = str(manpage)
-
+
# Get the "base" command, e.g. gcc.1.gz -> gcc
cmd_base = CMDNAME.split('.', 1)[0]
ignoredcommands = ["cc", "g++", "gcc", "c++", "cpp", "emacs", "gprof", "wget", "ld", "awk"]
if cmd_base in ignoredcommands:
return
-
+
# Ignore perl's gazillion man pages
ignored_prefixes = ['perl', 'zsh']
for prefix in ignored_prefixes:
if cmd_base.startswith(prefix):
return
-
+
# Ignore the millions of links to BUILTIN(1)
if manpage.find('BUILTIN 1') != -1:
return
-
+
# Clear the output list
built_command_output[:] = []
-
+
if DEROFF_ONLY:
parsers = [TypeDeroffManParser()]
else:
parsers = [Type1ManParser(), Type2ManParser(), Type4ManParser(), Type3ManParser(), TypeDarwinManParser(), TypeDeroffManParser()]
parsersToTry = [p for p in parsers if p.isMyType(manpage)]
-
+
success = False
if not parsersToTry:
add_diagnostic(manpage_path + ": Not supported")
@@ -731,7 +731,7 @@ def parse_manpage_at_path(manpage_path, yield_to_dirs, output_directory):
if success:
PARSER_INFO.setdefault(parser_name, []).append(CMDNAME)
break
-
+
if success:
if WRITE_TO_STDOUT:
output_file = sys.stdout
@@ -742,13 +742,13 @@ def parse_manpage_at_path(manpage_path, yield_to_dirs, output_directory):
output_file = open(fullpath, 'w')
else:
add_diagnostic("Not overwriting the file at '%s'" % fullpath)
-
+
except IOError as err:
add_diagnostic("Unable to open file '%s': error(%d): %s" % (fullpath, err.errno, err.strerror))
return False
-
+
built_command_output.insert(0, "# %s: %s" % (CMDNAME, parser.name()))
-
+
# Output the magic word Autogenerated so we can tell if we can overwrite this
built_command_output.insert(1, "# Autogenerated from man pages")
built_command_output.insert(2, "# using " + parser_name)
@@ -780,22 +780,22 @@ def should_skip_man_page(output_path, filename, yield_to_dirs):
# No reason to skip if we're writing to stdout
if WRITE_TO_STDOUT:
return false
-
+
# Check all the yield directories
for yield_dir in yield_to_dirs:
test_path = os.path.join(yield_dir, filename)
if os.path.isfile(test_path):
# Yield to the existing file
return true
-
+
# See if there's a hand-written file already
if not file_missing_or_overwritable(output_path):
return true
-
+
# We made it through, so don't skip
return false
-
-
+
+
def parse_and_output_man_pages(paths, output_directory, yield_to_dirs, show_progress):
global diagnostic_indent, CMDNAME
@@ -808,12 +808,12 @@ def parse_and_output_man_pages(paths, output_directory, yield_to_dirs, show_prog
print("Parsing man pages and writing completions to {0}".format(output_directory))
for manpage_path in paths:
index += 1
-
+
# Get the "base" command, e.g. gcc.1.gz -> gcc
man_file_name = os.path.basename(manpage_path)
CMDNAME = man_file_name.split('.', 1)[0]
output_file_name = CMDNAME + '.fish'
-
+
# Show progress if we're doing that
if show_progress:
progress_str = ' {0} / {1} : {2}'.format((str(index).rjust(padding_len)), total_count, man_file_name)
@@ -822,7 +822,7 @@ def parse_and_output_man_pages(paths, output_directory, yield_to_dirs, show_prog
last_progress_string_length = len(progress_str)
sys.stdout.write("\r{0}\r".format(padded_progress_str))
sys.stdout.flush()
-
+
# Maybe we want to skip this item
skip = False
if not WRITE_TO_STDOUT:
@@ -840,7 +840,7 @@ def parse_and_output_man_pages(paths, output_directory, yield_to_dirs, show_prog
# Now skip if requested
if skip:
continue
-
+
try:
if parse_manpage_at_path(manpage_path, yield_to_dirs, output_directory):
successful_count += 1
@@ -878,8 +878,8 @@ def get_paths_from_manpath():
for name in names:
result.append(os.path.join(directory_path, name))
return result
-
-
+
+
def usage(script_name):
print("Usage: {0} [-v, --verbose] [-s, --stdout] [-d, --directory] [-p, --progress] files...".format(script_name))
@@ -901,11 +901,11 @@ if __name__ == "__main__":
print(err.msg) # will print something like "option -a not recognized"
usage(script_name)
sys.exit(2)
-
+
# If a completion already exists in one of the yield-to directories, then don't overwrite it
# And even delete an existing autogenerated one
yield_to_dirs = []
-
+
use_manpath, show_progress, custom_dir = False, False, False
output_directory = ''
for opt, value in opts:
@@ -930,15 +930,15 @@ if __name__ == "__main__":
DEROFF_ONLY = True
else:
assert False, "unhandled option"
-
+
if use_manpath:
# Fetch all man1 files from the manpath
file_paths.extend(get_paths_from_manpath())
-
+
if not file_paths:
print("No paths specified")
sys.exit(0)
-
+
if not WRITE_TO_STDOUT and not output_directory:
# Default to ~/.config/fish/completions/
# Create it if it doesn't exist
@@ -948,7 +948,7 @@ if __name__ == "__main__":
except OSError as e:
if e.errno != errno.EEXIST:
raise
-
+
if True:
parse_and_output_man_pages(file_paths, output_directory, yield_to_dirs, show_progress)
else:
@@ -957,7 +957,7 @@ if __name__ == "__main__":
cProfile.run('parse_and_output_man_pages(file_paths, output_directory, yield_to_dirs, show_progress)', 'fooprof')
p = pstats.Stats('fooprof')
p.sort_stats('cumulative').print_stats(100)
-
+
# Here we can write out all the parser infos
if False:
for name in PARSER_INFO:
diff --git a/share/tools/deroff.py b/share/tools/deroff.py
index eb8b0d6c..13737aa1 100755
--- a/share/tools/deroff.py
+++ b/share/tools/deroff.py
@@ -78,17 +78,17 @@ class Deroffer:
'/O': '\330',
'oA': '\305',
'oa': '\345',
-
+
# Ligatures
'fi': 'fi',
'ff': 'ff',
'fl': 'fl',
-
+
'Fi': 'ffi',
'Ff': 'fff',
'Fl': 'ffl'
}
-
+
g_specs = {
'mi': '-',
'en': '-',
@@ -212,7 +212,7 @@ class Deroffer:
'/_': "/_",
'lz': "<>",
'an': '-',
-
+
# Output Greek
'*A': "Alpha",
'*B': "Beta",
@@ -267,16 +267,16 @@ class Deroffer:
'*z': "zeta",
'ts': "sigma",
}
-
+
g_re_word = re.compile(r'[a-zA-Z_]+') # equivalent to the word() method
g_re_number = re.compile(r'[+-]?\d+') # equivalent to the number() method
g_re_esc_char = re.compile(r"""([a-zA-Z_]) | # Word
([+-]?\d) | # Number
\\ # Backslash (for escape seq)
""", re.VERBOSE)
-
+
g_re_not_backslash_or_whitespace = re.compile(r'[^ \t\n\r\f\v\\]+') # Match a sequence of not backslash or whitespace
-
+
g_re_newline_collapse = re.compile(r'\n{3,}')
g_re_font = re.compile(r"""\\f( # Starts with backslash f
@@ -284,10 +284,10 @@ class Deroffer:
(\[\S*?\]) | # Open bracket, zero or more printable characters, then close bracket
\S) # Any printable character
""", re.VERBOSE)
-
+
# This gets filled in in __init__ below
g_macro_dict = False
-
+
def __init__(self):
self.reg_table = {}
self.tr_from = ''
@@ -310,13 +310,13 @@ class Deroffer:
self.ignore_sonx = False
self.output = []
self.name = ''
-
+
self.OPTIONS = 0
self.FORMAT = 1
self.DATA = 2
-
+
# words is uninteresting and should be treated as false
-
+
if not Deroffer.g_macro_dict:
Deroffer.g_macro_dict = {
'SH': Deroffer.macro_sh,
@@ -363,41 +363,41 @@ class Deroffer:
'tr': Deroffer.macro_tr,
'sp': Deroffer.macro_sp
}
-
+
def flush_output(self, where):
if where:
where.write(self.get_output())
self.output[:] = []
-
+
def get_output(self):
res = ''.join(self.output)
clean_res = Deroffer.g_re_newline_collapse.sub('\n', res)
return clean_res
-
+
def putchar(self, c):
self.output.append(c)
return c
-
+
# This gets swapped in in place of condputs the first time tr gets modified
def condputs_tr(self, str):
special = self.pic or self.eqn or self.refer or self.macro or (self.skiplists and self.inlist) or (self.skipheaders and self.inheader)
if not special:
self.output.append(str.translate(self.tr))
-
+
def condputs(self, str):
special = self.pic or self.eqn or self.refer or self.macro or (self.skiplists and self.inlist) or (self.skipheaders and self.inheader)
- if not special:
+ if not special:
self.output.append(str)
-
+
def str_at(self, idx):
return self.s[idx:idx+1]
-
+
def skip_char(self, amt=1):
self.s = self.s[amt:]
-
+
def skip_leading_whitespace(self):
self.s = self.s.lstrip()
-
+
def is_white(self, idx):
# Note this returns false for empty strings (idx >= len(self.s))
return self.s[idx:idx+1].isspace()
@@ -415,7 +415,7 @@ class Deroffer:
if not match: return False
self.skip_char(match.end())
return True
-
+
def font2(self):
if self.s[0:2] == '\\f':
c = self.str_at(2)
@@ -430,7 +430,7 @@ class Deroffer:
self.skip_char(3)
return True
return False
-
+
def comment(self):
# Here we require that the string start with \"
while self.str_at(0) and self.str_at(0) != '\n': self.skip_char()
@@ -485,7 +485,7 @@ class Deroffer:
self.skip_char(3)
else:
return False
-
+
if reg in self.reg_table:
old_s = self.s
self.s = self.reg_table[reg]
@@ -518,7 +518,7 @@ class Deroffer:
return True
else:
return False
-
+
def esc(self):
# We require that the string start with backslash
c = self.s[1:2]
@@ -544,11 +544,11 @@ class Deroffer:
got_something = True
self.condputs(match.group(0))
self.skip_char(match.end(0))
-
+
# Consume all specials
while self.spec():
if not self.specletter: break
-
+
return got_something
@@ -571,7 +571,7 @@ class Deroffer:
ch = self.str_at(idx)
return ch.isalpha() or ch == '_' # underscore is used in C identifiers
-
+
def digit(self, idx):
ch = self.str_at(idx)
return ch.isdigit()
@@ -584,7 +584,7 @@ class Deroffer:
self.condputs(match.group(0))
self.skip_char(match.end())
return True
-
+
def esc_char_backslash(self):
# Like esc_char, but we know the string starts with a backslash
c = self.s[1:2]
@@ -620,7 +620,7 @@ class Deroffer:
return True
else:
return False
-
+
def text_arg(self):
# PCA: The deroff.c textArg() disallowed quotes at the start of an argument
# I'm not sure if this was a bug or not
@@ -632,21 +632,21 @@ class Deroffer:
self.condputs(match.group(0))
self.skip_char(match.end(0))
got_something = True
-
+
# Next is either an escape, or whitespace, or the end
# If it's the whitespace or the end, we're done
if not self.s or self.is_white(0):
return got_something
-
+
# Try an escape
if not self.esc_char():
# Some busted escape? Just output it
self.condputs(self.str_at(0))
self.skip_char()
got_something = True
-
-
-
+
+
+
def text_arg2(self):
if not self.esc_char():
if self.s and not self.is_white(0):
@@ -673,95 +673,95 @@ class Deroffer:
# Did not find a header string
self.inheader = False
self.nobody = True
-
+
def macro_ss_ip(self):
self.nobody = True
return False
-
+
def macro_i_ir(self):
pass
return False
-
+
def macro_Nm(self):
if self.s == 'Nm\n':
self.condputs(self.name)
else:
self.name = self.s[3:].strip() + ' '
return True
-
+
def macro_close_bracket(self):
self.refer = False
return False
-
+
def macro_ps(self):
if self.is_white(2): self.pic = True
self.condputs('\n')
return True
-
+
def macro_pe(self):
if self.is_white(2): self.pic = False
self.condputs('\n')
return True
-
+
def macro_ts(self):
if self.is_white(2): self.tbl, self.tblstate = True, self.OPTIONS
self.condputs('\n')
return True
-
+
def macro_t_and(self):
if self.is_white(2): self.tbl, self.tblstate = True, self.FORMAT
self.condputs('\n')
return True
-
+
def macro_te(self):
if self.is_white(2): self.tbl = False
self.condputs('\n')
return True
-
+
def macro_eq(self):
if self.is_white(2): self.eqn = True
self.condputs('\n')
return True
-
+
def macro_en(self):
if self.is_white(2): self.eqn = False
self.condputs('\n')
return True
-
+
def macro_r1(self):
if self.is_white(2): self.refer2 = True
self.condputs('\n')
return True
-
+
def macro_r2(self):
if self.is_white(2): self.refer2 = False
self.condputs('\n')
return True
-
+
def macro_de(self):
macro=True
self.condputs('\n')
return True
-
+
def macro_bl_vl(self):
if self.is_white(2): self.inlist = True
self.condputs('\n')
return True
-
+
def macro_bv(self):
if self.str_at(2) == 'L' and self.white(self.str_at(3)): self.inlist = True
self.condputs('\n')
return True
-
+
def macro_le(self):
if self.is_white(2): self.inlist = False
self.condputs('\n')
return True
-
+
def macro_lp_pp(self):
self.condputs('\n')
return True
-
+
def macro_ds(self):
self.skip_char(2)
self.skip_leading_whitespace()
@@ -774,13 +774,13 @@ class Deroffer:
self.reg_table[name] = value
self.condputs('\n')
return True
-
+
def macro_so_nx(self):
# We always ignore include directives
# deroff.c for some reason allowed this to fall through to the 'tr' case
# I think that was just a bug so I won't replicate it
return True
-
+
def macro_tr(self):
self.skip_char(2)
self.skip_leading_whitespace()
@@ -791,7 +791,7 @@ class Deroffer:
if not ns or ns == '\n': ns = ' '
self.tr_from += c
self.tr_to += ns
-
+
# Update our table, then swap in the slower tr-savvy condputs
try: #Python2
self.tr = string.maketrans(self.tr_from, self.tr_to)
@@ -799,11 +799,11 @@ class Deroffer:
self.tr = "".maketrans(self.tr_from, self.tr_to)
self.condputs = self.condputs_tr
return True
-
+
def macro_sp(self):
self.condputs('\n')
return True
-
+
def macro_other(self):
self.condputs('\n')
return True
@@ -830,16 +830,16 @@ class Deroffer:
self.macro = False
self.condputs('\n')
return True
-
+
self.nobody = False
s0s1 = self.s[0:2]
-
+
macro_func = Deroffer.g_macro_dict.get(s0s1, Deroffer.macro_other)
if macro_func(self):
return True
-
+
if self.skipheaders and self.nobody: return True
-
+
self.skip_leading_whitespace()
while self.s and not self.is_white(0): self.skip_char()
self.skip_leading_whitespace()
@@ -873,7 +873,7 @@ class Deroffer:
self.macro = False
self.condputs('\n')
return True
-
+
self.nobody = False
s0s1 = self.s[0:2]
if s0s1 == 'SH':
@@ -973,14 +973,14 @@ class Deroffer:
if not ns or ns == '\n': ns = ' '
self.tr_from += c
self.tr_to += ns
-
+
# Update our table, then swap in the slower tr-savvy condputs
try: #Python2
self.tr = string.maketrans(self.tr_from, self.tr_to)
except AttributeError: #Python3
self.tr = "".maketrans(self.tr_from, self.tr_to)
self.condputs = self.condputs_tr
-
+
return True
elif s0s1 in ['sp']:
self.condputs('\n')
@@ -988,9 +988,9 @@ class Deroffer:
else:
self.condputs('\n')
return True
-
+
if self.skipheaders and self.nobody: return True
-
+
self.skip_leading_whitespace()
while self.s and not self.is_white(0): self.skip_char()
self.skip_leading_whitespace()
@@ -1011,21 +1011,21 @@ class Deroffer:
# deroff.c has a bug where it can loop forever here...we try to work around it
self.skip_char()
else: # Parse option
-
+
option = self.s
arg = ''
-
+
idx = 0
while option[idx:idx+1].isalpha():
idx += 1
-
+
if option[idx:idx+1] == '(':
option = option[:idx]
self.s = self.s[idx+1:]
arg = self.s
else:
self.s = ''
-
+
if arg:
idx = arg.find(')')
if idx != -1:
@@ -1034,18 +1034,18 @@ class Deroffer:
else:
#self.skip_char()
pass
-
+
if option.lower() == 'tab':
self.tblTab = arg[0:1]
-
+
self.tblstate = self.FORMAT
self.condputs('\n')
-
+
elif self.tblstate == self.FORMAT:
while self.s and self.str_at(0) != '.' and self.str_at(0) != '\n':
self.skip_leading_whitespace()
if self.str_at(0): self.skip_char()
-
+
if self.str_at(0) == '.': self.tblstate = self.DATA
self.condputs('\n')
elif self.tblstate == self.DATA:
@@ -1062,7 +1062,7 @@ class Deroffer:
else:
self.text()
return True
-
+
def deroff(self, str):
lines = str.split('\n')
for line in lines:
@@ -1086,7 +1086,7 @@ def deroff_files(files):
d.flush_output(sys.stdout)
f.close()
-
+
if __name__ == "__main__":
import gzip