mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-28 01:11:15 -03:00
Move a few shellscript bits around
darcs-hash:20060218024145-ac50b-207ca782808ea8968cb38253c7bc2563350f38b2.gz
This commit is contained in:
8
share/functions/__fish_append.fish
Normal file
8
share/functions/__fish_append.fish
Normal 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
|
||||
|
||||
|
||||
16
share/functions/__fish_seen_subcommand_from.fish
Normal file
16
share/functions/__fish_seen_subcommand_from.fish
Normal 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
|
||||
Reference in New Issue
Block a user