mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 16:27:33 -10:00
In a terminal, devvm setup with neither --backend nor --features asks
for the default backend, then base's features. --backend chooses it
without asking; --features alone, or no terminal, doesn't ask.
- ui.PickOne: a single-choice picker in Pick's style ("( )"/"(*)",
up/down or k/j move the choice, enter confirms), starting from the
choice that's on; Pick and PickOne share pick/pickLoop.
- backends.Experimental: smolvm is marked experimental in the picker.
- setup: pickBackend starts from the current default (lima unless set,
or set to a backend devvm doesn't have); setupTerminal and pickOne
are test seams.
- Messages: backend_help, backend_experimental.
- Tests: TestPickOneKeys, TestPickOneWithoutTerminal,
TestSetupAsksForTheBackend (terminal, current default, unknown
default, no terminal, --backend, --features); setup.txtar checks no
backend is asked or saved without a terminal or with --features.
- Docs: backends.md (setting the default), customizing.md, the CLI
reference; AGENTS.md's pending line removed.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
77 lines
2.3 KiB
Plaintext
77 lines
2.3 KiB
Plaintext
# setup: the default backend and base's features (both asked in a
|
|
# terminal, which Go tests cover; without one, the backend isn't asked and
|
|
# the features are kept, or every one until they're chosen; --backend and
|
|
# --features without asking). A new choice of features says base
|
|
# rebuilds, and once images are built that devvm gc deletes the old ones.
|
|
env DEVVM_MESSAGES=names
|
|
env CHOSEN=$XDG_CONFIG_HOME/devvm/base-features
|
|
|
|
# Kept: none chosen; no backend asked.
|
|
exec devvm setup
|
|
stdout '^==> base_features_none$'
|
|
! stdout base_will_rebuild
|
|
! stdout default_backend
|
|
! exists $XDG_CONFIG_HOME/devvm/backend
|
|
! stderr .
|
|
! stub_calls
|
|
|
|
# Unchosen: every feature.
|
|
rm $CHOSEN
|
|
exec devvm setup
|
|
stdout '^==> base_features features=cli-tools fzf omb$'
|
|
! stdout base_will_rebuild
|
|
|
|
# --features, in the order features run; nothing built yet.
|
|
exec devvm setup --features omb,fzf
|
|
stdout '^==> base_features features=fzf omb$'
|
|
stdout '^==> base_will_rebuild$'
|
|
! stdout gc_old_hint
|
|
! stdout default_backend
|
|
cmp $CHOSEN fzf-omb
|
|
exec devvm setup --features fzf,omb
|
|
! stdout base_will_rebuild
|
|
|
|
# Built: a new choice rebuilds base, and gc deletes the old one.
|
|
exec devvm build base
|
|
exec devvm setup --features ''
|
|
stdout '^==> base_features_none$'
|
|
stdout '^==> base_will_rebuild$'
|
|
stdout '^gc_old_hint$'
|
|
exec devvm build base
|
|
stdout '^==> building_image image=base key='
|
|
exec devvm gc
|
|
stdout '^gc_image image=base key='
|
|
|
|
# A name that isn't a feature changes nothing.
|
|
! exec devvm setup --features fzf,nope
|
|
stderr '^devvm: no_feature feature=nope features=cli-tools fzf omb$'
|
|
! stdout base_features
|
|
exec devvm setup
|
|
stdout '^==> base_features_none$'
|
|
|
|
# The default backend: only it, unless --features is given too.
|
|
exec devvm setup --backend lima
|
|
stdout '^==> default_backend backend=lima$'
|
|
! stdout base_features
|
|
cmp $XDG_CONFIG_HOME/devvm/backend lima.txt
|
|
exec devvm setup --backend lima --features fzf
|
|
stdout '^==> default_backend backend=lima$'
|
|
stdout '^==> base_features features=fzf$'
|
|
! exec devvm setup --backend nope
|
|
stderr '^devvm: backend_unknown backends=lima, smolvm name=nope$'
|
|
cmp $XDG_CONFIG_HOME/devvm/backend lima.txt
|
|
|
|
# An unreadable choice stays for you to fix.
|
|
cp bad $CHOSEN
|
|
! exec devvm setup
|
|
stderr '^devvm: setup_failed reason=.*base-features'
|
|
cmp $CHOSEN bad
|
|
|
|
-- fzf-omb --
|
|
fzf
|
|
omb
|
|
-- lima.txt --
|
|
lima
|
|
-- bad --
|
|
Not_A_Feature
|