Disallowing tasksh to start in interactive mode (not in batch mode) if no ~/.taskrc exists

This commit is contained in:
Haitham Gad 2013-04-28 22:04:33 -04:00 committed by Paul Beckingham
parent f6ef9249b8
commit 6981893a2e

View file

@ -94,27 +94,34 @@ int main (int argc, const char** argv)
}
}
// if a file is given, read from it
// If a file is given, read from it
std::ifstream fin;
if (read_from_file)
{
fin.open (argv[1]);
}
// commands may be redirected too
// Commands may be redirected too
std::istream &in = read_from_file ? fin : std::cin;
// Begining initilaization
context.initialize (0, NULL);
if (Readline::interactiveMode (in))
{
// Begining initilaization
if (context.initialize (0, NULL))
{
return -1;
}
// Display some kind of welcome message.
Color bold (Color::nocolor, Color::nocolor, false, true, false);
// Display some kind of welcome message.
Color bold (Color::nocolor, Color::nocolor, false, true, false);
std::cout << (context.color () ? bold.colorize (PACKAGE_STRING) : PACKAGE_STRING)
<< " shell\n\n"
<< STRING_CMD_SHELL_HELP1 << '\n'
<< STRING_CMD_SHELL_HELP2 << '\n'
<< STRING_CMD_SHELL_HELP3 << "\n\n";
std::cout << (context.color () ? bold.colorize (PACKAGE_STRING)
: PACKAGE_STRING)
<< " shell\n\n"
<< STRING_CMD_SHELL_HELP1 << '\n'
<< STRING_CMD_SHELL_HELP2 << '\n'
<< STRING_CMD_SHELL_HELP3 << "\n\n";
}
// Make a copy because context.clear will delete them.
std::string permanent_overrides;