Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(620)

Side by Side Diff: vpython/application/subcommand_install.go

Issue 2705593003: vpython: Add application entry point. (Closed)
Patch Set: rebarse? Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « vpython/application/application.go ('k') | vpython/application/support.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file.
4
5 package application
6
7 import (
8 "github.com/luci/luci-go/common/cli"
9 "github.com/luci/luci-go/common/errors"
10 "github.com/luci/luci-go/common/logging"
11 "github.com/luci/luci-go/vpython/venv"
12
13 "github.com/maruel/subcommands"
14 "golang.org/x/net/context"
15 )
16
17 var subcommandInstall = &subcommands.Command{
18 UsageLine: "install",
19 ShortDesc: "installs the configured VirtualEnv",
20 LongDesc: "installs the configured VirtualEnv, but doesn't run any asso ciated commands",
21 Advanced: false,
22 CommandRun: func() subcommands.CommandRun {
23 return &installCommandRun{}
24 },
25 }
26
27 type installCommandRun struct {
28 subcommands.CommandRunBase
29 }
30
31 func (cr *installCommandRun) Run(app subcommands.Application, args []string, env subcommands.Env) int {
32 c := cli.GetContext(app, cr, env)
33 cfg := getConfig(c)
34
35 return run(c, func(c context.Context) error {
36 err := venv.With(c, cfg.Opts.EnvConfig, false, func(context.Cont ext, *venv.Env) error {
37 return nil
38 })
39 if err != nil {
40 return errors.Annotate(err).Reason("failed to setup the environment").Err()
41 }
42
43 logging.Infof(c, "Successfully setup the enviornment.")
44 return nil
45 })
46 }
OLDNEW
« no previous file with comments | « vpython/application/application.go ('k') | vpython/application/support.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698