| OLD | NEW |
| 1 // Copyright 2017 The LUCI Authors. All rights reserved. | 1 // Copyright 2017 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package application | 5 package application |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "flag" | 8 "flag" |
| 9 "fmt" | 9 "fmt" |
| 10 "io/ioutil" | 10 "io/ioutil" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 func (cfg *Config) mainDev(c context.Context, args []string) error { | 82 func (cfg *Config) mainDev(c context.Context, args []string) error { |
| 83 app := cli.Application{ | 83 app := cli.Application{ |
| 84 Name: "vpython", | 84 Name: "vpython", |
| 85 Title: "VirtualEnv Python Bootstrap (Development Mode)", | 85 Title: "VirtualEnv Python Bootstrap (Development Mode)", |
| 86 Context: func(context.Context) context.Context { | 86 Context: func(context.Context) context.Context { |
| 87 // Discard the entry Context and use the one passed to u
s. | 87 // Discard the entry Context and use the one passed to u
s. |
| 88 c := c | 88 c := c |
| 89 | 89 |
| 90 // Install our Config instance into the Context. | 90 // Install our Config instance into the Context. |
| 91 » » » c = withConfig(c, cfg) | 91 » » » return withConfig(c, cfg) |
| 92 | |
| 93 » » » // Drop down to Info level debugging. | |
| 94 » » » if logging.GetLevel(c) > logging.Info { | |
| 95 » » » » c = logging.SetLevel(c, logging.Info) | |
| 96 » » » } | |
| 97 » » » return c | |
| 98 }, | 92 }, |
| 99 Commands: []*subcommands.Command{ | 93 Commands: []*subcommands.Command{ |
| 100 subcommands.CmdHelp, | 94 subcommands.CmdHelp, |
| 101 subcommandInstall, | 95 subcommandInstall, |
| 102 subcommandVerify, | 96 subcommandVerify, |
| 103 }, | 97 }, |
| 104 } | 98 } |
| 105 | 99 |
| 106 return ReturnCodeError(subcommands.Run(&app, args)) | 100 return ReturnCodeError(subcommands.Run(&app, args)) |
| 107 } | 101 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 197 |
| 204 // Main is the main application entry point. | 198 // Main is the main application entry point. |
| 205 func (cfg *Config) Main(c context.Context) int { | 199 func (cfg *Config) Main(c context.Context) int { |
| 206 c = gologger.StdConfig.Use(c) | 200 c = gologger.StdConfig.Use(c) |
| 207 c = logging.SetLevel(c, logging.Warning) | 201 c = logging.SetLevel(c, logging.Warning) |
| 208 | 202 |
| 209 return run(c, func(c context.Context) error { | 203 return run(c, func(c context.Context) error { |
| 210 return cfg.mainImpl(c, os.Args[1:]) | 204 return cfg.mainImpl(c, os.Args[1:]) |
| 211 }) | 205 }) |
| 212 } | 206 } |
| OLD | NEW |