Do not use makefile to generate vcs completions, do it directly in the script. Also add some minor updates to the vcs completions.

darcs-hash:20070224125927-ac50b-f1242b198ea0651c993b045d584262dc32062338.gz
This commit is contained in:
axel 2007-02-24 22:59:27 +10:00
parent 73a67c2a43
commit 0f51d5ec18
4 changed files with 63 additions and 54 deletions

View file

@ -823,21 +823,6 @@ fish.spec: fish.spec.in
./config.status
#
# Completion files which are autogenerated using various scripts
#
share/completions/darcs.fish: make_mercurial_completions.fish
./make_mercurial_completions.fish darcs 'complete -c darcs -n "not __fish_use_subcommand" -a "(test -f _darcs/prefs/repos; and cat _darcs/prefs/repos)" --description "Darcs repo"' 'complete -c darcs -a "test predist boringfile binariesfile" -n "contains setpref (commandline -poc)" -d "woot" -x' >$@
share/completions/hg.fish: make_mercurial_completions.fish
./make_mercurial_completions.fish hg >$@
share/completions/svn.fish: make_mercurial_completions.fish
./make_mercurial_completions.fish svn >$@
share/completions/cvs.fish: make_mercurial_completions.fish
./make_mercurial_completions.fish cvs >$@
#
# Create .rpm file for the current systems architecture and an

View file

@ -70,7 +70,13 @@ function complete_from_list
case '?*'
set str $str -x
echo "Don't know how to handle arguments of type '$arg'" >&2
if not set -q unknown
set -g unknown
end
if not contains $arg $unknown
echo "Don't know how to handle arguments of type '$arg'" >&2
set unknown $unknown $arg
end
end
switch $desc
@ -85,39 +91,44 @@ function complete_from_list
end
set cmd $argv[1]; or exit 1
function write_completions
echo '
set -g cmd $argv[1]; or return 1
echo "Making completions for $cmd" >&2
echo '
#
# Completions for the '$cmd' command
# This file was autogenerated by the file make_mercurial_completions.fish
# which is shipped with the fish source code
# This file was autogenerated by the file make_vcs_completions.fish
# which is shipped with the fish source code.
#
#
# Completions from commandline
#
'
set -e argv[1]
set -e argv[1]
while count $argv >/dev/null
echo $argv[1]
set -e argv[1]
end
while count $argv >/dev/null
echo $argv[1]
set -e argv[1]
end
eval "function cmd; $cmd \$argv; end"
eval "function cmd; $cmd \$argv; end"
set -l cmd_str
set -l cmd_str
switch $cmd
case svn
switch $cmd
case svn
function list_subcommand
set cmd1 '\([^ ]*\)'
set cmd2 '\([^,)]*\)'
set cmdn '\(, \([^,)]*\)\|\)'
set svn_re '^ *'$cmd1'\( ('$cmd2$cmdn$cmdn')\|\).*$'
set svn_re '^ *'$cmd1'\( ('$cmd2$cmdn$cmdn')\|\).*$'
cmd help|sed -ne 's/'$svn_re'/\1\n\3\n\5\n\7/p'| grep .
end
@ -130,23 +141,22 @@ switch $cmd
cmd help $argv | sed -n -e 's/'$re'/\1\t\2\t\3\t\5/p'
end
for i in (list_subcommand)
set desc (cmd help $i|head -n 1|sed -e 's/[^:]*: *\(.*[^.]\)\(\|\\.\)$/\1/')
set desc (esc $desc)
set cmd_str $cmd_str "-a $i --description '$desc'"
end
case cvs
case cvs
function list_subcommand
cmd --help-commands 2>| sed -n -e 's/^ *\([^ ][^ ]*\) .*$/\1/p'
cmd --help-commands 2>| sed -n -e 's/^ *\([^ ][^ ]*\) .*$/\1/p'
end
set short_exp '\(-.\)'
set arg_exp '\(\| [^ \t][^ \t]*\)'
set desc_exp '\([\t ]*:[\t ]*\|\)\([^ ].*\)'
set re '^[ \t]*'$short_exp$arg_exp'[ \t]*'$desc_exp'$'
set -g re '^[ \t]*'$short_exp$arg_exp'[ \t]*'$desc_exp'$'
function list_subcommand_help
#'s/^[ \t]*\(-.\)[ \t]\([^- \t][^ \t]*\)*[ \t]*\([^-].*\)$/\1\t\2\t\3/p'
@ -168,44 +178,54 @@ switch $cmd
set cmd_str $cmd_str "-a $exploded[1] --description '"(esc $exploded[2])"'"
end
case '*'
case '*'
function list_subcommand
cmd help | sed -n -e 's/^ *\([^ ][^ ]*\) .*$/\1/p'
cmd help | sed -n -e 's/^ *\([^ ][^ ]*\) .*$/\1/p'
end
function list_subcommand_help
set short_exp '\(-.\|\)\( [^ -][^ ]*\|\)'
set long_exp '\(--[^ =,]*\)'
set arg_exp '\(\|[= ][^ ][^ ]*\)'
set desc_exp '\([\t ]*:[\t ]*\|\)\([^ ].*[^.]\)'
set re "^ *$short_exp *$long_exp$arg_exp *$desc_exp\(\|\\.\)\$"
set -l short_exp '\(-.\|\)\( [^ -][^ ]*\|\)'
set -l long_exp '\(--[^ =,]*\)'
set -l arg_exp '\(\|[= ][^ ][^ ]*\)'
set -l desc_exp '\([\t ]*:[\t ]*\|\)\([^ ].*[^.]\)'
set -l re "^ *$short_exp *$long_exp$arg_exp *$desc_exp\(\|\\.\)\$"
cmd help $argv | sed -n -e 's/'$re'/\1\t\3\t\4\t\6/p'
end
set cmd_str (cmd help | sed -n -e 's/^ *\([^ ][^ ]*\)[\t ]*\([^ ].*[^.]\)\(\|\\.\)$/-a \1 --description \'\2\'/p')
end
echo '
end
echo '
#
# subcommands
#
'
printf "complete -c $cmd -n '__fish_use_subcommand' -x %s\n" $cmd_str
printf "complete -c $cmd -n '__fish_use_subcommand' -x %s\n" $cmd_str
for i in (list_subcommand)
for i in (list_subcommand)
echo '
echo '
#
# Completions for the \''$i'\' subcommand
#
'
complete_from_list "-n 'contains \\'$i\\' (commandline -poc)'" (list_subcommand_help $i)
complete_from_list "-n 'contains \\'$i\\' (commandline -poc)'" (list_subcommand_help $i)
end
echo \n\n
end
echo \n\n
set darcs_comp 'complete -c darcs -n "not __fish_use_subcommand" -a "(test -f _darcs/prefs/repos; and cat _darcs/prefs/repos)" --description "Darcs repo"'
set darcs_comp $darcs_comp 'complete -c darcs -a "test predist boringfile binariesfile" -n "contains setpref (commandline -poc)" --description "Set the specified option" -x'
write_completions darcs $darcs_comp >share/completions/darcs.fish
write_completions hg >share/completions/hg.fish
write_completions svn >share/completions/svn.fish
write_completions cvs >share/completions/cvs.fish

