@@ -140,15 +140,39 @@ void InnerInvoke(IEnumerable<Switch> switches, EnvironmentSettings environmentSe
140
140
&& ! CanBeResolvedFromEnvironmentSettings ( environmentSettings , p ) )
141
141
. ToList ( ) ;
142
142
143
+ var optionalParamtersNotSpecified = Parameters
144
+ . Where ( p => p . Optional
145
+ && ! CanBeResolvedFromSwitches ( switches , p )
146
+ && ! CanBeResolvedFromEnvironmentSettings ( environmentSettings , p ) )
147
+ . ToList ( ) ;
148
+
143
149
if ( requiredParametersMissing . Any ( ) )
144
150
{
145
151
var requiredParametersMissingString = string . Join ( Environment . NewLine ,
146
152
requiredParametersMissing . Select ( p => $ " { _settings . SwitchPrefix } { p . Name } - { p . DescriptionText } ") ) ;
147
153
148
- throw new GoCommandoException (
149
- $@ "The following required parameters are missing:
154
+ var text = $@ "The following required parameters are missing:
155
+
156
+ { requiredParametersMissingString } ";
157
+
158
+ if ( optionalParamtersNotSpecified . Any ( ) )
159
+ {
160
+ var optionalParamtersNotSpecifiedString = string . Join ( Environment . NewLine ,
161
+ optionalParamtersNotSpecified . Select ( p => $ " { _settings . SwitchPrefix } { p . Name } - { p . DescriptionText } ") ) ;
162
+
163
+ var moreText = $@ "The following optional parameters are also available:
164
+
165
+ { optionalParamtersNotSpecifiedString } ";
166
+
167
+ throw new GoCommandoException ( string . Concat (
168
+ text ,
169
+ Environment . NewLine ,
170
+ Environment . NewLine ,
171
+ moreText
172
+ ) ) ;
173
+ }
150
174
151
- { requiredParametersMissingString } " ) ;
175
+ throw new GoCommandoException ( text ) ;
152
176
}
153
177
154
178
var switchesWithoutMathingParameter = switches
0 commit comments