top

Package authcli implements authentication related CLI subcommands.

It can be used from CLI tools that want customize authentication configuration from the command line.

It use luci-go/common/cli.GetContext() to grab a context for logging, so callers should prefer using cli.Application for hosting subcommands and making the context:

import (
  "github.com/luci/luci-go/client/authcli"
  "github.com/luci/luci-go/common/cli"
)

var application = &cli.Application{
	Name:  "app_name",

	Context: func(ctx context.Context) context.Context {
		... configure logging, etc. ...
		return ctx
	},

	Commands: []*subcommands.Command{
		authcli.SubcommandInfo(auth.Options{}, "auth-info"),
		authcli.SubcommandLogin(auth.Options{}, "auth-login"),
		authcli.SubcommandLogout(auth.Options{}, "auth-logout"),
		...
	},
}

func main() {
	os.Exit(subcommands.Run(application, nil))
}

Imports 5 package(s) ΒΆ

  1. github.com/maruel/subcommands
  2. golang.org/x/net/context
  3. golang.org/x/net/context/ctxhttp
  4. github.com/luci/luci-go/common/auth
  5. github.com/luci/luci-go/common/cli