From f365f538989d2329dc124aa12e990892a19ceb97 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sun, 8 Oct 2023 20:51:38 +0200 Subject: [PATCH] harmonize scripts --- .config/fish/functions/makeaway.fish | 19 +++++++++++-------- .config/fish/functions/ssh-import.fish | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.config/fish/functions/makeaway.fish b/.config/fish/functions/makeaway.fish index 8b9502f..aa324ce 100644 --- a/.config/fish/functions/makeaway.fish +++ b/.config/fish/functions/makeaway.fish @@ -1,17 +1,20 @@ function makeaway + # Get function name + set current_name $(status current-function) + # Check if no arguments were provided, or if the first argument is '--help' - if test -z $argv[1] || test "$argv[1]" = --help - echo -e "Usage: makeaway [-- ]" - echo -e " makeaway --help \t\t - Show this help message" - echo -e " makeaway \t\t - Run 'make' in the specified directory" - echo -e " makeaway -- - Run 'make ' in the specified directory" + if test -z $argv[1] || test "$argv[1]" = --help || test "$argv[1]" = -h + echo -e "Usage: $current_name [-- ]" + echo -e " $current_name [-h|--help] \t\t - Show this help message" + echo -e " $current_name \t\t - Run 'make' in the specified directory" + echo -e " $current_name -- - Run 'make ' in the specified directory" return 0 end # Check if directory exists set directory "$argv[1]" if not test -d "$directory" - echo "Directory doesn't exists." 1>&2 + echo "$current_name: directory doesn't exists." 1>&2 return 1 end @@ -22,11 +25,11 @@ function makeaway set target $argv[3] else if test (count $argv) -ge 2 && test "$argv[2]" = -- # User used "--" without target - echo "No target found." 1>&2 + echo "$current_name: no target found." 1>&2 return 1 else if test (count $argv) -ge 2 && not test "$argv[2]" = -- # User used "--" without target - echo "Unknown argument `$argv[2]`." 1>&2 + echo "$current_name: unknown argument `$argv[2]`." 1>&2 return 1 end diff --git a/.config/fish/functions/ssh-import.fish b/.config/fish/functions/ssh-import.fish index 13591c2..28caf97 100644 --- a/.config/fish/functions/ssh-import.fish +++ b/.config/fish/functions/ssh-import.fish @@ -33,8 +33,8 @@ function ssh-import set ssh_directory "$HOME/.ssh" - # Delete the .ssh directory if set -ql _flag_force + # Delete the .ssh directory find $ssh_directory -type f -not -name known_hosts -not -name environment -delete end