MythTV  master
mythshutdown/commandlineparser.cpp
Go to the documentation of this file.
1 #include <QString>
2 
3 #include "mythcorecontext.h"
4 #include "commandlineparser.h"
5 
9 
11 {
12  add("-l", "oldlock", false, "disable shutdown", "")
13  ->SetRemoved("Please use the full argument '--lock' instead.");
14 
15  addHelp();
16  addVersion();
17  addLogging("none", LOG_ERR);
18 
19  CommandLineArg::AllowOneOf( QList<CommandLineArg*>()
20  << add(QStringList{"-w", "--setwakeup"},
21  "setwakeup", "",
22  "Set the wakeup time (yyyy-MM-ddThh:mm:ss) "
23  "default is in local time", "")
24  << add(QStringList{"-t", "--setscheduledwakeup"},
25  "setschedwakeup", false,
26  "Set wakeup time to the next scheduled recording", "")
27  << add(QStringList{"-q", "--shutdown"},
28  "shutdown", false,
29  "Apply wakeup time to nvram and shutdown.", "")
30  << add(QStringList{"-x", "--safeshutdown"},
31  "safeshutdown", false,
32  "Check if shutdown is possible, and shutdown", "")
33  << add(QStringList{"-p", "--startup"},
34  "startup", false,
35  "Check startup status",
36  "Check startup status\n"
37  " returns 0 - automatic startup\n"
38  " 1 - manual startup")
39  << add(QStringList{"-c", "--check"},
40  "check", 1,
41  "Check whether shutdown is possible",
42  "Check whether shutdown is possible depending on input\n"
43  " input 0 - dont check recording status\n"
44  " 1 - do check recording status\n\n"
45  " returns 0 - ok to shut down\n"
46  " 1 - not ok, idle check reset")
47  << add("--lock" , "lock", false, "disable shutdown", "")
48  << add(QStringList{"-u", "--unlock"},
49  "unlock", false,
50  "enable shutdown", "")
51  << add(QStringList{"-s", "--status"},
52  "status", 1,
53  "check current status",
54  "check current status depending on input\n"
55  " input 0 - dont check recording status\n"
56  " 1 - do check recording status\n\n"
57  " returns 0 - Idle\n"
58  " 1 - Transcoding\n"
59  " 2 - Commercial Detection\n"
60  " 4 - Grabbing EPG data\n"
61  " 8 - Recording (only valid if input=1)\n"
62  " 16 - Locked\n"
63  " 32 - Jobs running or pending\n"
64  " 64 - In daily wakeup/shutdown period\n"
65  " 128 - Less than 15 minutes to next wakeup period\n"
66  " 255 - Setup is running") );
67 
68  // The localtime command line parameter exists solely to make scripts
69  // using this executable self documenting.
70 
71  CommandLineArg::AllowOneOf( QList<CommandLineArg*>()
72  << add("--utc",
73  "utc", false,
74  "Specify that the wakeup time is in utc", "")
75  << add("--localtime",
76  "localtime", false,
77  "Specify that the wakeup time is in local time", "") );
78 }
79 
CommandLineArg * add(QString arg, QString name, bool def, QString help, QString longhelp)
#define MYTH_APPNAME_MYTHSHUTDOWN
Parent class for defining application command line parsers.
void addVersion(void)
Canned argument definition for –version.
void addLogging(const QString &defaultVerbosity="general", LogLevel_t defaultLogLevel=LOG_INFO)
Canned argument definition for all logging options, including –verbose, –logpath, –quiet,...
void addHelp(void)
Canned argument definition for –help.
static void AllowOneOf(QList< CommandLineArg * > args)
Mark a list of arguments as mutually exclusive.
CommandLineArg * SetRemoved(QString remstr="", QString remver="")
Set option as removed.