View file

@ -10,6 +10,7 @@
#
complete -c darcs -n "not __fish_use_subcommand" -a "(test -f _darcs/prefs/repos; and cat _darcs/prefs/repos)" --description "Darcs repo"
complete -c darcs -a "test predist boringfile binariesfile" -n "contains setpref (commandline -poc)" --description "Set the specified option" -x
#
# subcommands

View file

@ -31,8 +31,8 @@ complete -c svn -n '__fish_use_subcommand' -x -a delete --description 'Remove fi
complete -c svn -n '__fish_use_subcommand' -x -a del --description 'Remove files and directories from version control'
complete -c svn -n '__fish_use_subcommand' -x -a remove --description 'Remove files and directories from version control'
complete -c svn -n '__fish_use_subcommand' -x -a rm --description 'Remove files and directories from version control'
complete -c svn -n '__fish_use_subcommand' -x -a diff --description 'Display the differences between two paths'
complete -c svn -n '__fish_use_subcommand' -x -a di --description 'Display the differences between two paths'
complete -c svn -n '__fish_use_subcommand' -x -a diff --description 'Display the differences between two revisions or paths'
complete -c svn -n '__fish_use_subcommand' -x -a di --description 'Display the differences between two revisions or paths'
complete -c svn -n '__fish_use_subcommand' -x -a export --description 'Create an unversioned copy of a tree'
complete -c svn -n '__fish_use_subcommand' -x -a help --description 'Describe the usage of this program or its subcommands'
complete -c svn -n '__fish_use_subcommand' -x -a ? --description 'Describe the usage of this program or its subcommands'
@ -94,6 +94,7 @@ complete -c svn -n 'contains \'add\' (commandline -poc)' -l no-auto-props --desc
complete -c svn -n 'contains \'blame\' (commandline -poc)' -l incremental --description 'Give output suitable for concatenation'
complete -c svn -n 'contains \'blame\' (commandline -poc)' -l xml --description 'Output in XML'
complete -c svn -n 'contains \'blame\' (commandline -poc)' -l force --description 'Force operation to run'
complete -c svn -n 'contains \'blame\' (commandline -poc)' -l username -x --description 'Specify a username ARG'
complete -c svn -n 'contains \'blame\' (commandline -poc)' -l password -x --description 'Specify a password ARG'
complete -c svn -n 'contains \'blame\' (commandline -poc)' -l no-auth-cache --description 'Do not cache authentication tokens'
@ -107,6 +108,7 @@ complete -c svn -n 'contains \'blame\' (commandline -poc)' -l config-dir -x --de
complete -c svn -n 'contains \'praise\' (commandline -poc)' -l incremental --description 'Give output suitable for concatenation'
complete -c svn -n 'contains \'praise\' (commandline -poc)' -l xml --description 'Output in XML'
complete -c svn -n 'contains \'praise\' (commandline -poc)' -l force --description 'Force operation to run'
complete -c svn -n 'contains \'praise\' (commandline -poc)' -l username -x --description 'Specify a username ARG'
complete -c svn -n 'contains \'praise\' (commandline -poc)' -l password -x --description 'Specify a password ARG'
complete -c svn -n 'contains \'praise\' (commandline -poc)' -l no-auth-cache --description 'Do not cache authentication tokens'
@ -120,6 +122,7 @@ complete -c svn -n 'contains \'praise\' (commandline -poc)' -l config-dir -x --d
complete -c svn -n 'contains \'annotate\' (commandline -poc)' -l incremental --description 'Give output suitable for concatenation'
complete -c svn -n 'contains \'annotate\' (commandline -poc)' -l xml --description 'Output in XML'
complete -c svn -n 'contains \'annotate\' (commandline -poc)' -l force --description 'Force operation to run'
complete -c svn -n 'contains \'annotate\' (commandline -poc)' -l username -x --description 'Specify a username ARG'
complete -c svn -n 'contains \'annotate\' (commandline -poc)' -l password -x --description 'Specify a password ARG'
complete -c svn -n 'contains \'annotate\' (commandline -poc)' -l no-auth-cache --description 'Do not cache authentication tokens'
@ -133,6 +136,7 @@ complete -c svn -n 'contains \'annotate\' (commandline -poc)' -l config-dir -x -
complete -c svn -n 'contains \'ann\' (commandline -poc)' -l incremental --description 'Give output suitable for concatenation'
complete -c svn -n 'contains \'ann\' (commandline -poc)' -l xml --description 'Output in XML'
complete -c svn -n 'contains \'ann\' (commandline -poc)' -l force --description 'Force operation to run'
complete -c svn -n 'contains \'ann\' (commandline -poc)' -l username -x --description 'Specify a username ARG'
complete -c svn -n 'contains \'ann\' (commandline -poc)' -l password -x --description 'Specify a password ARG'
complete -c svn -n 'contains \'ann\' (commandline -poc)' -l no-auth-cache --description 'Do not cache authentication tokens'
@ -316,6 +320,7 @@ complete -c svn -n 'contains \'diff\' (commandline -poc)' -l new -x --descriptio
complete -c svn -n 'contains \'diff\' (commandline -poc)' -l diff-cmd -x --description 'Use ARG as diff command'
complete -c svn -n 'contains \'diff\' (commandline -poc)' -l no-diff-deleted --description 'Do not print differences for deleted files'
complete -c svn -n 'contains \'diff\' (commandline -poc)' -l notice-ancestry --description 'Notice ancestry when calculating differences'
complete -c svn -n 'contains \'diff\' (commandline -poc)' -l summarize --description 'Show a summary of the results'
complete -c svn -n 'contains \'diff\' (commandline -poc)' -l force --description 'Force operation to run'
complete -c svn -n 'contains \'diff\' (commandline -poc)' -l username -x --description 'Specify a username ARG'
complete -c svn -n 'contains \'diff\' (commandline -poc)' -l password -x --description 'Specify a password ARG'
@ -333,6 +338,7 @@ complete -c svn -n 'contains \'di\' (commandline -poc)' -l new -x --description
complete -c svn -n 'contains \'di\' (commandline -poc)' -l diff-cmd -x --description 'Use ARG as diff command'
complete -c svn -n 'contains \'di\' (commandline -poc)' -l no-diff-deleted --description 'Do not print differences for deleted files'
complete -c svn -n 'contains \'di\' (commandline -poc)' -l notice-ancestry --description 'Notice ancestry when calculating differences'
complete -c svn -n 'contains \'di\' (commandline -poc)' -l summarize --description 'Show a summary of the results'
complete -c svn -n 'contains \'di\' (commandline -poc)' -l force --description 'Force operation to run'
complete -c svn -n 'contains \'di\' (commandline -poc)' -l username -x --description 'Specify a username ARG'
complete -c svn -n 'contains \'di\' (commandline -poc)' -l password -x --description 'Specify a password ARG'
@ -359,7 +365,6 @@ complete -c svn -n 'contains \'export\' (commandline -poc)' -l ignore-externals
# Completions for the 'help' subcommand
#
complete -c svn -n 'contains \'help\' (commandline -poc)' -l version --description 'Print client version info'
complete -c svn -n 'contains \'help\' (commandline -poc)' -l config-dir -x --description 'Read user configuration files from directory ARG'
@ -367,7 +372,6 @@ complete -c svn -n 'contains \'help\' (commandline -poc)' -l config-dir -x --des
# Completions for the '?' subcommand
#
complete -c svn -n 'contains \'?\' (commandline -poc)' -l version --description 'Print client version info'
complete -c svn -n 'contains \'?\' (commandline -poc)' -l config-dir -x --description 'Read user configuration files from directory ARG'
@ -375,7 +379,6 @@ complete -c svn -n 'contains \'?\' (commandline -poc)' -l config-dir -x --descri
# Completions for the 'h' subcommand
#
complete -c svn -n 'contains \'h\' (commandline -poc)' -l version --description 'Print client version info'
complete -c svn -n 'contains \'h\' (commandline -poc)' -l config-dir -x --description 'Read user configuration files from directory ARG'