0

I am working on a new Golang Cobra CLI, which handles several commands. I later on found out that there is already an existing Golang Cobra CLI that handles some commands that I will be covering in the new CLI, but not all. In other words, my new CLI cover all commands of the existing CLI with some extra commands.

Is it possible for us to link the existing CLI into the new CLI?

Note: I am not sure whether "link" is the best word to describe what I am interested to do. In case this is already answered before on SA, feel free to mark this as duplicate.

jtee
  • 79
  • 8
  • 2
    That depends on too many things, so the question becomes too broad. You could add more detail to your question about the existing tool to make it more specific. If the subcommands of the existing cli tool are in their own package with an exported identifier, then you could add all the commands from the old tool to your new tool; that would be the easiest. – Erwin Bolwidt Feb 25 '22 at 06:52

1 Answers1

1

I think your best bet is to fork the other repo with fewer commands, then edit it to add your commands. Assuming that both repos are open source.

If your code is closed-source then you can bring in their repo as a dependency.