mirror of
https://github.com/GothenburgBitFactory/taskshell.git
synced 2025-06-26 10:54:29 +02:00
configuration option to not show help in welcome
This commit is contained in:
parent
61dd5ea775
commit
d48909041d
2 changed files with 25 additions and 13 deletions
|
@ -143,6 +143,11 @@ The review command storeѕ a UDA ('reviewed') and report definition ('_reviewed'
|
|||
If set to "1", causes each tasksh command to be preceded by a 'clear screen' and
|
||||
cursor reset. Default is "0".
|
||||
|
||||
.TP
|
||||
.B tasksh.nohelp=1
|
||||
If set to "1", tasksh will not show the output of the 'help' command as part of
|
||||
its welcome message. Default is "0".
|
||||
|
||||
.SH "CREDITS & COPYRIGHTS"
|
||||
Copyright (C) 2006 \- 2017 P. Beckingham, F. Hernandez.
|
||||
|
||||
|
|
31
src/main.cpp
31
src/main.cpp
|
@ -52,9 +52,10 @@ std::string promptCompose ();
|
|||
std::string findTaskwarrior ();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
static void welcome ()
|
||||
static void welcome (bool noHelp)
|
||||
{
|
||||
std::cout << PACKAGE_STRING << "\n";
|
||||
if (! noHelp)
|
||||
cmdHelp ();
|
||||
}
|
||||
|
||||
|
@ -138,6 +139,20 @@ static int commandLoop (bool autoClear)
|
|||
return status;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
static bool getBoolFromTaskrc (const std::string& path)
|
||||
{
|
||||
std::string input;
|
||||
std::string output;
|
||||
execute ("task", {"_get", path}, input, output);
|
||||
output = lowerCase (output);
|
||||
return output == "true\n" ||
|
||||
output == "1\n" ||
|
||||
output == "y\n" ||
|
||||
output == "yes\n" ||
|
||||
output == "on\n" ;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int main (int argc, const char** argv)
|
||||
{
|
||||
|
@ -153,19 +168,11 @@ int main (int argc, const char** argv)
|
|||
try
|
||||
{
|
||||
// Get the Taskwarrior rc.tasksh.autoclear Boolean setting.
|
||||
bool autoClear = false;
|
||||
std::string input;
|
||||
std::string output;
|
||||
execute ("task", {"_get", "rc.tasksh.autoclear"}, input, output);
|
||||
output = lowerCase (output);
|
||||
autoClear = (output == "true\n" ||
|
||||
output == "1\n" ||
|
||||
output == "y\n" ||
|
||||
output == "yes\n" ||
|
||||
output == "on\n");
|
||||
bool autoClear = getBoolFromTaskrc("rc.tasksh.autoclear");
|
||||
bool noHelp = getBoolFromTaskrc("rc.tasksh.nohelp");
|
||||
|
||||
if (isatty (fileno (stdin)))
|
||||
welcome ();
|
||||
welcome (noHelp);
|
||||
|
||||
while ((status = commandLoop (autoClear)) == 0)
|
||||
;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue