blob: 6d7efbd7abb9ccbd9a4e6bce89f5dba13334acf7 [file] [log] [blame]
// Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package main
import (
"log"
"os"
"github.com/maruel/subcommands"
"go.chromium.org/luci/auth"
"go.chromium.org/luci/auth/client/authcli"
"go.chromium.org/luci/client/versioncli"
"go.chromium.org/luci/hardcoded/chromeinfra"
)
// Version must be updated on functional change (behavior, arguments, supported commands).
const version = "0.0.1"
func getApplication(defaultAuthOpts auth.Options) *subcommands.DefaultApplication {
return &subcommands.DefaultApplication{
Name: "lkg",
Title: "Tool to query a variety of last-known-good entities.",
Commands: []*subcommands.Command{
cmdBuild(defaultAuthOpts),
cmdRevision(defaultAuthOpts),
authcli.SubcommandInfo(defaultAuthOpts, "whoami", false),
authcli.SubcommandLogin(defaultAuthOpts, "login", false),
authcli.SubcommandLogout(defaultAuthOpts, "logout", false),
versioncli.CmdVersion(version),
subcommands.CmdHelp,
},
}
}
func main() {
log.SetFlags(log.Lmicroseconds)
app := getApplication(chromeinfra.DefaultAuthOptions())
os.Exit(subcommands.Run(app, nil))
}