Move a few shellscript bits around

darcs-hash:20060218024145-ac50b-207ca782808ea8968cb38253c7bc2563350f38b2.gz
This commit is contained in:
axel
2006-02-18 12:41:45 +10:00
parent 7073f0b58b
commit dd79d75504
5 changed files with 56 additions and 162 deletions

View File

@@ -0,0 +1,8 @@
function __fish_append -d "Internal completion function for appending string to the commandline"
set separator $argv[1]
set -e argv[1]
set str (commandline -tc| sed -ne "s/\(.*$separator\)[^$separator]*/\1/p"|sed -e "s/--.*=//")
printf "%s\n" "$str"$argv "$str"(printf "%s\n" $argv|sed -e "s/\(\t\|\$\)/,\1/")
end

View File

@@ -0,0 +1,16 @@
#
# Test to see if we've seen a subcommand from a list.
# This logic may seem backwards, but the commandline will often be much shorter
# than the list
#
function __fish_seen_subcommand_from
set -l -- cmd (commandline -poc)
set -e cmd[1]
for i in $cmd
if contains -- $i $argv
return 0
end
end
return 1
end