| 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 "github.com/maruel/subcommands" | 8 "github.com/maruel/subcommands" |
| 9 "golang.org/x/net/context" | 9 "golang.org/x/net/context" |
| 10 | 10 |
| 11 "github.com/luci/luci-go/vpython/venv" | 11 "github.com/luci/luci-go/vpython/venv" |
| 12 | 12 |
| 13 "github.com/luci/luci-go/common/cli" | 13 "github.com/luci/luci-go/common/cli" |
| 14 "github.com/luci/luci-go/common/errors" | 14 "github.com/luci/luci-go/common/errors" |
| 15 "github.com/luci/luci-go/common/logging" | 15 "github.com/luci/luci-go/common/logging" |
| 16 ) | 16 ) |
| 17 | 17 |
| 18 var subcommandDelete = &subcommands.Command{ | 18 var subcommandDelete = &subcommands.Command{ |
| 19 UsageLine: "delete", | 19 UsageLine: "delete", |
| 20 ShortDesc: "deletes existing VirtualEnv", | 20 ShortDesc: "deletes existing VirtualEnv", |
| 21 LongDesc: "offers deletion options for existing vpython VirtualEnv inst
allatioins", | 21 LongDesc: "offers deletion options for existing vpython VirtualEnv inst
allatioins", |
| 22 Advanced: false, | 22 Advanced: false, |
| 23 CommandRun: func() subcommands.CommandRun { | 23 CommandRun: func() subcommands.CommandRun { |
| 24 var cr deleteCommandRun | 24 var cr deleteCommandRun |
| 25 | 25 |
| 26 fs := cr.GetFlags() | 26 fs := cr.GetFlags() |
| 27 » » fs.BoolVar(&cr.all, "all", false, "Delete all VirtualEnv environ
ments, rather than the current ones.") | 27 » » fs.BoolVar(&cr.all, "all", cr.all, "Delete all VirtualEnv enviro
nments, rather than the current ones.") |
| 28 | 28 |
| 29 return &cr | 29 return &cr |
| 30 }, | 30 }, |
| 31 } | 31 } |
| 32 | 32 |
| 33 type deleteCommandRun struct { | 33 type deleteCommandRun struct { |
| 34 subcommands.CommandRunBase | 34 subcommands.CommandRunBase |
| 35 | 35 |
| 36 all bool | 36 all bool |
| 37 } | 37 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 } | 70 } |
| 71 | 71 |
| 72 if failures > 0 { | 72 if failures > 0 { |
| 73 return errors.Reason("failed to delete %(count)d environ
ment(s)"). | 73 return errors.Reason("failed to delete %(count)d environ
ment(s)"). |
| 74 D("count", failures). | 74 D("count", failures). |
| 75 Err() | 75 Err() |
| 76 } | 76 } |
| 77 return nil | 77 return nil |
| 78 }) | 78 }) |
| 79 } | 79 } |
| OLD | NEW |