Skip to content

Feature: Ability to parse arguments without execution #647

@andrewthauer

Description

@andrewthauer

I think it would be useful if it were possible to parse the command line arguments without also executing the command actions. This would allow you add some logic in between parsing and execution.

A simple use case would be that you want to run a periodic check on startup, but only run for certain commands. For example you run a doctor command every day, but say you have a shell hook command (e.g. eval "$(my-cli hook zsh)") which you always want to be fast and never run the doctor checking logic when the hook command is run. The same could be said for auto update checking, etc.

NOTE: I've been able to hack this by adding custom parsing logic before calling rootCommand.parse. However, this is not ideal as my custom parsing logic doesn't have all the same logic as the cliffy parse command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions