src/developer/debug/zxdb/console/console_main.cc
// Loads any actions specified on the command line into the vector.
Loads any actions specified on the command line into the vector.
Loads any actions specified on the command line into the vector .
Err SetupActions(const CommandLineOptions& options, std::vector<Action>* actions) {
  if (options.core) {
    if (options.connect || options.run) {
      return Err("--core can't be used with commands to connect or run.");
    }
    std::string cmd = VerbToString(Verb::kOpenDump) + " " + *options.core;
    actions->push_back(Action("Open Dump", [cmd](const Action&, const Session&, Console* console) {
      console->ProcessInputLine(cmd.c_str(), ActionFlow::PostActionCallback);
    }));
  }
  if (options.connect) {
    std::string cmd = "connect " + *options.connect;
    actions->push_back(Action("Connect", [cmd](const Action&, const Session&, Console* console) {
      console->ProcessInputLine(cmd.c_str(), ActionFlow::PostActionCallback);
    }));
  }
  if (options.unix_connect) {
    std::string cmd = "connect -u " + *options.unix_connect;
    actions->push_back(Action("Connect", [cmd](const Action&, const Session&, Console* console) {
      console->ProcessInputLine(cmd.c_str(), ActionFlow::PostActionCallback);
    }));
  }
  if (options.run) {
    std::string cmd = "run " + *options.run;
    actions->push_back(Action("Run", [cmd](const Action&, const Session&, Console* console) {
      console->ProcessInputLine(cmd.c_str(), ActionFlow::PostActionCallback);
    }));
  }
  if (options.script_file) {
    Err err = ScriptFileToActions(*options.script_file, actions);
    if (err.has_error())
      return err;
  }
  for (const auto& filter : options.filter) {
    std::string cmd = "filter attach " + filter;
    actions->push_back(Action("Filter", [cmd](const Action&, const Session&, Console* console) {
      console->ProcessInputLine(cmd.c_str(), ActionFlow::PostActionCallback);
    }));
  }
  return Err();
}
Err SetupActions ( const CommandLineOptions & options , std :: vector < Action > * actions ) { if ( options . core ) { if ( options . connect || options . run ) { return Err ( " " ) ; } std :: string cmd = VerbToString ( Verb :: kOpenDump ) + " " + * options . core ; actions -> push_back ( Action ( " " , [ cmd ] ( const Action & , const Session & , Console * console ) { console -> ProcessInputLine ( cmd . c_str ( ) , ActionFlow :: PostActionCallback ) ; } ) ) ; } if ( options . connect ) { std :: string cmd = " " + * options . connect ; actions -> push_back ( Action ( " " , [ cmd ] ( const Action & , const Session & , Console * console ) { console -> ProcessInputLine ( cmd . c_str ( ) , ActionFlow :: PostActionCallback ) ; } ) ) ; } if ( options . unix_connect ) { std :: string cmd = " " + * options . unix_connect ; actions -> push_back ( Action ( " " , [ cmd ] ( const Action & , const Session & , Console * console ) { console -> ProcessInputLine ( cmd . c_str ( ) , ActionFlow :: PostActionCallback ) ; } ) ) ; } if ( options . run ) { std :: string cmd = " " + * options . run ; actions -> push_back ( Action ( " " , [ cmd ] ( const Action & , const Session & , Console * console ) { console -> ProcessInputLine ( cmd . c_str ( ) , ActionFlow :: PostActionCallback ) ; } ) ) ; } if ( options . script_file ) { Err err = ScriptFileToActions ( * options . script_file , actions ) ; if ( err . has_error ( ) ) return err ; } for ( const auto & filter : options . filter ) { std :: string cmd = " " + filter ; actions -> push_back ( Action ( " " , [ cmd ] ( const Action & , const Session & , Console * console ) { console -> ProcessInputLine ( cmd . c_str ( ) , ActionFlow :: PostActionCallback ) ; } ) ) ; } return Err ( ) ; }
Loads any actions specified on the command line into the vector.
Loads any actions specified on the command line into the vector .