Skip to content

Add CLI argument support to hack Nix app#7111

Merged
negz merged 1 commit intocrossplane:mainfrom
negz:argumentative
Feb 4, 2026
Merged

Add CLI argument support to hack Nix app#7111
negz merged 1 commit intocrossplane:mainfrom
negz:argumentative

Conversation

@negz
Copy link
Member

@negz negz commented Feb 4, 2026

Description of your changes

The hack Nix app used environment variables HACK_CROSSPLANE_ARGS and HACK_CROSSPLANE_VALUES for configuration. These were undiscoverable without reading the source code, and there was no --help support.

This PR replaces environment variables with CLI arguments using docopts. The help text serves as both documentation and the parser specification, so they stay in sync automatically.

nix run .#hack -- --help
nix run .#hack -- --args="--debug,--enable-operations"
nix run .#hack -- --values ./my-values.yaml

I have:

@negz negz requested a review from a team as a code owner February 4, 2026 19:24
@negz negz requested a review from adamwg February 4, 2026 19:24
@negz
Copy link
Member Author

negz commented Feb 4, 2026

CC @jbw976 @phisco - this follows up to #7106 and #7107.

Copy link
Contributor

@phisco phisco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#TIL, thanks @negz!

The hack app previously used environment variables HACK_CROSSPLANE_ARGS
and HACK_CROSSPLANE_VALUES for configuration. These were undiscoverable
without reading the source code, and there was no --help support.

This commit replaces environment variables with CLI arguments using
docopts, which parses arguments from a docstring. The help text serves
as both documentation and the parser specification, keeping them in
sync automatically.

Usage:
  nix run .#hack -- --help
  nix run .#hack -- --args="--debug,--enable-operations"
  nix run .#hack -- --values ./my-values.yaml

Signed-off-by: Nic Cope <nicc@rk0n.org>
Copy link
Member

@jbw976 jbw976 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah nice, thanks for the nix lesson and best practices @negz!

@negz negz merged commit e42aa4f into crossplane:main Feb 4, 2026
24 checks passed
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.

3 participants