Skip to content

[IMP] cli: Add program description and rewrite --help for the deployv-only CLI - #239

Merged
moylop260 merged 7 commits into
Vauxoo:mainfrom
vauxoo-dev:main-cli-help-moy
Aug 7, 2026
Merged

[IMP] cli: Add program description and rewrite --help for the deployv-only CLI#239
moylop260 merged 7 commits into
Vauxoo:mainfrom
vauxoo-dev:main-cli-help-moy

Conversation

@moylop260

@moylop260 moylop260 commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Running travisfile2dockerfile --help showed no description at all of what the
tool does, and the per-option help texts still talked in terms of the old
.travis.yml workflow. After the deployv-only refactor (#238) the tool does
something quite different from what its name suggests, so the --help output
is the first place a new user looks.

This PR makes the CLI self-documenting:

  • Add prog, description and epilog to the ArgumentParser explaining what
    t2d does today: clone the repository, read the variables.sh of the deployv
    image at the given revision, and generate a Dockerfile plus 10-build.sh
    and 20-run.sh scripts to build the image and run a development container.
    The epilog includes real usage examples (branch, pull/#, --docker-image,
    --no-clone) and documents the TRAVIS2DOCKER_ROOT_PATH environment
    variable, using RawDescriptionHelpFormatter to keep the formatting.
  • Rewrite every --help text for clarity, stating the default value of each
    option and marking the no-op options (--exclude-after-success,
    --travis-yml-path, --runs-at-the-end-script, --deployv) explicitly as
    deprecated/ignored.
  • Fix --build-env-args to flatten all the values when the option is repeated,
    instead of only taking the first group.
  • Remove -itP from the default --run-extra-args since 20-run.sh already
    hardcodes -ditP, which made docker run receive the flags twice.
  • Replace the debug print calls of git_run.py with standard logging.
  • Update the README to recommend Ed25519 SSH keys and clarify the supported
    repository URL formats.
  • Enable DEBUG logging by default in the CLI entry point and migrate the
    remaining print/stdout.write calls of cli.py and travis2docker.py
    to the standard logger, so the git_run debug messages are printed too.
  • Colorize the log output with a logging_colored module based on the
    pre-commit-vauxoo one (ANSI-colored levelname per level), migrate the last
    print calls of docker_helper/build.py to a standalone logger, and drop
    the RUFF_DISABLE_CHECKS="print" override from variables.sh along with
    the print-used pylint disables now that no print calls remain.

nhomar and others added 7 commits August 7, 2026 15:54
Using --build-env-args with multiple values in a single flag, e.g.:

    --build-env-args VIM_INSTALL ZSH_INSTALL

silently discarded every value but the first one, because the parsing
only extracted item[0] from each appended nargs list. This is exactly
the usage documented in the README, so it was broken as documented.

Flatten the nested lists instead, so both the repeated-flag form and
the multi-value form generate every ENV line in the Dockerfile.
Every git command executed was printed twice to stdout with bare
print() calls, polluting the tool output with debug noise that could
not be silenced. Use logging.debug() instead, so it stays hidden by
default and can be enabled when actually debugging.
The 20-run.sh template already hardcodes -ditP in the docker run
command, so the -itP included in the --run-extra-args default value
produced 'docker run -itP ... -ditP ...' with every flag repeated.
Docker tolerates the repetition, but it is confusing when reading the
generated script and the --help default. Keep only the LANG export in
the default value.
The --help output had terse descriptions with no examples nor default
values, making the tool hard to discover without reading the source.

- Add a program description explaining what the tool actually does
  today: generate a Dockerfile and helper scripts from the deployv
  image of a repository based on its variables.sh file.
- Add an epilog with usage examples and the TRAVIS2DOCKER_ROOT_PATH
  environment variable.
- Document the default value of every parameter in its help text.
- Fix the --build-env-args help: it documented 'ARG NAME' and
  'ENV NAME=$NAME' lines, but the deployv template actually generates
  'ENV NAME=TRUE' lines used to enable optional installation steps
  such as VIM_INSTALL and ZSH_INSTALL.
- Clarify that -ditP is already hardcoded in 20-run.sh so it does not
  need to be passed via --run-extra-args.
The tool prefers ~/.ssh/id_ed25519.pub for the container's
authorized_keys and warns that RSA keys are deprecated, but the README
only documented how to remove the passphrase from RSA keys. Document
the Ed25519 flow first and keep the RSA one as legacy.

Also clarify that https urls are supported for public repositories and
remove trailing whitespace.
Configure logging.basicConfig at DEBUG level in the CLI entry point so
the _logger.debug messages of git_run are printed, and replace the
remaining print/stdout.write calls of cli.py and travis2docker.py with
the standard logger (warning for deprecations, info for regular output).

docker_helper/build.py keeps its prints on purpose, as stated by its
'No plan to use logging here' note.
Add a logging_colored module based on the pre-commit-vauxoo one, with a
ColoredFormatter that colorizes the levelname with ANSI sequences, and
use it in the CLI handler.

Migrate the docker_helper/build.py prints to its own standalone logger
(it is copied into the image and run with python3 -c 'import build').

Since no print calls remain, remove the RUFF_DISABLE_CHECKS='print'
override from variables.sh and the print-used pylint disables.
@moylop260
moylop260 merged commit 408bf7e into Vauxoo:main Aug 7, 2026
20 checks passed
@moylop260
moylop260 deleted the main-cli-help-moy branch August 7, 2026 22:37
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.

2 participants