Skip to content

Commit 936bd44

Browse files
committed
fix: parent argparse
1 parent 25fe918 commit 936bd44

2 files changed

Lines changed: 9 additions & 11 deletions

File tree

bashbox

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
main@bashbox%27918 ()
2+
main@bashbox%16111 ()
33
{
44
if test "${BASH_VERSINFO[0]}${BASH_VERSINFO[1]}" -lt 43; then
55
{
@@ -55,7 +55,7 @@ main@bashbox%27918 ()
5555
___self="$0";
5656
___self_PID="$$";
5757
___self_DIR="$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)";
58-
___MAIN_FUNCNAME='main@bashbox%27918';
58+
___MAIN_FUNCNAME='main@bashbox%16111';
5959
___self_NAME="BashBox";
6060
___self_CODENAME="bashbox";
6161
___self_AUTHORS=("AXON <[email protected]>");
@@ -1549,7 +1549,7 @@ For bugreports: $___self_REPOSITORY"
15491549
for _arg in "${@}";
15501550
do
15511551
{
1552-
if test "$_arg" != "--" && [[ "$_arg" =~ ^-[a-zA-Z] ]]; then
1552+
if test "$_arg" != "--" && [[ "$_arg" == -* ]]; then
15531553
{
15541554
case "$_arg" in
15551555
--verbose | -v)
@@ -1570,7 +1570,9 @@ For bugreports: $___self_REPOSITORY"
15701570
exit 0
15711571
;;
15721572
-C)
1573-
cd "$2" || log::error "$2 doesn't exist" || exit;
1573+
cd "$2" || {
1574+
log::error "$2 doesn't exist" || exit
1575+
};
15741576
shift
15751577
;;
15761578
esac;
@@ -1623,4 +1625,4 @@ For bugreports: $___self_REPOSITORY"
16231625
wait;
16241626
exit
16251627
}
1626-
main@bashbox%27918 "$@";
1628+
main@bashbox%16111 "$@";

src/main.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,10 @@ function main() {
7171

7272
# Assign optional parent arguments
7373
# Drop/escape optional parent arguments
74-
# TODO: Needs review and improvement
7574
for _arg in "${@}"; do {
7675
# Doesnt contain `--`` and is a whole word with leading `-`
77-
if test "$_arg" != "--" && [[ "$_arg" =~ ^-[a-zA-Z] ]]; then {
76+
if test "$_arg" != "--" && [[ "$_arg" == -* ]]; then {
7877
case "$_arg" in
79-
# --)
80-
# break;
81-
# ;;
8278
--verbose | -v)
8379
_arg_verbose=on;
8480
;;
@@ -97,7 +93,7 @@ function main() {
9793
;;
9894
-C)
9995
# _arg_path="$2";
100-
cd "$2" || log::error "$2 doesn't exist" || exit;
96+
cd "$2" || { log::error "$2 doesn't exist" || exit; };
10197
shift;
10298
;;
10399
esac

0 commit comments

Comments
 (0)