mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-29 18:51:15 -03:00
reformat all fish scripts
I hate doing this but I am tired of touching a fish script as part of some change and having `make style` radically change it. Which makes editing fish scripts more painful than it needs to be. It is time to do a wholesale reformatting of these scripts to conform to the documented style as implemented by the `fish_indent` program.
This commit is contained in:
@@ -4,43 +4,43 @@
|
||||
#
|
||||
|
||||
function vared --description "Edit variable value"
|
||||
if test (count $argv) = 1
|
||||
switch $argv
|
||||
if test (count $argv) = 1
|
||||
switch $argv
|
||||
|
||||
case '-h' '--h' '--he' '--hel' '--help'
|
||||
__fish_print_help vared
|
||||
return 0
|
||||
case '-h' '--h' '--he' '--hel' '--help'
|
||||
__fish_print_help vared
|
||||
return 0
|
||||
|
||||
case '-*'
|
||||
printf (_ "%s: Unknown option %s\n") vared $argv
|
||||
return 1
|
||||
case '-*'
|
||||
printf (_ "%s: Unknown option %s\n") vared $argv
|
||||
return 1
|
||||
|
||||
case '*'
|
||||
if test (count $$argv ) -lt 2
|
||||
set -l init ''
|
||||
if test $$argv
|
||||
set init $$argv
|
||||
end
|
||||
set -l prompt 'set_color green; echo '$argv'; set_color normal; echo "> "'
|
||||
if read -p $prompt -c $init tmp
|
||||
case '*'
|
||||
if test (count $$argv ) -lt 2
|
||||
set -l init ''
|
||||
if test $$argv
|
||||
set init $$argv
|
||||
end
|
||||
set -l prompt 'set_color green; echo '$argv'; set_color normal; echo "> "'
|
||||
if read -p $prompt -c $init tmp
|
||||
|
||||
# If variable already exists, do not add any
|
||||
# switches, so we don't change export rules. But
|
||||
# if it does not exist, we make the variable
|
||||
# global, so that it will not die when this
|
||||
# function dies
|
||||
# If variable already exists, do not add any
|
||||
# switches, so we don't change export rules. But
|
||||
# if it does not exist, we make the variable
|
||||
# global, so that it will not die when this
|
||||
# function dies
|
||||
|
||||
if test $$argv
|
||||
set $argv $tmp
|
||||
else
|
||||
set -g $argv $tmp
|
||||
end
|
||||
end
|
||||
else
|
||||
printf (_ '%s: %s is an array variable. Use %svared%s %s[n]%s to edit the n:th element of %s\n') vared $argv (set_color $fish_color_command; echo) (set_color $fish_color_normal; echo) $argv (set_color normal; echo) $argv
|
||||
end
|
||||
end
|
||||
else
|
||||
printf (_ '%s: Expected exactly one argument, got %s.\n\nSynopsis:\n\t%svared%s VARIABLE\n') vared (count $argv) (set_color $fish_color_command; echo) (set_color $fish_color_normal; echo)
|
||||
end
|
||||
if test $$argv
|
||||
set $argv $tmp
|
||||
else
|
||||
set -g $argv $tmp
|
||||
end
|
||||
end
|
||||
else
|
||||
printf (_ '%s: %s is an array variable. Use %svared%s %s[n]%s to edit the n:th element of %s\n') vared $argv (set_color $fish_color_command; echo) (set_color $fish_color_normal; echo) $argv (set_color normal; echo) $argv
|
||||
end
|
||||
end
|
||||
else
|
||||
printf (_ '%s: Expected exactly one argument, got %s.\n\nSynopsis:\n\t%svared%s VARIABLE\n') vared (count $argv) (set_color $fish_color_command; echo) (set_color $fish_color_normal; echo)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user