Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 /* | |
| 6 Root command of the SDK; does most of the heavy lifting. | |
| 7 */ | |
| 8 | |
| 9 package help | |
| 10 | |
| 11 import ( | |
| 12 "os" | |
| 13 ) | |
| 14 | |
| 15 // Variables for flags which apply to all subcommands | |
| 16 var verbose int | |
| 17 | |
| 18 // RootCmd is the root of the command tree. All subcommands attach to this one. | |
| 19 // Also defines some persistent flags which are available to all subcommands. | |
| 20 // Does not have a top-level Run function; instead just prints Usage. | |
| 21 var RootCmd = &cobra.Command{ | |
|
seanmccullough1
2016/04/29 00:54:36
where is cobra imported?
agable
2016/05/05 23:59:42
This whole file is gone (old patchset).
| |
| 22 Use: "cr", | |
| 23 Short: "Entry point and module manager for the Chromium command-line SDK ", | |
| 24 Long: `Entry point and module manager for the Chromium command-line SDK. | |
| 25 | |
| 26 Run "cr help", "cr help [command]", or "cr [command] --help" for documentation.` , | |
| 27 } | |
| 28 | |
| 29 // Execute crawls the tree of commands (starting at RootCmd) to find the | |
| 30 // appropriate function to execute. Prints usage is none is found. | |
| 31 func Execute() { | |
| 32 ctx := context.Background() | |
| 33 ctx = gologger.StdConfig.Use(ctx) | |
| 34 if err := RootCmd.Execute(); err != nil { | |
| 35 logging.Errorf(ctx, "%v\n", err) | |
| 36 os.Exit(-1) | |
| 37 } | |
| 38 } | |
| 39 | |
| 40 func init() { | |
| 41 RootCmd.PersistentFlags().CountVarP(&verbose, "verbose", "v", "Turn on v erbose logging") | |
| 42 } | |
| OLD | NEW |