@@ -206,7 +206,7 @@ namespace cli
206
206
{
207
207
if (!enabled) return {};
208
208
if (name.rfind (line, 0 ) == 0 ) return {name}; // name starts_with line
209
- else return {};
209
+ return {};
210
210
}
211
211
protected:
212
212
const std::string& Name () const { return name; }
@@ -244,7 +244,7 @@ namespace cli
244
244
{
245
245
public:
246
246
CliSession (Cli& _cli, std::ostream& _out, std::size_t historySize = 100 );
247
- virtual ~CliSession () { cli. UnRegister (out); }
247
+ virtual ~CliSession () { Cli:: UnRegister (out); }
248
248
249
249
// disable value semantics
250
250
CliSession (const CliSession&) = delete ;
@@ -419,11 +419,12 @@ namespace cli
419
419
420
420
bool ScanCmds (const std::vector<std::string>& cmdLine, CliSession& session)
421
421
{
422
- if (!IsEnabled ()) return false ;
422
+ if (!IsEnabled ())
423
+ return false ;
423
424
for (auto & cmd: *cmds)
424
- if (cmd->Exec (cmdLine, session)) return true ;
425
- if (parent && parent-> Exec (cmdLine, session)) return true ;
426
- return false ;
425
+ if (cmd->Exec (cmdLine, session))
426
+ return true ;
427
+ return (parent && parent-> Exec (cmdLine, session)) ;
427
428
}
428
429
429
430
std::string Prompt () const
@@ -436,7 +437,8 @@ namespace cli
436
437
if (!IsEnabled ()) return ;
437
438
for (const auto & cmd: *cmds)
438
439
cmd->Help (out);
439
- if (parent) parent->Help (out);
440
+ if (parent != nullptr )
441
+ parent->Help (out);
440
442
}
441
443
442
444
void Help (std::ostream& out) const override
@@ -452,7 +454,7 @@ namespace cli
452
454
std::vector<std::string> GetCompletions (const std::string& currentLine) const
453
455
{
454
456
auto result = cli::GetCompletions (cmds, currentLine);
455
- if (parent)
457
+ if (parent != nullptr )
456
458
{
457
459
auto c = parent->GetCompletionRecursive (currentLine);
458
460
result.insert (result.end (), std::make_move_iterator (c.begin ()), std::make_move_iterator (c.end ()));
@@ -677,7 +679,7 @@ namespace cli
677
679
{
678
680
history.LoadCommands (cli.GetCommands ());
679
681
680
- cli. Register (out);
682
+ Cli:: Register (out);
681
683
globalScopeMenu->Insert (
682
684
" help" ,
683
685
[this ](std::ostream&){ Help (); },
@@ -727,8 +729,6 @@ namespace cli
727
729
<< cmd
728
730
<< " \"\n " ;
729
731
}
730
-
731
- return ;
732
732
}
733
733
734
734
inline void CliSession::Prompt ()
0 commit comments