mirror of
https://github.com/arcan1s/queued.git
synced 2025-07-14 22:35:48 +00:00
implement priority supprt for users
This commit is contained in:
@ -173,8 +173,7 @@ void QueuedctlTask::parserAdd(QCommandLineParser &_parser)
|
||||
_parser.addPositionalArgument("program", "Command line.", "<program>");
|
||||
|
||||
// command line arguments
|
||||
QCommandLineOption argumentOption(QStringList() << "a"
|
||||
<< "argument",
|
||||
QCommandLineOption argumentOption({"a", "argument"},
|
||||
"Command line argument.", "argument", "");
|
||||
_parser.addOption(argumentOption);
|
||||
// working directory
|
||||
@ -239,13 +238,11 @@ void QueuedctlTask::parserSet(QCommandLineParser &_parser)
|
||||
_parser.addPositionalArgument("id", "Task ID.", "<id>");
|
||||
|
||||
// command line
|
||||
QCommandLineOption commandOption(QStringList() << "p"
|
||||
<< "program",
|
||||
"Command line.", "program", "");
|
||||
QCommandLineOption commandOption({"p", "program"}, "Command line.",
|
||||
"program", "");
|
||||
_parser.addOption(commandOption);
|
||||
// command line arguments
|
||||
QCommandLineOption argumentOption(QStringList() << "a"
|
||||
<< "argument",
|
||||
QCommandLineOption argumentOption({"a", "argument"},
|
||||
"Command line argument.", "argument", "");
|
||||
_parser.addOption(argumentOption);
|
||||
// working directory
|
||||
|
@ -96,6 +96,7 @@ QueuedctlUser::getDefinitions(const QCommandLineParser &_parser,
|
||||
[&definitions](const QueuedError &) { definitions.password = ""; });
|
||||
|
||||
definitions.email = _parser.value("email");
|
||||
definitions.priority = _parser.value("priority").toUInt();
|
||||
// limits now
|
||||
QueuedLimits::Limits limits(
|
||||
_parser.value("limit-cpu").toLongLong(),
|
||||
@ -200,15 +201,16 @@ void QueuedctlUser::parserAdd(QCommandLineParser &_parser)
|
||||
_parser.addPositionalArgument("name", "User name.", "<name>");
|
||||
|
||||
// permissions
|
||||
QCommandLineOption accessOption(QStringList() << "a"
|
||||
<< "access",
|
||||
"User permission.", "access", "0");
|
||||
QCommandLineOption accessOption({"a", "access"}, "User permission.",
|
||||
"access", "0");
|
||||
_parser.addOption(accessOption);
|
||||
// email
|
||||
QCommandLineOption emailOption(QStringList() << "e"
|
||||
<< "email",
|
||||
"User email.", "email", "");
|
||||
QCommandLineOption emailOption({"e", "email"}, "User email.", "email", "");
|
||||
_parser.addOption(emailOption);
|
||||
// priority
|
||||
QCommandLineOption priorityOption({"p", "priority"}, "User priority.",
|
||||
"priority", "0");
|
||||
_parser.addOption(priorityOption);
|
||||
// password
|
||||
QCommandLineOption passwordOption("password", "User password.", "password",
|
||||
"");
|
||||
@ -276,15 +278,15 @@ void QueuedctlUser::parserSet(QCommandLineParser &_parser)
|
||||
_parser.addPositionalArgument("id", "User ID.", "<id>");
|
||||
|
||||
// email
|
||||
QCommandLineOption emailOption(QStringList() << "e"
|
||||
<< "email",
|
||||
"User email.", "email", "");
|
||||
QCommandLineOption emailOption({"e", "email"}, "User email.", "email", "");
|
||||
_parser.addOption(emailOption);
|
||||
// name
|
||||
QCommandLineOption nameOption(QStringList() << "n"
|
||||
<< "name",
|
||||
"User name.", "name", "");
|
||||
QCommandLineOption nameOption({"n", "name"}, "User name.", "name", "");
|
||||
_parser.addOption(nameOption);
|
||||
// priority
|
||||
QCommandLineOption priorityOption({"p", "priority"}, "User priority.",
|
||||
"priority", "0");
|
||||
_parser.addOption(priorityOption);
|
||||
// password
|
||||
QCommandLineOption passwordOption("password", "User password.", "password",
|
||||
"");
|
||||
|
@ -43,25 +43,18 @@ int main(int argc, char *argv[])
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
// info
|
||||
QCommandLineOption infoOption(QStringList() << "i"
|
||||
<< "info",
|
||||
"Shows additional info.");
|
||||
QCommandLineOption infoOption({"i", "info"}, "Shows additional info.");
|
||||
parser.addOption(infoOption);
|
||||
|
||||
// debug mode
|
||||
QCommandLineOption debugOption(QStringList() << "d"
|
||||
<< "debug",
|
||||
"Prints debug information.");
|
||||
QCommandLineOption debugOption({"d", "debug"}, "Prints debug information.");
|
||||
parser.addOption(debugOption);
|
||||
|
||||
// configuration option
|
||||
QCommandLineOption tokenOption(QStringList() << "t"
|
||||
<< "token",
|
||||
"Path to cached token.", "token",
|
||||
QueuedSettings::defaultTokenPath());
|
||||
QCommandLineOption tokenOption({"t", "token"}, "Path to cached token.",
|
||||
"token", QueuedSettings::defaultTokenPath());
|
||||
parser.addOption(tokenOption);
|
||||
QCommandLineOption userOption(QStringList() << "u"
|
||||
<< "user",
|
||||
QCommandLineOption userOption({"u", "user"},
|
||||
"User to login instead of current one.",
|
||||
"user", ::getlogin());
|
||||
parser.addOption(userOption);
|
||||
|
Reference in New Issue
Block a user