diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 11:09:23 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 11:09:23 +0000 |
| commit | f73363f1dd94996356cefbf24388f561891acf0b (patch) | |
| tree | e3c31248bdb36eaec5fd833490d4278162dba2a0 /source/Interpreter/CommandAlias.cpp | |
| parent | 160ee69dd7ae18978f4068116777639ea98dc951 (diff) | |
Notes
Diffstat (limited to 'source/Interpreter/CommandAlias.cpp')
| -rw-r--r-- | source/Interpreter/CommandAlias.cpp | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/source/Interpreter/CommandAlias.cpp b/source/Interpreter/CommandAlias.cpp index 2db7460611ca..a4b0a0c55c0e 100644 --- a/source/Interpreter/CommandAlias.cpp +++ b/source/Interpreter/CommandAlias.cpp @@ -40,12 +40,17 @@ static bool ProcessAliasOptionsArgs(lldb::CommandObjectSP &cmd_obj_sp, ExecutionContext exe_ctx = cmd_obj_sp->GetCommandInterpreter().GetExecutionContext(); options->NotifyOptionParsingStarting(&exe_ctx); - args.Unshift(llvm::StringRef("dummy_arg")); - options_string = args.ParseAliasOptions(*options, result, option_arg_vector, - options_args); - args.Shift(); - if (result.Succeeded()) - options->VerifyPartialOptions(result); + + llvm::Expected<Args> args_or = + options->ParseAlias(args, option_arg_vector, options_string); + if (!args_or) { + result.AppendError(toString(args_or.takeError())); + result.AppendError("Unable to create requested alias.\n"); + result.SetStatus(eReturnStatusFailed); + return false; + } + args = std::move(*args_or); + options->VerifyPartialOptions(result); if (!result.Succeeded() && result.GetStatus() != lldb::eReturnStatusStarted) { result.AppendError("Unable to create requested alias.\n"); @@ -109,26 +114,17 @@ bool CommandAlias::WantsCompletion() { return false; } -int CommandAlias::HandleCompletion(Args &input, int &cursor_index, - int &cursor_char_position, - int match_start_point, - int max_return_elements, bool &word_complete, - StringList &matches) { +int CommandAlias::HandleCompletion(CompletionRequest &request) { if (IsValid()) - return m_underlying_command_sp->HandleCompletion( - input, cursor_index, cursor_char_position, match_start_point, - max_return_elements, word_complete, matches); + return m_underlying_command_sp->HandleCompletion(request); return -1; } int CommandAlias::HandleArgumentCompletion( - Args &input, int &cursor_index, int &cursor_char_position, - OptionElementVector &opt_element_vector, int match_start_point, - int max_return_elements, bool &word_complete, StringList &matches) { + CompletionRequest &request, OptionElementVector &opt_element_vector) { if (IsValid()) return m_underlying_command_sp->HandleArgumentCompletion( - input, cursor_index, cursor_char_position, opt_element_vector, - match_start_point, max_return_elements, word_complete, matches); + request, opt_element_vector); return -1; } @@ -191,8 +187,8 @@ bool CommandAlias::IsDashDashCommand() { } } - // if this is a nested alias, it may be adding arguments on top of an - // already dash-dash alias + // if this is a nested alias, it may be adding arguments on top of an already + // dash-dash alias if ((m_is_dashdash_alias == eLazyBoolNo) && IsNestedAlias()) m_is_dashdash_alias = (GetUnderlyingCommand()->IsDashDashCommand() ? eLazyBoolYes @@ -223,8 +219,7 @@ std::pair<lldb::CommandObjectSP, OptionArgVectorSP> CommandAlias::Desugar() { } // allow CommandAlias objects to provide their own help, but fallback to the -// info -// for the underlying command if no customization has been provided +// info for the underlying command if no customization has been provided void CommandAlias::SetHelp(llvm::StringRef str) { this->CommandObject::SetHelp(str); m_did_set_help = true; |
