@@ -81,13 +81,16 @@ static void InnerRun()
8181 {
8282 if ( command . Parameters . Any ( ) )
8383 {
84- Console . WriteLine ( @"Type
84+ Console . WriteLine ( @"{0}
85+
86+ Type
8587
86- {0 } {1 } <args>
88+ {1 } {2 } <args>
8789
8890where <args> can consist of the following parameters:
8991
90- {2}" ,
92+ {3}" ,
93+ command . Description ,
9194exe ,
9295command . Command ,
9396string . Join ( Environment . NewLine , command . Parameters . Select ( parameter => FormatParameter ( parameter , settings ) ) ) ) ;
@@ -102,13 +105,11 @@ static void InnerRun()
102105 }
103106 return ;
104107 }
105- else
106- {
107- Console . WriteLine ( "Unknown command '{0}'" , helpSwitch . Value ) ;
108- }
108+
109+ throw new GoCommandoException ( $ "Unknown command: '{ helpSwitch . Value } '") ;
109110 }
110111
111- var availableCommands = string . Join ( Environment . NewLine , commandTypes . Select ( c => " " + c . Command ) ) ;
112+ var availableCommands = string . Join ( Environment . NewLine , commandTypes . Select ( c => $ " { c . Command } - { c . Description } " ) ) ;
112113
113114 Console . WriteLine ( $@ "The following commands are available:
114115
@@ -157,30 +158,32 @@ static string FormatParameter(Parameter parameter, Settings settings)
157158 additionalProperties . Add ( "optional" ) ;
158159 }
159160
160- var additionalPropertiesText = additionalProperties . Any ( ) ? $ " ({ string . Join ( "/" , additionalProperties ) } )" : "" ;
161+ var additionalPropertiesText = additionalProperties . Any ( )
162+ ? $ " ({ string . Join ( "/" , additionalProperties ) } )"
163+ : "" ;
161164
162- var helpText = parameter . DescriptionText ?? "" ;
165+ var helpText = " " + ( parameter . DescriptionText ?? "(no help text available)" ) ;
163166
164167 var examplesText = ! parameter . ExampleValues . Any ( )
165168 ? ""
166169 : FormatExamples ( parameter , settings ) ;
167170
168- return $@ " { settings . SwitchPrefix } { parameter . Name } { shorthand } { additionalPropertiesText }
171+ var switchText = $ " { settings . SwitchPrefix } { parameter . Name } { shorthand } { additionalPropertiesText } " ;
169172
173+ return $@ " { switchText }
170174{ helpText }
171- { examplesText }
172- " ;
175+ { examplesText } ";
173176 }
174177
175178 static string FormatExamples ( Parameter parameter , Settings settings )
176179 {
177180 var examples = string . Join ( Environment . NewLine , parameter . ExampleValues
178- . Select ( e => $ " { settings . SwitchPrefix } { parameter . Name } { e } ") ) ;
181+ . Select ( e => $ " { settings . SwitchPrefix } { parameter . Name } { e } ") ) ;
179182
180183 return $@ "
181- Examples:
182-
183- { examples } ";
184+ Examples:
185+ { examples }
186+ " ;
184187 }
185188
186189 internal static List < CommandInvoker > GetCommands ( Settings settings )
0 commit comments