mirror of
git://sourceware.org/git/lvm2.git
synced 2025-10-23 23:33:15 +03:00
refactor: move 'interactive' field from struct command_line to struct cmd_context as 'is_interactive' switch
This commit is contained in:
@@ -113,6 +113,7 @@ struct cmd_context {
|
|||||||
* Switches.
|
* Switches.
|
||||||
*/
|
*/
|
||||||
unsigned is_long_lived:1; /* optimises persistent_filter handling */
|
unsigned is_long_lived:1; /* optimises persistent_filter handling */
|
||||||
|
unsigned is_interactive:1;
|
||||||
unsigned check_pv_dev_sizes:1;
|
unsigned check_pv_dev_sizes:1;
|
||||||
unsigned handles_missing_pvs:1;
|
unsigned handles_missing_pvs:1;
|
||||||
unsigned handles_unknown_segments:1;
|
unsigned handles_unknown_segments:1;
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ int lvm_shell(struct cmd_context *cmd, struct cmdline_context *cmdline)
|
|||||||
|
|
||||||
_cmdline = cmdline;
|
_cmdline = cmdline;
|
||||||
|
|
||||||
_cmdline->interactive = 1;
|
cmd->is_interactive = 1;
|
||||||
while (1) {
|
while (1) {
|
||||||
free(input);
|
free(input);
|
||||||
input = readline("lvm> ");
|
input = readline("lvm> ");
|
||||||
@@ -246,6 +246,7 @@ int lvm_shell(struct cmd_context *cmd, struct cmdline_context *cmdline)
|
|||||||
}
|
}
|
||||||
_write_history();
|
_write_history();
|
||||||
}
|
}
|
||||||
|
cmd->is_interactive = 0;
|
||||||
|
|
||||||
free(input);
|
free(input);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ struct cmdline_context {
|
|||||||
struct command *commands;
|
struct command *commands;
|
||||||
int num_commands;
|
int num_commands;
|
||||||
int commands_size;
|
int commands_size;
|
||||||
int interactive;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int lvm2_main(int argc, char **argv);
|
int lvm2_main(int argc, char **argv);
|
||||||
|
|||||||
@@ -1739,7 +1739,7 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
|
|||||||
stack;
|
stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret == EINVALID_CMD_LINE && !_cmdline.interactive)
|
if (ret == EINVALID_CMD_LINE && !cmd->is_interactive)
|
||||||
_short_usage(cmd->command->name);
|
_short_usage(cmd->command->name);
|
||||||
|
|
||||||
log_debug("Completed: %s", cmd->cmd_line);
|
log_debug("Completed: %s", cmd->cmd_line);
|
||||||
|
|||||||
Reference in New Issue
Block a user