22
33> # {{ full_name }}
44>
5+ > {{ help.for_markdown }}
6+ >
7+
8+ attributes = version || alt.any? || default || extensible
59
6- if alt.any?
7- > **Alias:** {{ alt.join ', ' }}
10+ if attributes
11+ > | Attributes |
12+ > |------------------|-------------
13+ if version
14+ > | Version: | {{ version }}
15+ end
16+ if alt.any?
17+ > | Alias: | {{ alt.join ', ' }}
18+ end
19+ if default
20+ > | Default Command: | ✓ Yes
21+ end
22+ if extensible
23+ > | Extensible: | {{ extensible.is_a?(String) ? extensible : "✓ Yes" }}
24+ end
825 >
926end
1027
11- > {{ help }}
12- >
13-
1428# === Usage
1529
1630> ## Usage
1731>
18- > `{{ usage_string }}`
32+ > ```bash
33+ > {{ usage_string.for_markdown }}
34+ > ```
1935>
2036
2137# === Examples
@@ -24,7 +40,9 @@ if examples
2440 > ## Examples
2541 >
2642 examples.each do |example|
27- > - `{{ example }}`
43+ > ```bash
44+ > {{ example }}
45+ > ```
2846 end
2947 >
3048end
@@ -35,23 +53,38 @@ if dependencies.any?
3553 > ## Dependencies
3654 >
3755 dependencies.each do |dependency|
38- > - {{ dependency.commands.join ' or ' }}
56+ > #### *{{ dependency.commands.join ', ' }}*
57+ >
58+ > {{ dependency.help&.for_markdown }}
59+ >
3960 end
40- >
4161end
4262
4363# === Environment Variables
4464
45- if environment_variables .any?
65+ if public_environment_variables .any?
4666 > ## Environment Variables
4767 >
48- = "<dl>"
49- environment_variables.each do |environment_variable|
50- = " <dt>#{environment_variable.usage_string}</dt>"
51- = " <dd>#{environment_variable.help}</dd>"
68+ public_environment_variables.each do |environment_variable|
69+ attributes = environment_variable.required || environment_variable.default
70+
71+ > #### *{{ environment_variable.name.upcase }}*
72+ >
73+ > {{ environment_variable.help.for_markdown }}
74+ >
75+
76+ if attributes
77+ > | Attributes |
78+ > |-----------------|-------------
79+ if environment_variable.required
80+ > | Required: | ✓ Yes
81+ end
82+ if environment_variable.default
83+ > | Default Value: | {{ environment_variable.default }}
84+ end
85+ >
86+ end
5287 end
53- = "</dl>"
54- >
5588end
5689
5790# === Commands
@@ -61,7 +94,7 @@ if commands.any?
6194 > ## {{ group.gsub(/:$/, '') }}
6295 >
6396 commands.each do |subcommand|
64- > - [{{ subcommand.name }}]({{ subcommand.full_name }}) - {{ subcommand.summary }}
97+ > - [{{ subcommand.name }}]({{ subcommand.full_name }}) - {{ subcommand.summary.for_markdown }}
6598 end
6699 >
67100 end
72105if args.any?
73106 > ## Arguments
74107 >
75- = "<dl>"
76108 args.each do |arg|
77- = " <dt>#{arg.name}</dt>"
78- = " <dd>#{arg.help}</dd>"
109+ attributes = arg.required || arg.repeatable || arg.default || arg.allowed
110+
111+ > #### *{{ arg.name.upcase }}*
112+ >
113+ > {{ arg.help.for_markdown }}
114+ >
115+
116+ if attributes
117+ > | Attributes |
118+ > |-----------------|-------------
119+ if arg.required
120+ > | Required: | ✓ Yes
121+ end
122+ if arg.repeatable
123+ > | Repeatable: | ✓ Yes
124+ end
125+ if arg.default
126+ > | Default Value: | {{ arg.default }}
127+ end
128+ if arg.allowed
129+ > | Allowed Values: | {{ arg.allowed.join(', ') }}
130+ end
131+ >
132+ end
133+ end
134+
135+ if catch_all.label && catch_all.help
136+ > #### *{{ catch_all.label }}*
137+ >
138+ > {{ catch_all.help&.for_markdown }}
139+ >
140+ if catch_all.required?
141+ > | Attributes |
142+ > |------------|-------------
143+ > | Required: | ✓ Yes
144+ end
79145 end
80- = "</dl>"
81- >
82146end
83147
84148# === Flags
85149
86150if flags.any?
87151 > ## Options
88152 >
89- = "<dl>"
90153 flags.each do |flag|
91- = " <dt>#{flag.usage_string extended: true}</dt>"
92- = " <dd>#{flag.help}</dd>"
154+ attributes = flag.required || flag.repeatable || flag.default || flag.allowed || flag.conflicts
155+
156+ > #### *{{ flag.usage_string }}*
157+ >
158+ > {{ flag.help.for_markdown }}
159+ >
160+
161+ if attributes
162+ > | Attributes |
163+ > |-----------------|-------------
164+ if flag.required
165+ > | Required: | ✓ Yes
166+ end
167+ if flag.repeatable
168+ > | Repeatable: | ✓ Yes
169+ end
170+ if flag.default
171+ > | Default Value: | {{ flag.default }}
172+ end
173+ if flag.allowed
174+ > | Allowed Values: | {{ flag.allowed.join(', ') }}
175+ end
176+ if flag.conflicts
177+ > | Conflicts With: | *{{ flag.conflicts.join(', ') }}*
178+ end
179+ >
180+ end
93181 end
94- = "</dl>"
95- >
96182end
0 commit comments