1

I have a project that works with modules, which are called with CLI commands (ie. myapp foo calls the foo module).

Modules can be builtin or user defined. I defined some builtin modules with Cobra commands and it works well. Now I want to handle user defined modules, so myapp bar will look for a bar file in some folder, since the bar command is not defined.

How to do this without having a unknown command "bar" error, or to add commands at runtime?

roipoussiere
  • 5,142
  • 3
  • 28
  • 37

1 Answers1

1

Got it!

It's possible to do this with AddCommand.

roipoussiere
  • 5,142
  • 3
  • 28
  • 37