Update pre-commit-go to pcg.
1 file changed
tree: 6aaba28fb1e54b52a7385b69e8a90619b1e3e0be
  1. sample-complex/
  2. sample-simple/
  3. subcommandstest/
  4. .gitignore
  5. .travis.yml
  6. LICENSE
  7. logger.go
  8. README.md
  9. subcommands.go
  10. subcommands_test.go
README.md

subcommands golang library

This package permits a Go application to implement subcommands support similar to what is supported by the ‘go’ tool.

The library is designed so that the test cases can run concurrently. Using global flags variables is discouraged to keep your program testable conccurently.

The intented command is found via heuristic search;

  • exact match
  • unique prefix, e.g. lo will run longcommand as long as there's no command with the same prefix.
  • case insensitivity; for those weird enough to use Upper Cased Commands.
  • levenshtein distance; where longcmmand or longcmomand will properly trigger longcommand.

GoDoc Build Status Coverage Status

Examples

  • See sample-simple for a barebone sample skeleton usable as-is.
  • See sample-complex for a complex sample using advanced features.
  • See module subcommands/subcommandstest for tools to help testing an application using subcommands. One of the main benefit is t.Parallel() just works, because subcommands help wrapping global variables.