Skip to content

Add cheznav info subcommand - #7

Open
djetelina wants to merge 1 commit into
mainfrom
add-info-command
Open

Add cheznav info subcommand#7
djetelina wants to merge 1 commit into
mainfrom
add-info-command

Conversation

@djetelina

Copy link
Copy Markdown
Owner

Adds a non-interactive cheznav info subcommand that prints diagnostics and exits without launching the TUI:

cheznav 0.3.0
chezmoi: chezmoi version v2.70.5, built at 2026-06-04T09:10:45Z (/usr/bin/chezmoi)
config:  /home/you/.config/chezmoi/chezmoi.toml
source:  /home/you/.local/share/chezmoi (git repo)

It reports:

  • cheznav's own version
  • whether chezmoi is installed and its version (or a clear "not found" message)
  • the detected chezmoi config file, or where it looked if none exists (honors --chezmoi-config)
  • whether a chezmoi source directory is initialized (and whether it's a git repo)

Why

Quick environment diagnostics, and a non-TUI entry point for packaging smoke tests. The Homebrew formula needs a test that exercises real functionality — the cookbook rejects bare --help/--version checks — and cheznav otherwise only launches the TUI. cheznav info gives brew test a deterministic, meaningful command to assert against.

Implementation

  • New cheznav/info.py holds print_info; main.py only wires up the info subparser.
  • No new dependencies; runs synchronously and never imports the TUI path.
  • tests/test_cli_info.py covers installed/missing chezmoi, config found/absent, and initialized/uninitialized source. Full suite: 92 passed.
  • README usage updated.

Introduce a non-interactive 'cheznav info' (in a new cheznav/info.py
module) that prints the cheznav and chezmoi versions, whether chezmoi is
installed, the detected chezmoi config file (if any), and whether a
source directory is initialized.

Useful for quick diagnostics and as a non-TUI entry point for packaging
smoke tests (e.g. Homebrew), which need to exercise real functionality
rather than a TUI.
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