flaeg icon indicating copy to clipboard operation
flaeg copied to clipboard

`PrintHelp` without reflection

Open nderjung opened this issue 5 years ago • 0 comments

I've stumbled unto the situation where I am using sub commands as a primary mechanism to interact with an application. This means that the rootCmd performs no particular action at all and is left blank. As a first issue, omitting the Run attribute yields a:

panic: runtime error: invalid memory address or nil pointer dereference

However, as primary issue, it would be beneficial to be able to simply print the help output to indicate to the user of the need to use a sub-command. Perhaps, simply, as flaeg.PrintHelp(config) or during the omission of the Run attribute.

In other cases, perhaps more abstractly in the concept of contextualizing arguments and their values, printing the help output would also be useful in the aim of decreasing the likelihood of program misuse.

Currently, the PrintHelp method is exported but requires most of the backbone of the flaeg application to perform reflection and config reading in order to work.

nderjung avatar Sep 10 '19 07:09 nderjung