Skip to content

feat(run): show the compose tail and script steps in --list - #95

Merged
simensen merged 2 commits into
mainfrom
feat/run-list-compose-tail
Sep 4, 2026
Merged

simensen merged 2 commits into
mainfrom
feat/run-list-compose-tail

Conversation

@simensen

@simensen simensen commented Sep 4, 2026

Copy link
Copy Markdown
Member

Summary

xcind-run --list showed a bin's Compose service but hid two fields the parser already collects. use decides whether a bin attaches to a running container (exec) or starts a fresh one (run --rm), and that difference was invisible. cmd is the command inside the service, so a bin named artisan could run php artisan with 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:

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

Decisions

  • Always on, not behind -v. Xcind has no verbose-flag convention. It uses XCIND_DEBUG=1 for traces and --json for structured output. --list --names already serves every machine consumer, so the human format is free to change, and use=run is exactly the surprise that should be visible by default.
  • cmd appends only when it differs from the bin name. When the two match, repeating the name adds nothing.
  • No container name. The runner stores none. Compose derives one at run time from the project name and the service, and it exists only while the container runs. Printing it would force --list to call docker 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.
  • No -T. The runner decides it at run time from the TTY state, so a static list would misstate it.
  • --list --names is 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.
  • No --list --json here. __xcind-runner-bins-json and __xcind-runner-scripts-json already exist and reach users through xcind-config --json. A --list --json can 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.sh cover the exec tail, the run --rm tail, cmd shown when it differs, cmd suppressed when it matches the name, -T never printed, the aligned description column, script steps printed, the - prefix kept, and step indentation. The existing exact-match assertion on --list --names is 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.
  • Alignment verified under LC_ALL of en_US.UTF-8, C.UTF-8, C, and POSIX.

`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.
@simensen
simensen merged commit f4bf630 into main Sep 4, 2026
17 checks passed
@simensen
simensen deleted the feat/run-list-compose-tail branch November 6, 2026 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant