mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
* git rm and git status options are added
* ssh subcomand completion * __fish_complete_subcommand now can skip variable number of tokens
This commit is contained in:
parent
c66ec4df3d
commit
39a2fd1717
3 changed files with 29 additions and 7 deletions
|
@ -196,11 +196,24 @@ complete -f -c git -n '__fish_git_needs_command' -a revert -d 'Revert an existin
|
|||
# TODO options
|
||||
|
||||
### rm
|
||||
complete -c git -n '__fish_git_needs_command' -a rm -d 'Remove files from the working tree and from the index'
|
||||
complete -c git -n '__fish_git_needs_command' -a rm -d 'Remove files from the working tree and from the index'
|
||||
complete -c git -n '__fish_git_using_command rm' -f
|
||||
complete -c git -n '__fish_git_using_command rm' -l cached -d 'Keep local copies'
|
||||
complete -c git -n '__fish_git_using_command rm' -l ignore-unmatch -d 'Exit with a zero status even if no files matched'
|
||||
complete -c git -n '__fish_git_using_command rm' -s r -d 'Allow recursive removal'
|
||||
complete -c git -n '__fish_git_using_command rm' -s q -l quiet -d 'Suppress the output'
|
||||
complete -c git -n '__fish_git_using_command rm' -s f -l force -d 'Override the up-to-date check'
|
||||
complete -c git -n '__fish_git_using_command rm' -s n -l dry-run -d 'Dry run'
|
||||
# TODO options
|
||||
|
||||
### status
|
||||
complete -f -c git -n '__fish_git_needs_command' -a status -d 'Show the working tree status'
|
||||
complete -f -c git -n '__fish_git_using_command status' -s s -l short -d 'Give the output in the short-format'
|
||||
complete -f -c git -n '__fish_git_using_command status' -s b -l branch -d 'Show the branch and tracking info even in short-format'
|
||||
complete -f -c git -n '__fish_git_using_command status' -l porcelain -d 'Give the output in a stable, easy-to-parse format'
|
||||
complete -f -c git -n '__fish_git_using_command status' -s z -d 'Terminate entries with NUL character'
|
||||
complete -f -c git -n '__fish_git_using_command status' -s u -l untracked-files -x -a 'no normal all' -d 'The untracked files handling mode'
|
||||
complete -f -c git -n '__fish_git_using_command status' -l ignore-submodules -x -a 'none untracked dirty all' -d 'Ignore changes to submodules'
|
||||
# TODO options
|
||||
|
||||
### tag
|
||||
|
|
|
@ -15,9 +15,9 @@ complete -x -c ssh -d Hostname -a "
|
|||
"
|
||||
|
||||
complete -x -c ssh -d User -a "
|
||||
|
||||
(__fish_print_users)@
|
||||
"
|
||||
complete -c ssh --description "Command to run" -x -a '(__fish_complete_subcommand --fcs-skip=2)'
|
||||
|
||||
complete -c ssh -s a --description "Disables forwarding of the authentication agent"
|
||||
complete -c ssh -s A --description "Enables forwarding of the authentication agent"
|
||||
|
@ -46,3 +46,6 @@ complete -c ssh -s X --description "Enable X11 forwarding"
|
|||
complete -c ssh -s L --description "Locally forwarded ports"
|
||||
complete -c ssh -s R --description "Remotely forwarded ports"
|
||||
complete -c ssh -s D --description "Dynamic port forwarding"
|
||||
|
||||
# Since ssh runs subcommands, it can accept any switches
|
||||
complete -c ssh -u
|
||||
|
|
|
@ -1,14 +1,20 @@
|
|||
function __fish_complete_subcommand -d "Complete subcommand"
|
||||
set -l skip_next 1
|
||||
switch "$argv[1]"
|
||||
case '--fcs-skip=*'
|
||||
set -l rest
|
||||
echo $argv[1] | tr = ' ' | read test skip_next
|
||||
set -e argv[1]
|
||||
end
|
||||
|
||||
set -l res ""
|
||||
set -l had_cmd 0
|
||||
set -l cmd (commandline -cop) (commandline -ct)
|
||||
set -l skip_next 1
|
||||
|
||||
for i in $cmd
|
||||
|
||||
if test "$skip_next" = 1
|
||||
set skip_next 0
|
||||
if test $skip_next -gt 0
|
||||
set skip_next (expr $skip_next - 1)
|
||||
continue
|
||||
end
|
||||
|
||||
|
@ -17,15 +23,15 @@ function __fish_complete_subcommand -d "Complete subcommand"
|
|||
else
|
||||
|
||||
if contains -- $i $argv
|
||||
set skip_next 1
|
||||
set skip_next (expr $skip_next + 1)
|
||||
continue
|
||||
end
|
||||
|
||||
switch $i
|
||||
case '-*'
|
||||
case '*=*'
|
||||
|
||||
case '*'
|
||||
|
||||
set had_cmd 1
|
||||
set res $i
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue