Skip to content

Commit 7697b8f

Browse files
committed
update mandoc and markdown renderers with flag.needs
1 parent 4d15e2b commit 7697b8f

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

lib/bashly/libraries/render/mandoc/mandoc.gtx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ if flags.any?
127127
if flag.conflicts
128128
> - Conflicts With: **{{ flag.conflicts.join(', ') }}**
129129
end
130+
if flag.needs
131+
> - Needs: **{{ flag.needs.join(', ') }}**
132+
end
130133
>
131134
end
132135
end

lib/bashly/libraries/render/markdown/markdown.gtx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ if flags.any?
152152
> ## Options
153153
>
154154
flags.each do |flag|
155-
attributes = flag.required || flag.repeatable || flag.default || flag.allowed || flag.conflicts
155+
attributes = flag.required || flag.repeatable || flag.default ||
156+
flag.allowed || flag.conflicts || flag.needs
156157

157158
> #### *{{ flag.usage_string }}*
158159
>
@@ -177,6 +178,9 @@ if flags.any?
177178
if flag.conflicts
178179
> | Conflicts With: | *{{ flag.conflicts.join(', ') }}*
179180
end
181+
if flag.needs
182+
> | Needs: | *{{ flag.needs.join(', ') }}*
183+
end
180184
>
181185
end
182186
end

spec/approvals/examples/needs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ skipped src/root_command.sh (exists)
44
created ./cli
55
run ./cli --help to test your bash script
66
+ ./cli -h
7-
cli - Sample application to demonstrate the use of conflicting flags
7+
cli - Sample application to demonstrate the use of needy flags
88

99
Usage:
1010
cli [OPTIONS]

0 commit comments

Comments
 (0)