Skip to content

Commit bb97fa0

Browse files
committed
attempt completion of #122
1 parent 07abef6 commit bb97fa0

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

lib/bashly/views/command/required_args_filter.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# :command.required_args_filter
22
% required_args.each do |arg|
3-
if [[ $1 && $1 != -* ]]; then
3+
if [[ -n ${1+x} && $1 != -* ]]; then
44
<%= arg.render(:validations).indent 2 %>
55
args[<%= arg.name %>]=$1
66
shift

spec/fixtures/workspaces/empty-args/src/bashly.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ commands:
99
- long: --flag
1010
arg: value
1111
args:
12-
- name: arg
12+
- name: required_arg
13+
required: true
14+
- name: optional_arg
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
echo "# this file is located in 'src/test_command.sh'"
2-
echo "# code for 'cli test' goes here"
3-
echo "# you can edit it freely and regenerate (it will not be overwritten)"
41
inspect_args

spec/fixtures/workspaces/empty-args/test.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@ bundle exec bashly generate
77

88
set -x
99

10+
./cli test a b --flag c
1011
./cli test ''
11-
./cli test --flag ''
12+
./cli test '' --flag ''
13+
./cli test '' '' --flag ''

0 commit comments

Comments
 (0)