From 41cfc496aa3ad1d4cea6d15afbec130b21e3a32c Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 28 Jun 2015 15:03:45 +0200 Subject: Fix: move path removing to helper With the path-removing code in the helper function "scriptname_to_command" we have also closed the issue that the help text includes the full path of the command. Close #22 --- nix-script | 3 +-- nix-utils.sh | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nix-script b/nix-script index 3cfc082..cb8f3de 100755 --- a/nix-script +++ b/nix-script @@ -92,8 +92,7 @@ then stdout "Listing commands" for cmd in $(all_commands) do - echo $(scriptname_to_command $cmd | \ - sed -r "s,$(dirname ${BASH_SOURCE[0]})/nix-script-,,") + echo $(scriptname_to_command $cmd) done exit 0 fi diff --git a/nix-utils.sh b/nix-utils.sh index 3ff20df..d087bdf 100644 --- a/nix-utils.sh +++ b/nix-utils.sh @@ -13,7 +13,8 @@ stdout() { } scriptname_to_command() { - echo "$1" | sed 's,^\.\/nix-script-,,' | sed 's,\.sh$,,' + echo "$1" | sed 's,^\.\/nix-script-,,' | sed 's,\.sh$,,' | \ + sed -r "s,$(dirname ${BASH_SOURCE[0]})/nix-script-,," } help_synopsis() { -- cgit v1.2.3