@@ -155,13 +155,17 @@ QString cmd::Start::description() const
155
155
156
156
mp::ParseCode cmd::Start::parse_args (mp::ArgParser* parser)
157
157
{
158
- parser->addPositionalArgument (
159
- " name" ,
160
- QString{" Names of instances to start. If omitted, and without the --all option, '%1' (the configured primary "
161
- " instance name) will be assumed. If '%1' does not exist but is included in a successful start command "
162
- " (either implicitly or explicitly), it is launched automatically (see `launch` for more info)." }
163
- .arg (petenv_name),
164
- " [<name> ...]" );
158
+ const auto & [description, syntax] =
159
+ petenv_name.isEmpty ()
160
+ ? std::make_pair (QString{" Names of instances to start." }, QString{" <name> [<name> ...]" })
161
+ : std::make_pair (QString{" Names of instances to start. If omitted, and without the --all option, '%1' (the "
162
+ " configured primary instance name) will be assumed. If '%1' does not exist but is "
163
+ " included in a successful start command either implicitly or explicitly), it is "
164
+ " launched automatically (see `launch` for more info)." }
165
+ .arg (petenv_name),
166
+ QString{" [<name> ...]" });
167
+
168
+ parser->addPositionalArgument (" name" , description, syntax);
165
169
166
170
QCommandLineOption all_option (all_option_name, " Start all instances" );
167
171
parser->addOption (all_option);
@@ -173,9 +177,14 @@ mp::ParseCode cmd::Start::parse_args(mp::ArgParser* parser)
173
177
if (status != ParseCode::Ok)
174
178
return status;
175
179
176
- auto parse_code = check_for_name_and_all_option_conflict (parser, cerr, /* allow_empty=*/ true );
180
+ auto parse_code = check_for_name_and_all_option_conflict (parser, cerr, /* allow_empty=*/ !petenv_name. isEmpty () );
177
181
if (parse_code != ParseCode::Ok)
182
+ {
183
+ if (petenv_name.isEmpty () && parser->positionalArguments ().isEmpty ())
184
+ fmt::print (cerr, " Note: the primary instance is disabled.\n " );
185
+
178
186
return parse_code;
187
+ }
179
188
180
189
try
181
190
{
0 commit comments