harmonize scripts
This commit is contained in:
parent
f8e6b745b3
commit
f365f53898
2 changed files with 12 additions and 9 deletions
|
@ -1,17 +1,20 @@
|
||||||
function makeaway
|
function makeaway
|
||||||
|
# Get function name
|
||||||
|
set current_name $(status current-function)
|
||||||
|
|
||||||
# Check if no arguments were provided, or if the first argument is '--help'
|
# Check if no arguments were provided, or if the first argument is '--help'
|
||||||
if test -z $argv[1] || test "$argv[1]" = --help
|
if test -z $argv[1] || test "$argv[1]" = --help || test "$argv[1]" = -h
|
||||||
echo -e "Usage: makeaway <directory> [-- <target>]"
|
echo -e "Usage: $current_name <directory> [-- <target>]"
|
||||||
echo -e " makeaway --help \t\t - Show this help message"
|
echo -e " $current_name [-h|--help] \t\t - Show this help message"
|
||||||
echo -e " makeaway <directory> \t\t - Run 'make' in the specified directory"
|
echo -e " $current_name <directory> \t\t - Run 'make' in the specified directory"
|
||||||
echo -e " makeaway <directory> -- <target> - Run 'make <target>' in the specified directory"
|
echo -e " $current_name <directory> -- <target> - Run 'make <target>' in the specified directory"
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
# Check if directory exists
|
# Check if directory exists
|
||||||
set directory "$argv[1]"
|
set directory "$argv[1]"
|
||||||
if not test -d "$directory"
|
if not test -d "$directory"
|
||||||
echo "Directory doesn't exists." 1>&2
|
echo "$current_name: directory doesn't exists." 1>&2
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -22,11 +25,11 @@ function makeaway
|
||||||
set target $argv[3]
|
set target $argv[3]
|
||||||
else if test (count $argv) -ge 2 && test "$argv[2]" = --
|
else if test (count $argv) -ge 2 && test "$argv[2]" = --
|
||||||
# User used "--" without target
|
# User used "--" without target
|
||||||
echo "No target found." 1>&2
|
echo "$current_name: no target found." 1>&2
|
||||||
return 1
|
return 1
|
||||||
else if test (count $argv) -ge 2 && not test "$argv[2]" = --
|
else if test (count $argv) -ge 2 && not test "$argv[2]" = --
|
||||||
# User used "--" without target
|
# User used "--" without target
|
||||||
echo "Unknown argument `$argv[2]`." 1>&2
|
echo "$current_name: unknown argument `$argv[2]`." 1>&2
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,8 @@ function ssh-import
|
||||||
|
|
||||||
set ssh_directory "$HOME/.ssh"
|
set ssh_directory "$HOME/.ssh"
|
||||||
|
|
||||||
# Delete the .ssh directory
|
|
||||||
if set -ql _flag_force
|
if set -ql _flag_force
|
||||||
|
# Delete the .ssh directory
|
||||||
find $ssh_directory -type f -not -name known_hosts -not -name environment -delete
|
find $ssh_directory -type f -not -name known_hosts -not -name environment -delete
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue