mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
vsh: Introduce vshInitReload
Commit a0b6a36f separated vshInitDebug from the original vshInit (before virsh got split and vshInit became virshInit - commit 834c5720) in order to be able to debug command line parsing. After the parsing is finished, debugging is reinitialized to work properly. There might as well be other features that require re-initialization as the command line could specify parameters that override our defaults which had been set prior to calling vshArgvParse.
This commit is contained in:
parent
57b8a38840
commit
f59d51f518
@ -347,8 +347,9 @@ virshInit(vshControl *ctl)
|
||||
virshControlPtr priv = ctl->privData;
|
||||
|
||||
/* Since we have the commandline arguments parsed, we need to
|
||||
* re-initialize all the debugging to make it work properly */
|
||||
vshInitDebug(ctl);
|
||||
* reload our initial settings to make debugging and readline
|
||||
* work properly */
|
||||
vshInitReload(ctl);
|
||||
|
||||
if (priv->conn)
|
||||
return false;
|
||||
|
19
tools/vsh.c
19
tools/vsh.c
@ -2738,6 +2738,25 @@ vshInit(vshControl *ctl, const vshCmdGrp *groups, const vshCmdDef *set)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
vshInitReload(vshControl *ctl)
|
||||
{
|
||||
if (!cmdGroups && !cmdSet) {
|
||||
vshError(ctl, "%s", _("command groups and command are both NULL "
|
||||
"run vshInit before reloading"));
|
||||
return false;
|
||||
}
|
||||
|
||||
vshInitDebug(ctl);
|
||||
|
||||
if (ctl->imode)
|
||||
vshReadlineDeinit(ctl);
|
||||
if (ctl->imode && vshReadlineInit(ctl) < 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
vshDeinit(vshControl *ctl)
|
||||
{
|
||||
|
@ -303,6 +303,7 @@ int vshCommandOptTimeoutToMs(vshControl *ctl, const vshCmd *cmd, int *timeout);
|
||||
void vshPrintExtra(vshControl *ctl, const char *format, ...)
|
||||
ATTRIBUTE_FMT_PRINTF(2, 3);
|
||||
bool vshInit(vshControl *ctl, const vshCmdGrp *groups, const vshCmdDef *set);
|
||||
bool vshInitReload(vshControl *ctl);
|
||||
void vshDeinit(vshControl *ctl);
|
||||
void vshInitDebug(vshControl *ctl);
|
||||
void vshDebug(vshControl *ctl, int level, const char *format, ...)
|
||||
|
Loading…
x
Reference in New Issue
Block a user