On 4/19/24 15:05, Peter Krempa wrote:
This series refactors the commandline parser in order to use easier
to
understand/maintain logic.
Peter Krempa (13):
meson: tests: Add 'virsh' as dependency of 'virshtest'
tools: Rename vshCommandOptStringReq to vshCommandOptString
vsh: Fix 'stdin' closing in 'cmdComplete'
vsh: Add a VSH_OT_STRING argument for 'virsh echo'
virshtest: Add test cases for command completion helper
vsh: Rework logic for picking which argument is to be completed
virsh: Introduce new 'VSH_OT_ARGV' accessors
vsh: Remove unused infrastructure for command completion
vsh: Unexport command lookup helpers 'vshCmddefSearch',
'vshCmdGrpSearch', 'vshCmdGrpHelp'
vsh: Refactor parsed option and command assignment
vshCmddefCheckInternals: Remove check for "too many options"
vsh: Move option assignment debugging from vshCommandParse to
vshCmdOptAssign
vsh: Refactor logic in vshCommandParse
tests/meson.build | 4 +-
tests/virshtest.c | 37 +
.../completion-arg-full-argv-next.out | 2 +
.../completion-arg-full-argv.out | 2 +
.../completion-arg-full-bool-next.out | 7 +
.../completion-arg-full-bool.out | 2 +
.../completion-arg-full-string-next.out | 7 +
.../completion-arg-full-string.out | 2 +
.../virshtestdata/completion-arg-partial.out | 4 +
.../completion-arg-positional-empty.out | 3 +
...completion-arg-positional-partial-next.out | 2 +
.../completion-arg-positional-partial.out | 2 +
tests/virshtestdata/completion-args.out | 7 +
.../completion-argv-multiple-next.out | 25 +
...mpletion-argv-multiple-positional-next.out | 25 +
.../completion-argv-multiple-positional.out | 2 +
.../completion-argv-multiple.out | 2 +
.../completion-command-complete.out | 2 +
tests/virshtestdata/completion-command.out | 2 +
tests/virshtestdata/completion.in | 16 +
tests/virshtestdata/completion.out | 71 ++
tools/virsh-backup.c | 4 +-
tools/virsh-checkpoint.c | 18 +-
tools/virsh-completer-domain.c | 2 +-
tools/virsh-completer-host.c | 8 +-
tools/virsh-domain-event.c | 2 +-
tools/virsh-domain-monitor.c | 18 +-
tools/virsh-domain.c | 351 +++---
tools/virsh-host.c | 40 +-
tools/virsh-interface.c | 6 +-
tools/virsh-network.c | 35 +-
tools/virsh-nodedev.c | 30 +-
tools/virsh-nwfilter.c | 8 +-
tools/virsh-pool.c | 64 +-
tools/virsh-secret.c | 10 +-
tools/virsh-snapshot.c | 23 +-
tools/virsh-util.c | 2 +-
tools/virsh-volume.c | 29 +-
tools/virsh.c | 6 +-
tools/virt-admin.c | 26 +-
tools/vsh.c | 1012 +++++++++--------
tools/vsh.h | 27 +-
42 files changed, 1103 insertions(+), 844 deletions(-)
create mode 100644 tests/virshtestdata/completion-arg-full-argv-next.out
create mode 100644 tests/virshtestdata/completion-arg-full-argv.out
create mode 100644 tests/virshtestdata/completion-arg-full-bool-next.out
create mode 100644 tests/virshtestdata/completion-arg-full-bool.out
create mode 100644 tests/virshtestdata/completion-arg-full-string-next.out
create mode 100644 tests/virshtestdata/completion-arg-full-string.out
create mode 100644 tests/virshtestdata/completion-arg-partial.out
create mode 100644 tests/virshtestdata/completion-arg-positional-empty.out
create mode 100644 tests/virshtestdata/completion-arg-positional-partial-next.out
create mode 100644 tests/virshtestdata/completion-arg-positional-partial.out
create mode 100644 tests/virshtestdata/completion-args.out
create mode 100644 tests/virshtestdata/completion-argv-multiple-next.out
create mode 100644 tests/virshtestdata/completion-argv-multiple-positional-next.out
create mode 100644 tests/virshtestdata/completion-argv-multiple-positional.out
create mode 100644 tests/virshtestdata/completion-argv-multiple.out
create mode 100644 tests/virshtestdata/completion-command-complete.out
create mode 100644 tests/virshtestdata/completion-command.out
create mode 100644 tests/virshtestdata/completion.in
create mode 100644 tests/virshtestdata/completion.out
Reviewed-by: Michal Privoznik <mprivozn(a)redhat.com>
Michal