Repository navigation
feat(run): show the compose tail and script steps in --list - #95
Merged
Merged
Conversation
`xcind-run --list` printed a bin's service but not its `use` or `cmd`,
both of which the parser already collects. `use=run` starts a fresh
container while `use=exec` attaches to a running one, and that difference
was invisible. Scripts showed only a name and description, so finding out
what one did meant opening `.xcind.sh`.
Bins now carry the tail of the compose command they actually run:
bins:
npm (… exec app) Node package manager
composer (… exec app /usr/bin/composer)
phpunit (… run --rm app vendor/bin/phpunit) Run the test suite
scripts:
fresh Reinstall node modules from scratch
-rm -rf node_modules
@npm install
`cmd` appends only when it differs from the bin name, so ordinary bins
stay short. `-T` is deliberately absent: the runner decides it at run
time from the TTY state, so a static list would misstate it. Scripts
print their steps verbatim, keeping any leading `-`.
`--list --names` is byte-identical to before, so both completion
libraries are untouched.
The description column is padded with literal spaces rather than through
printf's field width. bash counts that width in bytes but `${#var}` in
characters, so the multibyte ellipsis would push the widest line two
columns right of the rest. Verified aligned under LC_ALL of en_US.UTF-8,
C.UTF-8, C, and POSIX, and on bash 3.2 through 5.x.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
xcind-run --listshowed a bin's Compose service but hid two fields the parser already collects.usedecides whether a bin attaches to a running container (exec) or starts a fresh one (run --rm), and that difference was invisible.cmdis the command inside the service, so a bin namedartisancould runphp artisanwith nothing in the list to say so. Scripts were worse off: they showed a name and a description and nothing about what they do, so you had to open.xcind.sh.Bins now carry the tail of the Compose command they actually run:
Decisions
-v. Xcind has no verbose-flag convention. It usesXCIND_DEBUG=1for traces and--jsonfor structured output.--list --namesalready serves every machine consumer, so the human format is free to change, anduse=runis exactly the surprise that should be visible by default.cmdappends only when it differs from the bin name. When the two match, repeating the name adds nothing.--listto calldocker compose ps, which turns a fast, offline, config-only command into a slow one that depends on containers being up. The service name is the stable identifier.-T. The runner decides it at run time from the TTY state, so a static list would misstate it.--list --namesis byte-identical to before. Both completion libraries call it (xcind-completion-bash.bash:433,xcind-completion-zsh.bash:548) and stay untouched. No new flag, so the flag surface, help text, and completion tests are unchanged.--list --jsonhere.__xcind-runner-bins-jsonand__xcind-runner-scripts-jsonalready exist and reach users throughxcind-config --json. A--list --jsoncan land separately.Implementation note: column alignment
The description column is padded with literal spaces, not through
printf's field width. Bash counts that width in bytes while${#var}counts characters, so the multibyte ellipsis pushed the widest line two columns right of the rest. Building the pad from${#tail}alone keeps every tail consistent in either locale, because they all carry the same(…prefix.Test plan
Nine new assertions in
test/test-xcind.shcover theexectail, therun --rmtail,cmdshown when it differs,cmdsuppressed when it matches the name,-Tnever printed, the aligned description column, script steps printed, the-prefix kept, and step indentation. The existing exact-match assertion on--list --namesis unchanged and still passes.make check— 223 tests, 0 failures.contrib/check-file-manifest— all manifests in sync.contrib/test-all --bash-versions— bash 3.2, 4.0, 4.4, 5.0, 5.1, 5, and latest all pass.LC_ALLofen_US.UTF-8,C.UTF-8,C, andPOSIX.