I like the idea of putting each command in an ishell.Cmd. Yeah, I wasn't sure about the struct. Basically, I wanted an easy way to map my code
so, I was thinking a yaml file (I suppose I can create a struct from it). - clear - greet - user - (no user) #if no user is specified then greet all users - list - tables - acls - red - blue - exit I guess I was sort of looking for a GRPC (protoful file) model where I specify my specs in a file and go by it -- single source of truth. On Wednesday, April 18, 2018 at 9:09:08 AM UTC-4, matthe...@gmail.com wrote: > > Consider putting each ishell.Cmd in a separate file. Otherwise you can put > them in a slice var so you don’t have to AddCmd each one explicitly. > > I’m not sure what defining a struct accomplishes, can you provide more > detail? > > Matt > > On Tuesday, April 17, 2018 at 8:25:17 PM UTC-5, Keith Brown wrote: >> >> I am writing an interactive CLI tool which looks like this, using >> abisoft/ishell >> >> ./tool >> >>> help >> >> Sample Interactive Shell >> >>> help >> >> Commands: >> clear clear the screen >> greet greet user >> exit exit the program >> help display help >> >> >>> greet Someone Somewhere >> Hello Someone Somewhere >> >>> exit >> >> My tool will have many subcommands. >> >> So, greet <subcommand> < subcommand> and I was wondering what would be a >> good way to structure the program. I was thinking of putting everything in >> one large struct and have nested structs for commands similar to JSON >> encoded file. >> >> any thoughts? >> >> -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.