void pragma_environment_add::run(
  const data::command::iterator& args_begin_,
  const data::command::iterator& args_end_,
  iface::displayer& displayer_
) const
{
  const std::string cmd = tokens_to_string(args_begin_, args_end_);

  _shell.store_in_buffer(cmd, displayer_);

  if (is_environment_setup_command(args_begin_, args_end_))
  {
    displayer_.show_comment(
      data::text(
        "You don't need the environment add pragma to add this to the"
        " environment. The following command does this as well:"
      )
    );
    displayer_.show_cpp_code(cmd);
  }
  else
  {
    displayer_.show_comment(
      data::text(
        "Metashell (incorrectly) thinks that this command should execute a"
        " metaprogram and would not add it to the environment without using"
        " the \"environment add\" pragma. Please file a bug report containing"
        " this command (" + cmd + ") at"
        " https://github.com/sabel83/metashell/issues. Thank you."
      )
    );
  }
}
예제 #2
0
void pragma_macros::run(iface::displayer& displayer_) const
{
  displayer_.show_cpp_code(_shell.engine().macros(_shell.env()));
}