Commit e5841274 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner

migrator: The --output option

parent f13baa18
......@@ -68,6 +68,8 @@ static const char *opt_help[COT_LAST] = {
"--ask-approval=<report-file> Require user's approval to proceed (abort if --approve with appropriate ID is not present, plan of action is put into the report-file if approval is needed)\n",
[COT_APPROVE] =
"--approve=<id> Approve actions with given ID (multiple allowed, from a corresponding report-file).\n",
[COT_OUTPUT] =
"--output=<file> Put the output to given file.\n",
[COT_TASK_LOG] =
"--task-log=<file> Append list of executed tasks into a log file.\n"
};
......@@ -78,6 +80,7 @@ enum option_val {
OPT_REEXEC_VAL,
OPT_ASK_APPROVAL_VAL,
OPT_APPROVE_VAL,
OPT_OUTPUT,
OPT_TASK_LOG_VAL,
OPT_LAST
};
......@@ -93,6 +96,7 @@ static const struct option opt_long[] = {
{ .name = "state-log", .has_arg = no_argument, .val = OPT_STATE_LOG_VAL },
{ .name = "ask-approval", .has_arg = required_argument, .val = OPT_ASK_APPROVAL_VAL },
{ .name = "approve", .has_arg = required_argument, .val = OPT_APPROVE_VAL },
{ .name = "output", .has_arg = required_argument, .val = OPT_OUTPUT },
{ .name = "task-log", .has_arg = required_argument, .val = OPT_TASK_LOG_VAL },
{ .name = NULL }
};
......@@ -111,6 +115,7 @@ static const struct simple_opt {
[OPT_STATE_LOG_VAL] = { COT_STATE_LOG, false, true },
[OPT_ASK_APPROVAL_VAL] = { COT_ASK_APPROVAL, true, true },
[OPT_APPROVE_VAL] = { COT_APPROVE, true, true },
[OPT_OUTPUT] = { COT_OUTPUT, true, true },
[OPT_TASK_LOG_VAL] = { COT_TASK_LOG, true, true }
};
......@@ -214,6 +219,7 @@ struct cmd_op *cmd_args_parse(int argc, char *argv[], const enum cmd_op_type acc
case COT_STDERR_LEVEL:
case COT_SYSLOG_NAME:
case COT_ASK_APPROVAL:
case COT_OUTPUT:
case COT_APPROVE:
case COT_TASK_LOG: {
struct cmd_op tmp = result[i];
......
......@@ -56,6 +56,8 @@ enum cmd_op_type {
COT_STDERR_LEVEL,
// Name of the syslog
COT_SYSLOG_NAME,
// Put the output into a file
COT_OUTPUT,
// Log tasks into a file
COT_TASK_LOG,
// Argument isn't option.
......
......@@ -27,8 +27,7 @@
#include <errno.h>
static const enum cmd_op_type cmd_op_allowed[] = {
COT_BATCH, COT_NO_OP, COT_ROOT_DIR, COT_SYSLOG_LEVEL, COT_STDERR_LEVEL, COT_SYSLOG_NAME, COT_LAST
// TODO: Path to the config to be written
COT_BATCH, COT_NO_OP, COT_ROOT_DIR, COT_SYSLOG_LEVEL, COT_STDERR_LEVEL, COT_SYSLOG_NAME, COT_OUTPUT, COT_LAST
};
void print_help() {
......@@ -82,6 +81,9 @@ int main(int argc, char *argv[]) {
log_stderr_level(level);
break;
}
case COT_OUTPUT:
output = op->parameter;
break;
default:
DIE("Unknown COT");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment