mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Bug #902 - 'task version' requires a .taskrc
- Added special case support for '--version' which bypasses all configuration. Not documented. For extension prgorams like 'taskhelm', that need to determine whether taskwarrior is sufficiently current.
This commit is contained in:
parent
15d25d4fdf
commit
fe467640ca
1 changed files with 21 additions and 13 deletions
34
src/main.cpp
34
src/main.cpp
|
@ -46,6 +46,7 @@ Context context;
|
|||
#define srand(x) srandom(x)
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int main (int argc, const char** argv)
|
||||
{
|
||||
// Set up randomness.
|
||||
|
@ -59,23 +60,30 @@ int main (int argc, const char** argv)
|
|||
|
||||
int status = 0;
|
||||
|
||||
try
|
||||
if (argc == 2 && !strcmp (argv[1], "--version"))
|
||||
{
|
||||
status = context.initialize (argc, argv);
|
||||
if (status == 0)
|
||||
status = context.run ();
|
||||
std::cout << VERSION << "\n";
|
||||
}
|
||||
|
||||
catch (std::string& error)
|
||||
else
|
||||
{
|
||||
std::cout << error << "\n";
|
||||
status = -1;
|
||||
}
|
||||
try
|
||||
{
|
||||
status = context.initialize (argc, argv);
|
||||
if (status == 0)
|
||||
status = context.run ();
|
||||
}
|
||||
|
||||
catch (...)
|
||||
{
|
||||
std::cerr << STRING_UNKNOWN_ERROR << "\n";
|
||||
status = -2;
|
||||
catch (std::string& error)
|
||||
{
|
||||
std::cout << error << "\n";
|
||||
status = -1;
|
||||
}
|
||||
|
||||
catch (...)
|
||||
{
|
||||
std::cerr << STRING_UNKNOWN_ERROR << "\n";
|
||||
status = -2;
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue