Categorygithub.com/src-d/go-cli
modulepackage
0.0.0-20190821111025-f9dec40d74d8
Repository: https://github.com/src-d/go-cli.git
Documentation: pkg.go.dev

# README

go-cli GoDoc Build Status Build status codecov

A thin wrapper around common libraries used in our CLI apps (jessevdk/go-flags, src-d/go-log, pprof) to reduce boilerplate code and help in being more homogeneous with respect how our CLI work and look like.

It provides:

  • Struct tags to specify command names and descriptions (see below).
  • Default version subcommand.
  • Default completion subcommand for bash completion.
  • Flags and environment variables to setup logging with src-d/go-log.
  • Flags and environment variables to setup a http/pprof endpoint.
  • Signal handling.

For further details, look at doc.go.

License

Apache License Version 2.0, see LICENSE.

# Packages

No description provided by the author

# Functions

Handler returns an HTTP handler that serves the named profile.
InitCompletionCommand returns an additional AddCommand function that fills the CompletionCommand long description.
New creates a new App, including default values and sub commands.
NewNoDefaults creates a new App, without any of the default sub commands.

# Structs

App defines the CLI application that will be run.
Command implements the default group flags.
CompletionCommand defines the default completion command.
LogOptions defines logging flags.
PlainCommand should be embedded in a struct to indicate that it implements a command.
ProfilerOptions defines profiling flags.
VersionCommand defines he default version command.

# Interfaces

CommandAdder can be used to add subcommands.
ContextCommander is a cancellable commander.
Initializer interface provides an Init function.
SignalHandler can be implemented by a ContextCommander to override default signal handling (which is logging the signal and cancelling the context).

# Type aliases

No description provided by the author