blob: d5afdf3f6fa777bbe97f530b7cb803b0b61182ac [file] [log] [blame]
// Copyright 2019 The Chromium 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 (
"context"
"os"
"github.com/maruel/subcommands"
"go.chromium.org/luci/auth/client/authcli"
"go.chromium.org/luci/common/cli"
"go.chromium.org/luci/common/data/rand/mathrand"
"go.chromium.org/luci/common/logging/gologger"
"infra/cmd/stable_version2/internal/cmd/dump"
"infra/cmd/stable_version2/internal/cmd/meta"
"infra/cmd/stable_version2/internal/cmd/omaha"
"infra/cmd/stable_version2/internal/cmd/validateconfig"
"infra/cmd/stable_version2/internal/site"
)
func getApplication() *cli.Application {
return &cli.Application{
Name: "stable_version2",
Title: "Read and write stable versions",
Context: func(ctx context.Context) context.Context {
return gologger.StdConfig.Use(ctx)
},
Commands: []*subcommands.Command{
subcommands.CmdHelp,
subcommands.Section("Authentication"),
authcli.SubcommandInfo(site.DefaultAuthOptions, "whoami", false),
authcli.SubcommandLogin(site.DefaultAuthOptions, "login", false),
authcli.SubcommandLogout(site.DefaultAuthOptions, "logout", false),
subcommands.Section("Utility"),
dump.Cmd,
subcommands.Section("Validation"),
validateconfig.Cmd,
subcommands.Section("Misc"),
meta.Update,
meta.Version,
subcommands.Section("Internal use (not for direct human use)"),
omaha.UpdateWithOmaha,
},
}
}
func main() {
mathrand.SeedRandomly()
os.Exit(subcommands.Run(getApplication(), nil))
}