go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/client/cmd/isolate/main.go (about) 1 // Copyright 2015 The LUCI Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // Package main is a .isolate compiler that compiles .isolate files into 16 // .isolated files and can also act as a client to an Isolate server. 17 // 18 // It is designed to be compatible with the reference python implementation at 19 // https://github.com/luci/luci-py/tree/master/client. 20 package main 21 22 import ( 23 "log" 24 "os" 25 26 "github.com/maruel/subcommands" 27 28 "go.chromium.org/luci/auth" 29 "go.chromium.org/luci/auth/client/authcli" 30 "go.chromium.org/luci/client/cmd/isolate/isolateimpl" 31 "go.chromium.org/luci/client/versioncli" 32 33 "go.chromium.org/luci/hardcoded/chromeinfra" 34 ) 35 36 func getApplication(defaultAuthOpts auth.Options) *subcommands.DefaultApplication { 37 return &subcommands.DefaultApplication{ 38 Name: "isolate", 39 Title: "isolate.py but faster", 40 // Keep in alphabetical order of their name. 41 Commands: []*subcommands.Command{ 42 isolateimpl.CmdArchive(defaultAuthOpts), 43 isolateimpl.CmdBatchArchive(defaultAuthOpts), 44 isolateimpl.CmdCheck(), 45 isolateimpl.CmdRemap(), 46 isolateimpl.CmdRun(), 47 subcommands.CmdHelp, 48 authcli.SubcommandInfo(defaultAuthOpts, "whoami", false), 49 authcli.SubcommandLogin(defaultAuthOpts, "login", false), 50 authcli.SubcommandLogout(defaultAuthOpts, "logout", false), 51 versioncli.CmdVersion(isolateimpl.IsolateVersion), 52 }, 53 } 54 } 55 56 func main() { 57 log.SetFlags(log.Lmicroseconds) 58 app := getApplication(chromeinfra.DefaultAuthOptions()) 59 os.Exit(subcommands.Run(app, nil)) 60 }