Skip to content

Commit

Permalink
feat(extract-libjade.sh): Nice usage functions
Browse files Browse the repository at this point in the history
  • Loading branch information
koraa committed Aug 7, 2024
1 parent 9940633 commit 845c7b9
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions extract-libjade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,21 @@ print_usage() {
stderr " $ $call --gen-implementation IMPLEMENTATION DIRECTORY"
}

fatal_usage() {
if (( "$#" != 0 )); then
stderr "error:" "$@"
fi
print_usage
exit 1
}

main() {
call=$0
top_dir=$(cd "$(dirname "$0")" ; pwd -P) || exit 1

# if there are no arguments, print usage
if [ $# -eq 0 ]; then
print_usage
exit 1
fatal_usage
fi

# check if --list-implementations
Expand Down Expand Up @@ -84,9 +91,7 @@ main() {
exit 1;

else
stderr "error: --gen-implementation : number of required arguments 3 : provided $#"
print_usage
exit 1
fatal_usage "$0 --gen-implementation: number of required arguments 3 : provided $#"
fi
fi

Expand Down

0 comments on commit 845c7b9

Please sign in to comment.