Files
devvm/testdata/script/root.txtar
T
w3cjandClaude Opus 5.5 79b3ef94d4 refactor(cli): one backend: no --backend flag, no BACKEND column
devvm runs every VM on Lima, so the command line has no backend choice:

- --backend is gone from devvm, build, rebuild, images, images rm, gc,
  space, doctor and setup (addBackendFlag, addBackendFilterFlag, setup's
  own, checkFlagValue's case, its completion); a removed flag now fails
  as an unknown flag (exit 2).
- devvm setup no longer asks for or saves a default backend; config.toml
  and settings.json have no backend key (settings.KeyBackend, Values and
  Defaults' Backend, checkBackend, Value.With, Source.File, FromFlag).
- Tables lose BACKEND: ls, images (both tables), space (both tables);
  doctor's FEATURE table is FEATURE and SUPPORT for Lima. space's images
  row is freed by images rm.
- --json keeps every backend field (ls, images, tool records, space,
  doctor's backend, backend_source "built-in" and every backend's
  features).
- The registry keeps Lookup, For and Default: For(d, vm) gives a VM its
  recorded backend and a new VM NewVMs, else Default; tests set NewVMs.
  vm.Env's lookups lose the flag parameter, found.flagIgnored and
  Options.Backend.
- Messages removed: backend_unknown, backend_unknown_default,
  default_backend, backend_help, doctor_backend_from,
  backend_flag_ignored; backend_unknown_vm stays (a VM's recorded
  backend), linked to backends#a-vms-backend.
- Docs: Backends' choosing section becomes "A VM's backend"; settings,
  setup, images, gc, space, doctor, commands and install pages lose
  --backend and BACKEND; Contributing gains "How a backend plugs in".
- Tests: unit tests for For, settings, setup, doctor's table, the
  tables; CLI scripts check --backend as an unknown flag on devvm,
  build, restart, images, gc, space, doctor and setup, and a config.toml
  backend key as unknown; e2e's table checks lose the column.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 12:46:28 -07:00

99 lines
3.3 KiB
Plaintext

# devvm --help prints usage.
exec devvm --help
stdout '^Usage:'
stdout '^ devvm \[flags\]$'
! stdout 'IMAGE\]'
! stderr .
cp stdout help.txt
# So do devvm help and -h; devvm help COMMAND prints the command's.
exec devvm help
cmp stdout help.txt
exec devvm -h
cmp stdout help.txt
exec devvm help build
stdout 'devvm build IMAGE \[flags\]'
exec devvm build --help
stdout 'devvm build IMAGE \[flags\]'
! stub_calls
# An unknown flag is a usage error: its message on stderr, then the line
# naming the command's own help.
! exec devvm --nope
cmp stderr nope-flag.txt
! stdout .
! exec devvm stop --nope
stderr '^devvm: flag_unknown command=devvm stop flag=--nope$'
stderr '^usage_help command=devvm stop$'
# So is a command given too many arguments, naming those its help shows.
! exec devvm build a b
cmp stderr build-args.txt
! stdout .
! stub_calls
# devvm takes no word but a command's. A toolchain's, an agent's or a
# layer's name, or several joined with + or a comma, is a usage error
# naming devvm's --help that points to the flags choosing them; any other
# word gets a did-you-mean when a command is close. Nothing runs.
! exec devvm node
stderr '^devvm: no_command_part flags=--tools node word=node$'
stderr '^usage_help command=devvm$'
! exec devvm claude
stderr '^devvm: no_command_part flags=--agents claude word=claude$'
! exec devvm docker
stderr '^devvm: no_command_part flags=--layers docker word=docker$'
! exec devvm node+claude
stderr '^devvm: no_command_part flags=--tools node --agents claude word=node\+claude$'
stderr '^usage_help command=devvm$'
mkdir $XDG_CONFIG_HOME/devvm/layers
cp $WORK/pg.sh $XDG_CONFIG_HOME/devvm/layers/pg.sh
! exec devvm pg,node
stderr '^devvm: no_command_part flags=--tools node --layers pg word=pg,node$'
! exec devvm node+nope
stderr '^devvm: no_command word=node\+nope$'
! exec devvm stpo
stderr '^devvm: no_command_like command=stop word=stpo$'
stderr '^usage_help command=devvm$'
! stdout .
! stub_calls
# Flags for a new VM are devvm's alone, so other commands refuse
# them, before or after the command's name.
! exec devvm ls --cpus 4
stderr '^devvm: flag_unknown command=devvm ls flag=--cpus$'
! exec devvm --cpus 4 ls
stderr '^devvm: flag_unknown command=devvm ls flag=--cpus$'
! exec devvm tools add node --from node:24
stderr '^devvm: flag_unknown command=devvm tools add flag=--from$'
# No command takes --backend: devvm, its image commands and the rest
# refuse it first.
! exec devvm --backend lima
stderr '^devvm: flag_unknown command=devvm flag=--backend$'
! exec devvm restart --backend lima
stderr '^devvm: flag_unknown command=devvm restart flag=--backend$'
! exec devvm build --backend lima base
stderr '^devvm: flag_unknown command=devvm build flag=--backend$'
stderr '^usage_help command=devvm build$'
! stub_calls
# No flag or argument takes an empty value to mean none or its default.
! exec devvm --ports ''
stderr '^devvm: flag_blank flag=ports$'
! exec devvm --cpus=
stderr '^devvm: flag_blank flag=cpus$'
! exec devvm ''
stderr '^devvm: arg_blank command=devvm$'
! exec devvm history export ''
stderr '^devvm: arg_blank command=devvm history export$'
! stub_calls
-- nope-flag.txt --
devvm: flag_unknown command=devvm flag=--nope
usage_help command=devvm
-- build-args.txt --
devvm: args_too_many args=IMAGE command=devvm build given=a b
usage_help command=devvm build
-- pg.sh --
set -euo pipefail