|
| 1 | +# === Header |
| 2 | + |
| 3 | +> # {{ full_name }} |
| 4 | +> |
| 5 | +> {{ help.for_markdown }} |
| 6 | +> |
| 7 | + |
| 8 | +attributes = version || alt.any? || default || extensible |
| 9 | + |
| 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 |
| 25 | + > |
| 26 | +end |
| 27 | + |
| 28 | +# === Usage |
| 29 | + |
| 30 | +> ## Usage |
| 31 | +> |
| 32 | +> ```bash |
| 33 | +> {{ usage_string.for_markdown }} |
| 34 | +> ``` |
| 35 | +> |
| 36 | + |
| 37 | +# === Examples |
| 38 | + |
| 39 | +if examples |
| 40 | + > ## Examples |
| 41 | + > |
| 42 | + examples.each do |example| |
| 43 | + > ```bash |
| 44 | + > {{ example }} |
| 45 | + > ``` |
| 46 | + > |
| 47 | + end |
| 48 | +end |
| 49 | + |
| 50 | +# === Dependencies |
| 51 | + |
| 52 | +if dependencies.any? |
| 53 | + > ## Dependencies |
| 54 | + > |
| 55 | + dependencies.each do |dependency| |
| 56 | + > #### *{{ dependency.commands.join ', ' }}* |
| 57 | + > |
| 58 | + > {{ dependency.help&.for_markdown }} |
| 59 | + > |
| 60 | + end |
| 61 | +end |
| 62 | + |
| 63 | +# === Environment Variables |
| 64 | + |
| 65 | +if visible_environment_variables.any? |
| 66 | + > ## Environment Variables |
| 67 | + > |
| 68 | + visible_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 |
| 87 | + end |
| 88 | +end |
| 89 | + |
| 90 | +# === Commands |
| 91 | + |
| 92 | +if commands.any? |
| 93 | + grouped_commands.each do |group, commands| |
| 94 | + > ## {{ group.gsub(/:$/, '') }} |
| 95 | + > |
| 96 | + commands.each do |subcommand| |
| 97 | + > - [{{ subcommand.name }}]({{ subcommand.full_name.gsub(' ', '%20') }}.md) - {{ subcommand.summary.for_markdown }} |
| 98 | + end |
| 99 | + > |
| 100 | + end |
| 101 | +end |
| 102 | + |
| 103 | +# === Arguments |
| 104 | + |
| 105 | +if args.any? |
| 106 | + > ## Arguments |
| 107 | + > |
| 108 | + args.each do |arg| |
| 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 | + > |
| 145 | + end |
| 146 | + end |
| 147 | +end |
| 148 | + |
| 149 | +# === Flags |
| 150 | + |
| 151 | +if flags.any? |
| 152 | + > ## Options |
| 153 | + > |
| 154 | + flags.each do |flag| |
| 155 | + attributes = flag.required || flag.repeatable || flag.default || |
| 156 | + flag.allowed || flag.conflicts || flag.needs |
| 157 | + |
| 158 | + > #### *{{ flag.usage_string }}* |
| 159 | + > |
| 160 | + > {{ flag.help.for_markdown }} |
| 161 | + > |
| 162 | + |
| 163 | + if attributes |
| 164 | + > | Attributes | |
| 165 | + > |-----------------|------------- |
| 166 | + if flag.required |
| 167 | + > | Required: | ✓ Yes |
| 168 | + end |
| 169 | + if flag.repeatable |
| 170 | + > | Repeatable: | ✓ Yes |
| 171 | + end |
| 172 | + if flag.default |
| 173 | + > | Default Value: | {{ flag.default }} |
| 174 | + end |
| 175 | + if flag.allowed |
| 176 | + > | Allowed Values: | {{ flag.allowed.join(', ') }} |
| 177 | + end |
| 178 | + if flag.conflicts |
| 179 | + > | Conflicts With: | *{{ flag.conflicts.join(', ') }}* |
| 180 | + end |
| 181 | + if flag.needs |
| 182 | + > | Needs: | *{{ flag.needs.join(', ') }}* |
| 183 | + end |
| 184 | + > |
| 185 | + end |
| 186 | + end |
| 187 | +end |
| 188 | + |
| 189 | += x_markdown_footer&.for_manpage |
| 190 | +> |
0 commit comments