go.fuchsia.dev/infra@v0.0.0-20240507153436-9b593402251b/cmd/size_diff/main.go (about)

     1  // Copyright 2021 The Fuchsia Authors.
     2  // Use of this source code is governed by a BSD-style license that can be
     3  // found in the LICENSE file.
     4  
     5  // The size_diff tool takes two binary_sizes objects and computes their diff.
     6  package main
     7  
     8  import (
     9  	"log"
    10  	"os"
    11  
    12  	"github.com/maruel/subcommands"
    13  
    14  	"go.chromium.org/luci/auth"
    15  	"go.chromium.org/luci/auth/client/authcli"
    16  	"go.chromium.org/luci/client/versioncli"
    17  	"go.chromium.org/luci/hardcoded/chromeinfra"
    18  )
    19  
    20  const version = "0.1.0"
    21  
    22  func getApplication(defaultAuthOpts auth.Options) *subcommands.DefaultApplication {
    23  	defaultAuthOpts.Scopes = []string{auth.OAuthScopeEmail}
    24  	return &subcommands.DefaultApplication{
    25  		Name:  "size_diff",
    26  		Title: "Tool to compute binary size diffs.",
    27  		Commands: []*subcommands.Command{
    28  			cmdCI(defaultAuthOpts),
    29  			cmdManifest(defaultAuthOpts),
    30  			authcli.SubcommandInfo(defaultAuthOpts, "whoami", false),
    31  			authcli.SubcommandLogin(defaultAuthOpts, "login", false),
    32  			authcli.SubcommandLogout(defaultAuthOpts, "logout", false),
    33  			versioncli.CmdVersion(version),
    34  			subcommands.CmdHelp,
    35  		},
    36  	}
    37  }
    38  
    39  func main() {
    40  	log.SetFlags(log.Lmicroseconds)
    41  	app := getApplication(chromeinfra.DefaultAuthOptions())
    42  	os.Exit(subcommands.Run(app, nil))
    43  }