mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Disallowing tasksh to start in interactive mode (not in batch mode) if no ~/.taskrc exists
This commit is contained in:
parent
f6ef9249b8
commit
6981893a2e
1 changed files with 18 additions and 11 deletions
|
@ -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;
|
std::ifstream fin;
|
||||||
if (read_from_file)
|
if (read_from_file)
|
||||||
{
|
{
|
||||||
fin.open (argv[1]);
|
fin.open (argv[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// commands may be redirected too
|
// Commands may be redirected too
|
||||||
std::istream &in = read_from_file ? fin : std::cin;
|
std::istream &in = read_from_file ? fin : std::cin;
|
||||||
|
|
||||||
|
if (Readline::interactiveMode (in))
|
||||||
|
{
|
||||||
// Begining initilaization
|
// Begining initilaization
|
||||||
context.initialize (0, NULL);
|
if (context.initialize (0, NULL))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// Display some kind of welcome message.
|
// Display some kind of welcome message.
|
||||||
Color bold (Color::nocolor, Color::nocolor, false, true, false);
|
Color bold (Color::nocolor, Color::nocolor, false, true, false);
|
||||||
|
|
||||||
std::cout << (context.color () ? bold.colorize (PACKAGE_STRING) : PACKAGE_STRING)
|
std::cout << (context.color () ? bold.colorize (PACKAGE_STRING)
|
||||||
|
: PACKAGE_STRING)
|
||||||
<< " shell\n\n"
|
<< " shell\n\n"
|
||||||
<< STRING_CMD_SHELL_HELP1 << '\n'
|
<< STRING_CMD_SHELL_HELP1 << '\n'
|
||||||
<< STRING_CMD_SHELL_HELP2 << '\n'
|
<< STRING_CMD_SHELL_HELP2 << '\n'
|
||||||
<< STRING_CMD_SHELL_HELP3 << "\n\n";
|
<< STRING_CMD_SHELL_HELP3 << "\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
// Make a copy because context.clear will delete them.
|
// Make a copy because context.clear will delete them.
|
||||||
std::string permanent_overrides;
|
std::string permanent_overrides;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue