Skip to content

Commit 729a558

Browse files
committed
fix: Error on unimplemented flags
1 parent 0fc85d3 commit 729a558

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

pkg/lib/traverse-get.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ bash_object.traverse-get() {
3939
return
4040
fi
4141

42+
if [ "$flag_as_what" = 'as-ref' ]; then
43+
bash_object.util.die 'ERROR_ARGUMENTS_INVALID' "--as-ref not implemented"
44+
fi
45+
4246
# Ensure correct number of arguments have been passed
4347
if (( ${#args[@]} != 3)); then
4448
bash_object.util.die 'ERROR_ARGUMENTS_INVALID' "Expected '3' arguments, but received '${#args[@]}'"

pkg/lib/traverse-set.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ bash_object.traverse-set() {
3737
return
3838
fi
3939

40+
if [ "$flag_pass_by_what" = 'by-value' ]; then
41+
bash_object.util.die 'ERROR_ARGUMENTS_INVALID' "--by-value not implemented"
42+
fi
43+
4044
local final_value_type root_object_name filter final_value
4145
# `set -u` compat
4246
if [ -n "${args[0]+x}" ]; then

tests/errors-required-flags.bats

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ load './util/init.sh'
1919
assert_line -p "Flags '--as-ref' and '--as-value' are mutually exclusive"
2020
}
2121

22+
@test "error on unimplemented --as-ref" {
23+
run bobject get-string --as-ref
24+
25+
assert_failure
26+
assert_line -p 'ERROR_ARGUMENTS_INVALID'
27+
assert_line -p "--as-ref not implemented"
28+
}
29+
2230
# set
2331
@test "set errors on missing flags" {
2432
run bobject set-string
@@ -35,3 +43,11 @@ load './util/init.sh'
3543
assert_line -p 'ERROR_ARGUMENTS_INVALID'
3644
assert_line -p "Flags '--by-ref' and '--by-value' are mutually exclusive"
3745
}
46+
47+
@test "error on unimplemented --by-value" {
48+
run bobject set-string --by-value
49+
50+
assert_failure
51+
assert_line -p 'ERROR_ARGUMENTS_INVALID'
52+
assert_line -p "--by-value not implemented"
53+
}

0 commit comments

Comments
 (0)