-
Notifications
You must be signed in to change notification settings - Fork 562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
snap: do exit 0 on install/remove if that snap is already installed or already removed #2292
Changes from all commits
6d28db7
9667377
db314fd
208ab18
68e4d5a
dd969d3
7222285
a48d764
07cf03c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// -*- Mode: Go; indent-tabs-mode: t -*- | ||
|
||
/* | ||
* Copyright (C) 2014-2016 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 snap | ||
|
||
import "fmt" | ||
|
||
type AlreadyInstalledError struct { | ||
Snap string | ||
} | ||
|
||
func (e AlreadyInstalledError) Error() string { | ||
return fmt.Sprintf("snap %q is already installed", e.Snap) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps a place to add i18n (later) |
||
} | ||
|
||
type NotInstalledError struct { | ||
Snap string | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SnapRef ;-) |
||
Rev Revision | ||
} | ||
|
||
func (e NotInstalledError) Error() string { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice :) |
||
if e.Rev.Unset() { | ||
return fmt.Sprintf("snap %q is not installed", e.Snap) | ||
} | ||
return fmt.Sprintf("revision %s of snap %q is not installed", e.Rev, e.Snap) | ||
} | ||
|
||
type NoUpdateAvailableError struct { | ||
Snap string | ||
} | ||
|
||
func (e NoUpdateAvailableError) Error() string { | ||
return fmt.Sprintf("snap %q has no updates available", e.Snap) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A switch on the type would feel nicer here but you don't have to change it now.