diff options
| author | Zygmunt Krynicki <zygmunt.krynicki@canonical.com> | 2015-12-03 17:05:22 +0100 |
|---|---|---|
| committer | Zygmunt Krynicki <zygmunt.krynicki@canonical.com> | 2015-12-03 17:05:22 +0100 |
| commit | 518b8d3ee7f061c38303e3574cd33e842911fc19 (patch) | |
| tree | aa3b2ee267cdccc23faa828b3cbf90b225b5b570 | |
| parent | 9b8fa112d77dfadbf08b647d5d6b5ebffb162123 (diff) | |
Add "snap unassign-cap" commandzyga-demo-caps1
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
| -rw-r--r-- | cmd/snap/cmd_unassign_cap.go | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/cmd/snap/cmd_unassign_cap.go b/cmd/snap/cmd_unassign_cap.go new file mode 100644 index 0000000000..09565656b8 --- /dev/null +++ b/cmd/snap/cmd_unassign_cap.go @@ -0,0 +1,50 @@ +// -*- Mode: Go; indent-tabs-mode: t -*- + +/* + * Copyright (C) 2014-2015 Canonical Ltd + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +package main + +import ( + "github.com/ubuntu-core/snappy/client" + "github.com/ubuntu-core/snappy/i18n" + "github.com/ubuntu-core/snappy/logger" +) + +type unassignCapOptions struct { + CapName string `positional-arg-name:"cap-name" description:"name of existing capability"` +} + +type cmdUnassignCap struct { + unassignCapOptions `positional-args:"true" required:"true"` +} + +var ( + shortUnassignCapHelp = i18n.G("Unassign a capability") + longUnassignCapHelp = i18n.G("This command unassigns a capability from a snap") +) + +func init() { + _, err := parser.AddCommand("unassign-cap", shortUnassignCapHelp, longUnassignCapHelp, &cmdUnassignCap{}) + if err != nil { + logger.Panicf("unable to add unassign-cap command: %v", err) + } +} + +func (x *cmdUnassignCap) Execute(args []string) error { + return client.New().UnassignCapability(x.CapName) +} |
