1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-10 16:58:47 +03:00

refactor: move 'interactive' field from struct command_line to struct cmd_context as 'is_interactive' switch

This commit is contained in:
Peter Rajnoha 2016-05-20 14:23:43 +02:00
parent 0ab1187740
commit c33c0545af
4 changed files with 4 additions and 3 deletions

View File

@ -113,6 +113,7 @@ struct cmd_context {
* Switches.
*/
unsigned is_long_lived:1; /* optimises persistent_filter handling */
unsigned is_interactive:1;
unsigned check_pv_dev_sizes:1;
unsigned handles_missing_pvs:1;
unsigned handles_unknown_segments:1;

View File

@ -193,7 +193,7 @@ int lvm_shell(struct cmd_context *cmd, struct cmdline_context *cmdline)
_cmdline = cmdline;
_cmdline->interactive = 1;
cmd->is_interactive = 1;
while (1) {
free(input);
input = readline("lvm> ");
@ -246,6 +246,7 @@ int lvm_shell(struct cmd_context *cmd, struct cmdline_context *cmdline)
}
_write_history();
}
cmd->is_interactive = 0;
free(input);
return 0;

View File

@ -23,7 +23,6 @@ struct cmdline_context {
struct command *commands;
int num_commands;
int commands_size;
int interactive;
};
int lvm2_main(int argc, char **argv);

View File

@ -1739,7 +1739,7 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
stack;
}
if (ret == EINVALID_CMD_LINE && !_cmdline.interactive)
if (ret == EINVALID_CMD_LINE && !cmd->is_interactive)
_short_usage(cmd->command->name);
log_debug("Completed: %s", cmd->cmd_line);