package argvpb import "fmt" // verify the application has the needed function calls defined func verifyApplication(tmp interface{}) { // START NEEDED FUNCS // 2025/10/18 (review in a few months) if tmp, ok := tmp.(autoFuncI); ok { me.autoFunc = tmp.DoAutoComplete } else { panic("you need to make the function argv.DoAutoComplete()") } if tmp, ok := tmp.(mustParseI); ok { me.mustParseFunc = tmp.MustParse } else { panic("you must define in your app the function: func (args) MustParse() error") } if tmp, ok := tmp.(initGuiI); ok { me.initGuiFunc = tmp.InitGui if err := tmp.InitGui(); err != nil { fmt.Println("go.wit.com/gui failed to initialize", err) panic("gui failed to init") } } else { // panic("you must add this function to argv.go: (argv) func InitGui() error") } // END NEEDED FUNCS // 2025/10/18 (review in a few months) // TODO: SORT OUT STUFF BELOW HERE if tmp, ok := tmp.(examplesI); ok { me.examples = tmp.Examples } if tmp, ok := tmp.(exitI); ok { me.appExit = tmp.Exit } else { // panic("you need to make the function argv.Exit()") } } // WORKING ON START type mustParseI interface { MustParse() error } type autoFuncI interface { // Version returns the version string that will be printed on a line by itself // at the top of the help message. DoAutoComplete() 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. InitGui() error } // WORKING ON END // NOTSURE ABOUT START type appnameI interface { // Version returns the version string that will be printed on a line by itself // at the top of the help message. Appname() string } // deprecate type sendCompletionStringsI interface { // Version returns the version string that will be printed on a line by itself // at the top of the help message. SendCompletionStrings(*Argv) } type buildtimeI interface { Buildtime() (string, string) } type examplesI interface { // Version returns the version string that will be printed on a line by itself // at the top of the help message. Examples() string } type guiI interface { // Version returns the version string that will be printed on a line by itself // at the top of the help message. ArgvGui() error } type exitI interface { // allows a custom app Exit() Exit() }