From 35f83adce4b8cdc28d7188e833e34b8555b7d86b Mon Sep 17 00:00:00 2001 From: Jeff Cave Date: Mon, 5 Mar 2018 19:45:28 -0500 Subject: [PATCH 1/6] added ability to use hyphen and underscore in names --- goto.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/goto.bash b/goto.bash index ddcb416..6c2031a 100644 --- a/goto.bash +++ b/goto.bash @@ -101,7 +101,7 @@ function _goto_register_alias() return fi - if ! [[ $1 =~ ^[[:alnum:]]*[[:alpha:]][[:alnum:]]*$ ]]; then + if ! [[ $1 =~ ^[a-zA-Z0-9_-]*$ ]]; then _goto_error "invalid alias - only alphabetic with numbers" return fi From ae2c3b908470e8e98133cf0adedb0c62a36c6bc2 Mon Sep 17 00:00:00 2001 From: Jeff Cave Date: Mon, 5 Mar 2018 19:54:14 -0500 Subject: [PATCH 2/6] updated error message for invalid name on register --- goto.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/goto.bash b/goto.bash index 6c2031a..04c6c80 100644 --- a/goto.bash +++ b/goto.bash @@ -102,7 +102,7 @@ function _goto_register_alias() fi if ! [[ $1 =~ ^[a-zA-Z0-9_-]*$ ]]; then - _goto_error "invalid alias - only alphabetic with numbers" + _goto_error "invalid alias - only alphabetic with numbers, hyphens, and underscores" return fi From 1174ae13fbdae34c1bde67c330d1221088290a60 Mon Sep 17 00:00:00 2001 From: Jeff Cave Date: Tue, 6 Mar 2018 14:50:55 -0500 Subject: [PATCH 3/6] removed ability to start an alias name with a - --- goto.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/goto.bash b/goto.bash index 04c6c80..3839848 100644 --- a/goto.bash +++ b/goto.bash @@ -101,8 +101,8 @@ function _goto_register_alias() return fi - if ! [[ $1 =~ ^[a-zA-Z0-9_-]*$ ]]; then - _goto_error "invalid alias - only alphabetic with numbers, hyphens, and underscores" + if ! [[ $1 =~ ^[[:alnum:]][[:alpha:]]+[a-zA-Z0-9_-]*$ ]]; then + _goto_error "invalid alias - only alphabetic with numbers, hyphens, and underscores. Can only start with letters and numbers." return fi From 29a3bd635215afee9fd1ece83c171840272e0948 Mon Sep 17 00:00:00 2001 From: Lazarus Lazaridis Date: Tue, 6 Mar 2018 22:21:24 +0200 Subject: [PATCH 4/6] Remove redundant alpha class on the 2nd character. --- goto.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/goto.bash b/goto.bash index 3839848..77f0e80 100644 --- a/goto.bash +++ b/goto.bash @@ -101,7 +101,7 @@ function _goto_register_alias() return fi - if ! [[ $1 =~ ^[[:alnum:]][[:alpha:]]+[a-zA-Z0-9_-]*$ ]]; then + if ! [[ $1 =~ ^[[:alnum:]]+[a-zA-Z0-9_-]*$ ]]; then _goto_error "invalid alias - only alphabetic with numbers, hyphens, and underscores. Can only start with letters and numbers." return fi From 74af9ef9cc33c8f5a558be07adf9723f796cb821 Mon Sep 17 00:00:00 2001 From: Lazarus Lazaridis Date: Tue, 6 Mar 2018 22:25:04 +0200 Subject: [PATCH 5/6] Update goto.bash --- goto.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/goto.bash b/goto.bash index 77f0e80..ee52e2c 100644 --- a/goto.bash +++ b/goto.bash @@ -102,7 +102,7 @@ function _goto_register_alias() fi if ! [[ $1 =~ ^[[:alnum:]]+[a-zA-Z0-9_-]*$ ]]; then - _goto_error "invalid alias - only alphabetic with numbers, hyphens, and underscores. Can only start with letters and numbers." + _goto_error "invalid alias - can start with alphanumeric followed by alphanumeric, dashes or hyphens" return fi From 8aa08c36abfb27552b1574df33c093a54e77e6cd Mon Sep 17 00:00:00 2001 From: Lazarus Lazaridis Date: Tue, 6 Mar 2018 22:30:05 +0200 Subject: [PATCH 6/6] Shorten message. --- goto.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/goto.bash b/goto.bash index ee52e2c..dcae018 100644 --- a/goto.bash +++ b/goto.bash @@ -102,7 +102,7 @@ function _goto_register_alias() fi if ! [[ $1 =~ ^[[:alnum:]]+[a-zA-Z0-9_-]*$ ]]; then - _goto_error "invalid alias - can start with alphanumeric followed by alphanumeric, dashes or hyphens" + _goto_error "invalid alias - can start with letters or digits followed by letters, digits, hyphens or underscores" return fi