diff options
| author | Jeff Carr <[email protected]> | 2025-10-18 10:23:59 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-18 10:23:59 -0500 |
| commit | 748ac1d8c6bb87c2c8e7c9e2db2608ee1a0a9979 (patch) | |
| tree | 625cb5f008951fb841b5558c97b52c9e3b96d4bf /interface.go | |
| parent | e7d680016ca9a0edb0815c32cc454d13e791d810 (diff) | |
almost there
Diffstat (limited to 'interface.go')
| -rw-r--r-- | interface.go | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/interface.go b/interface.go index a303515..a21a0b4 100644 --- a/interface.go +++ b/interface.go @@ -22,6 +22,14 @@ type writeHelpForAutocompleteI interface { WriteHelpForAutocomplete(string, ...string) error } +type writeHelpForAutocompleteDebugI interface { + WriteHelpForAutocompleteDebug(string, ...string) error +} + +type writeHelpI interface { + WriteHelp() error +} + type initGuiI interface { // Version returns the version string that will be printed on a line by itself // at the top of the help message. @@ -92,6 +100,18 @@ func findAppInfo(tmp interface{}) { helpWriteHelpForAutocomplete() } + if tmp, ok := tmp.(writeHelpForAutocompleteDebugI); ok { + me.writeHelpForAutocompleteDebugFunc = tmp.WriteHelpForAutocompleteDebug + } else { + helpWriteHelpForAutocompleteDebug() + } + + if tmp, ok := tmp.(writeHelpI); ok { + me.writeHelpFunc = tmp.WriteHelp + } else { + helpWriteHelp() + } + if tmp, ok := tmp.(parseFlagsI); ok { me.parseFlagsFunc = tmp.ParseFlags } else { @@ -144,6 +164,30 @@ func findAppInfo(tmp interface{}) { } } +func helpWriteHelp() { + log.Info("") + log.Info("// add this funcgion: this will print the help") + log.Info("func (args) WriteHelp() error {") + log.Info(" me.pp.WriteHelp(os.Stderr)") + log.Info(" return nil") + log.Info("}") + log.Info("") + + panic("best to just copy the argv.template.go file from forge") +} + +func helpWriteHelpForAutocompleteDebug() { + log.Info("") + log.Info("// this will print the help for the subcmd") + log.Info("func (args) WriteHelpForAutocompleteDebug(part string, subcmd ...string) error {") + log.Info(" return argvpp.WriteHelpForAutocomplete(f, os.Stdout, part, subcmd...)") + log.Info("}") + log.Info("") + log.Info("cp ~/go/src/go.wit.com/apps/forge/argv.template.go .") + + panic("best to just copy the argv.template.go file from forge") +} + // func (p *Parser) WriteHelpForAutocomplete(stderr io.Writer, stdout io.Writer, partial string, subcommand ...string) error { // me.pp.WriteHelpForAutocomplete(os.Stderr, os.Stdout, partial, cmd...) func helpWriteHelpForAutocomplete() { |
