Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command unable to specify a "version" option. #63

Open
mattrothenberg opened this issue Jun 21, 2023 · 1 comment
Open

Command unable to specify a "version" option. #63

mattrothenberg opened this issue Jun 21, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@mattrothenberg
Copy link

Hello!

I would like one of my commands to have a version option so that users can look up a resource by an optional version ID.

I've set my options as such:

export const options = zod.object({
	owner: zod.string().describe('Model owner'),
	name: zod.string().describe('Model name'),
	version: zod.string().optional().describe('Model version'),
	silent: zod.boolean().optional().describe('Silence output'),
});

I'm noticing, however, that no matter what the user passes via --version, the underlying app version is returned and the command never runs.

I'm not sure whether this is unexpected behavior, or something I'm doing silly. Probably the latter :) Let me know if I can provide any more detail.

@vadimdemedes
Copy link
Owner

Hey @mattrothenberg, yeah, version is defined by Pastel automatically and it always prints a program version when specified. I see two options here:

  1. Expose an config option for disabling a default version option. However, this means that CLI won't be able to display its version via -v or --version, which most users expect.

  2. Same as above, but a config option to disable version per command, rather than for an entire CLI.

  3. Disable the default version option when a command specifies its own version, like you do. However, this is the kind of implicit behavior I usually try to avoid, but it would be the most effortless solution for you.

I'll think more about this and I'd also appreciate your thoughts on what is the ideal behavior you'd expect here 😉

@vadimdemedes vadimdemedes added the enhancement New feature or request label Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants