{"repo":"bep/simplecobra","free":true,"listed":false,"github":"https://github.com/bep/simplecobra","clone":"git clone https://github.com/bep/simplecobra.git","description":"A simpler API for the popular Cobra CLI.","language":"Go","stars":57,"topics":["golang","go-library","cli","command-line-tool"],"license":"MIT","category":"cli-tools","readme_excerpt":"So, Cobra is a Go CLI library with a feature set that's hard to resist for bigger applications (autocompletion, docs and man pages auto generation etc.). But it's also complex to use beyond the simplest of applications. This package was built to help rewriting Hugo's commands package to something that's easier to understand and maintain. I welcome suggestions to improve/simplify this further, but the core idea is that the command graph gets built in one go with a tree of struct pointers implementing a simple Commander interface: The Init method allows for flag compilation, referencing the parent and root etc. If needed, the full Cobra command is still available. There's a runnable example in the documentation, but the gist of it is: Differences to Cobra You have access to the cobra.Command pointer so there's not much you cannot do with this project compared to the more low-level Cobra, but there's one small, but important difference: Cobra only treats the first level of misspelled commands as an unknown command with \"Did you mean this?\" suggestions, see see this issue for more context. The reason for this is the ambiguity between sub-command names and command arguments, but that is throwing away a very useful feature for a not very good reason. We recently rewrote Hugo's CLI using this package, and found only one sub command that needed to be adjusted to avoid this ambiguity.","default_branch":null,"files":null,"tree":[],"storefront":"/r/bep","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/bep/simplecobra/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}