mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 13:23:09 +00:00
parent
b383e29a24
commit
3a835ebd61
4 changed files with 24 additions and 4 deletions
|
@ -13,7 +13,7 @@ end
|
||||||
|
|
||||||
function funced --description 'Edit function definition'
|
function funced --description 'Edit function definition'
|
||||||
set -l options 'h/help' 'e/editor=' 'i/interactive' 's/save'
|
set -l options 'h/help' 'e/editor=' 'i/interactive' 's/save'
|
||||||
argparse -n funced --min-args=1 --max-args=1 $options -- $argv
|
argparse -n funced --max-args=1 $options -- $argv
|
||||||
or return
|
or return
|
||||||
|
|
||||||
if set -q _flag_help
|
if set -q _flag_help
|
||||||
|
@ -21,6 +21,11 @@ function funced --description 'Edit function definition'
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not set -q argv[1]
|
||||||
|
printf (_ "%ls: Expected at least %d args, got only %d\n") funced 1 0
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
set funcname $argv[1]
|
set funcname $argv[1]
|
||||||
|
|
||||||
# Check VISUAL first since theoretically EDITOR could be ed.
|
# Check VISUAL first since theoretically EDITOR could be ed.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
function funcsave --description "Save the current definition of all specified functions to file"
|
function funcsave --description "Save the current definition of all specified functions to file"
|
||||||
set -l options 'h/help'
|
set -l options 'h/help'
|
||||||
argparse -n funcsave --min-args=1 $options -- $argv
|
argparse -n funcsave $options -- $argv
|
||||||
or return
|
or return
|
||||||
|
|
||||||
if set -q _flag_help
|
if set -q _flag_help
|
||||||
|
@ -8,6 +8,11 @@ function funcsave --description "Save the current definition of all specified fu
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not set -q argv[1]
|
||||||
|
printf (_ "%ls: Expected at least %d args, got only %d\n") funcsave 1 0
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
if not mkdir -p $__fish_config_dir/functions
|
if not mkdir -p $__fish_config_dir/functions
|
||||||
printf (_ "%s: Could not create configuration directory\n") funcsave
|
printf (_ "%s: Could not create configuration directory\n") funcsave
|
||||||
return 1
|
return 1
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
if not command -sq open
|
if not command -sq open
|
||||||
function open --description "Open file in default application"
|
function open --description "Open file in default application"
|
||||||
set -l options 'h/help'
|
set -l options 'h/help'
|
||||||
argparse -n open --min-args=1 $options -- $argv
|
argparse -n open $options -- $argv
|
||||||
or return
|
or return
|
||||||
|
|
||||||
if set -q _flag_help
|
if set -q _flag_help
|
||||||
|
@ -13,6 +13,11 @@ if not command -sq open
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not set -q argv[1]
|
||||||
|
printf (_ "%ls: Expected at least %d args, got only %d\n") open 1 0
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
if type -q -f cygstart
|
if type -q -f cygstart
|
||||||
for i in $argv
|
for i in $argv
|
||||||
cygstart $i
|
cygstart $i
|
||||||
|
|
|
@ -25,7 +25,7 @@ function realpath -d "return an absolute path without symlinks"
|
||||||
set -l options 'h/help' 'q/quiet' 'V-version' 's/strip' 'N-no-symlinks' 'z/zero'
|
set -l options 'h/help' 'q/quiet' 'V-version' 's/strip' 'N-no-symlinks' 'z/zero'
|
||||||
set -a options 'e/canonicalize-existing' 'm/canonicalize-missing' 'L/logical' 'P/physical'
|
set -a options 'e/canonicalize-existing' 'm/canonicalize-missing' 'L/logical' 'P/physical'
|
||||||
set -a options 'R-relative-to=' 'B-relative-base='
|
set -a options 'R-relative-to=' 'B-relative-base='
|
||||||
argparse -n realpath --min-args=1 $options -- $argv
|
argparse -n realpath $options -- $argv
|
||||||
or return
|
or return
|
||||||
|
|
||||||
if set -q _flag_help
|
if set -q _flag_help
|
||||||
|
@ -42,6 +42,11 @@ function realpath -d "return an absolute path without symlinks"
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not set -q argv[1]
|
||||||
|
printf (_ "%ls: Expected at least %d args, got only %d\n") realpath 1 0
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
for path in $argv
|
for path in $argv
|
||||||
builtin realpath $path
|
builtin realpath $path
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue