Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
joelmccracken committed Dec 5, 2024
1 parent a8fffa8 commit 56f0b64
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion ws_tool/test/test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ setup (){
assert_equal "$WS_COMMAND" "doctor"
}

@test "process_cli_args parses the workstation name overriding current" {
@test "process_cli_args parses the workstation name overriding env var" {
export WORKSTATION_NAME=goofy
WS_COMMAND_ARGUMENTS=(-n foofy)
process_cli_args
Expand Down
15 changes: 6 additions & 9 deletions ws_tool/ws
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ process_cli_args() {
esac
done

[ -n "$WORKSTATION_NAME_ARG" ] && WORKSTATION_NAME="$WORKSTATION_NAME_ARG" :
[ -n "$WORKSTATION_NAME_ARG" ] && WORKSTATION_NAME="$WORKSTATION_NAME_ARG"

return 0
}

Expand All @@ -109,18 +110,14 @@ ws_main() {

process_cli_args "${WS_COMMAND_ARGUMENTS[@]}"

if [ -n "$WORKSTATION_SETTINGS_ARG" ]; then
. "$WORKSTATION_SETTINGS_FILE"
fi

if [ -n "$WORKSTATION_CONFIG_ARG" ]; then
. "$WORKSTATION_CONFIG_ARG"
fi

if [ "$WORKSTATION_VERBOSE" = "true" ]; then
set -x
fi

[ -n "$WORKSTATION_SETTINGS_ARG" ] && . "$WORKSTATION_SETTINGS_ARG"

[ -n "$WORKSTATION_CONFIG_ARG" ] && . "$WORKSTATION_CONFIG_ARG"

case "$WS_COMMAND" in
bootstrap) bootstrap_command;;
doctor) doctor_command;;
Expand Down

0 comments on commit 56f0b64

Please sign in to comment.