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

How to print command helpscreen #2008

Open
unera opened this issue Nov 20, 2024 · 1 comment
Open

How to print command helpscreen #2008

unera opened this issue Nov 20, 2024 · 1 comment
Labels
area/v2 relates to / is being considered for v2 kind/question someone asking a question status/triage maintainers still need to look into this

Comments

@unera
Copy link

unera commented Nov 20, 2024

From time to time I want to show an error and then command helpscreen.

if args.Len() < 3 {
   fmt.Printf("You must choose at least 3 files!\")
   
  // --- the place 
   
   return cli.Exit("some text", 3)
}

How can I print the same screen as prints ./program help or ./program module help?

@unera unera added area/v2 relates to / is being considered for v2 kind/question someone asking a question status/triage maintainers still need to look into this labels Nov 20, 2024
@dearchap
Copy link
Contributor

@unera Depending on whether the command is a root command or is a subcommand you could use one of the following
ShowAppHelpAndExit or ShowSubcommandHelpAndExit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/v2 relates to / is being considered for v2 kind/question someone asking a question status/triage maintainers still need to look into this
Projects
None yet
Development

No branches or pull requests

2 participants