From ef5651d93fd6468182356ab55d703771b33884e0 Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Tue, 12 Feb 2013 18:52:24 +0000 Subject: Added a new "env" regular expression alias. If "env" is typed on its own "settings show target.env-vars" will be run. Otherwise it can be used to set and environment variable: "env FOO=BAR". llvm-svn: 174991 --- lldb/source/Interpreter/CommandInterpreter.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp') diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 4ba0031806b..89ed5641acf 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -227,6 +227,12 @@ CommandInterpreter::Initialize () AddAlias ("list", cmd_obj_sp); } + cmd_obj_sp = GetCommandSPExact ("_regexp-env", false); + if (cmd_obj_sp) + { + AddAlias ("env", cmd_obj_sp); + } + cmd_obj_sp = GetCommandSPExact ("memory read", false); if (cmd_obj_sp) AddAlias ("x", cmd_obj_sp); @@ -600,6 +606,21 @@ CommandInterpreter::LoadCommandDictionary () } } + std::auto_ptr + env_regex_cmd_ap(new CommandObjectRegexCommand (*this, + "_regexp-env", + "Implements a shortcut to viewing and setting environment variables.", + "_regexp-env\n_regexp-env FOO=BAR", 2)); + if (env_regex_cmd_ap.get()) + { + if (env_regex_cmd_ap->AddRegexCommand("^$", "settings show target.env-vars") && + env_regex_cmd_ap->AddRegexCommand("^([A-Za-z_][A-Za-z_0-9]*=.*)$", "settings set target.env-vars %1")) + { + CommandObjectSP env_regex_cmd_sp(env_regex_cmd_ap.release()); + m_command_dict[env_regex_cmd_sp->GetCommandName ()] = env_regex_cmd_sp; + } + } + } int -- cgit v1.2.3