Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
francescobianco committed Sep 7, 2023
1 parent 517caeb commit 1d4abce
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,6 @@ test-build-console-lib: build-dist sudo-install

test-build-empty-app:
@bash tests/bare/build/empty-app-test.sh

test-command:
@bash tests/bare/command-test.sh
13 changes: 12 additions & 1 deletion bin/mush
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ legacy getoptions
VERSION="Mush 0.1.0 (2023-09-07)"

parser_definition() {
setup REST help:usage abbr:true -- "Shell's build system" ''
setup REST error:args_error help:usage abbr:true -- "Shell's build system" ''

msg -- 'USAGE:' " ${2##*/} [OPTIONS] [SUBCOMMAND]" ''

Expand All @@ -56,6 +56,17 @@ parser_definition() {
cmd publish -- "Package and upload this package to the registry"
}

args_error() {
case "$2" in
notcmd)
console_error "no such command: '$3'\n\n View all available commands with 'mush --help'"
;;
*)
echo "ERROR: ($2) $1"
esac
exit 101
}

main() {
#echo "ARGS: $@"
#chmod +x target/debug/legacy/getoptions
Expand Down
13 changes: 12 additions & 1 deletion src/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ legacy getoptions
VERSION="Mush 0.1.0 (2023-09-07)"

parser_definition() {
setup REST help:usage abbr:true -- "Shell's build system" ''
setup REST error:args_error help:usage abbr:true -- "Shell's build system" ''

msg -- 'USAGE:' " ${2##*/} [OPTIONS] [SUBCOMMAND]" ''

Expand All @@ -35,6 +35,17 @@ parser_definition() {
cmd publish -- "Package and upload this package to the registry"
}

args_error() {
case "$2" in
notcmd)
console_error "no such command: '$3'\n\n\tView all available commands with 'mush --help'"
;;
*)
echo "ERROR: ($2) $1"
esac
exit 101
}

main() {
#echo "ARGS: $@"
#chmod +x target/debug/legacy/getoptions
Expand Down
13 changes: 12 additions & 1 deletion target/dist/mush
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ legacy getoptions
VERSION="Mush 0.1.0 (2023-09-07)"

parser_definition() {
setup REST help:usage abbr:true -- "Shell's build system" ''
setup REST error:args_error help:usage abbr:true -- "Shell's build system" ''

msg -- 'USAGE:' " ${2##*/} [OPTIONS] [SUBCOMMAND]" ''

Expand All @@ -56,6 +56,17 @@ parser_definition() {
cmd publish -- "Package and upload this package to the registry"
}

args_error() {
case "$2" in
notcmd)
console_error "no such command: '$3'\n\n View all available commands with 'mush --help'"
;;
*)
echo "ERROR: ($2) $1"
esac
exit 101
}

main() {
#echo "ARGS: $@"
#chmod +x target/debug/legacy/getoptions
Expand Down
13 changes: 12 additions & 1 deletion target/dist/mush.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ legacy getoptions
VERSION="Mush 0.1.0 (2023-09-07)"

parser_definition() {
setup REST help:usage abbr:true -- "Shell's build system" ''
setup REST error:args_error help:usage abbr:true -- "Shell's build system" ''

msg -- 'USAGE:' " ${2##*/} [OPTIONS] [SUBCOMMAND]" ''

Expand All @@ -56,6 +56,17 @@ parser_definition() {
cmd publish -- "Package and upload this package to the registry"
}

args_error() {
case "$2" in
notcmd)
console_error "no such command: '$3'\n\n View all available commands with 'mush --help'"
;;
*)
echo "ERROR: ($2) $1"
esac
exit 101
}

main() {
#echo "ARGS: $@"
#chmod +x target/debug/legacy/getoptions
Expand Down
13 changes: 12 additions & 1 deletion target/dist/mush.tmp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ legacy getoptions
VERSION="Mush 0.1.0 (2023-09-07)"

parser_definition() {
setup REST help:usage abbr:true -- "Shell's build system" ''
setup REST error:args_error help:usage abbr:true -- "Shell's build system" ''

msg -- 'USAGE:' " ${2##*/} [OPTIONS] [SUBCOMMAND]" ''

Expand All @@ -56,6 +56,17 @@ parser_definition() {
cmd publish -- "Package and upload this package to the registry"
}

args_error() {
case "$2" in
notcmd)
console_error "no such command: '$3'\n\n View all available commands with 'mush --help'"
;;
*)
echo "ERROR: ($2) $1"
esac
exit 101
}

main() {
#echo "ARGS: $@"
#chmod +x target/debug/legacy/getoptions
Expand Down
10 changes: 10 additions & 0 deletions tests/bare/command-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -e

echo "==> Build: mush"
cp target/debug/mush target/debug/mush.sh
bash target/debug/mush.sh build
echo ""

echo "==> Test: no such command"
bash target/debug/mush.sh nosuchcommand

0 comments on commit 1d4abce

Please sign in to comment.