Add errInvalidTheme and .Before should reply back to cli as error
This commit is contained in:
Generated
+2
-2
@@ -23,8 +23,8 @@
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/minio/cli",
|
||||
"Comment": "1.2.0-111-g432a101",
|
||||
"Rev": "432a1019ded42d1b34fb5f1aad60fb609245d5a1"
|
||||
"Comment": "1.2.0-112-g823349c",
|
||||
"Rev": "823349ce91e76834a4af0119d5bbc58fd4d2c6b0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/minio/minio-go",
|
||||
|
||||
-1
@@ -198,7 +198,6 @@ func (a *App) Run(arguments []string) (err error) {
|
||||
// RunAndExitOnError - Another entry point to the cli app, takes care of passing arguments and error handling
|
||||
func (a *App) RunAndExitOnError() {
|
||||
if err := a.Run(os.Args); err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,24 +91,6 @@ func (e errAliasExists) Error() string {
|
||||
return "Alias name: " + e.name + " exists"
|
||||
}
|
||||
|
||||
/*
|
||||
type errIsNotBucket struct {
|
||||
URL string
|
||||
}
|
||||
|
||||
func (e errIsNotBucket) Error() string {
|
||||
return "Not a bucket " + e.URL
|
||||
}
|
||||
|
||||
// errInvalidAuthKeys - invalid authorization keys
|
||||
type errInvalidAuthKeys struct {
|
||||
}
|
||||
|
||||
func (e errInvalidAuthKeys) Error() string {
|
||||
return "Invalid authorization keys"
|
||||
}
|
||||
*/
|
||||
|
||||
type errInvalidSource struct {
|
||||
URL string
|
||||
}
|
||||
@@ -124,3 +106,11 @@ type errInvalidTarget struct {
|
||||
func (e errInvalidTarget) Error() string {
|
||||
return "Invalid target " + e.URL
|
||||
}
|
||||
|
||||
type errInvalidTheme struct {
|
||||
Theme string
|
||||
}
|
||||
|
||||
func (e errInvalidTheme) Error() string {
|
||||
return "Theme " + e.Theme + " is not supported."
|
||||
}
|
||||
|
||||
@@ -69,10 +69,7 @@ func getSystemData() map[string]string {
|
||||
pb.FormatBytes(int64(memstats.TotalAlloc)),
|
||||
pb.FormatBytes(int64(memstats.HeapAlloc)),
|
||||
pb.FormatBytes(int64(memstats.HeapSys)))
|
||||
platform := fmt.Sprintf("Host: %s | OS: %s | Arch: %s",
|
||||
host,
|
||||
runtime.GOOS,
|
||||
runtime.GOARCH)
|
||||
platform := fmt.Sprintf("Host: %s | OS: %s | Arch: %s", host, runtime.GOOS, runtime.GOARCH)
|
||||
goruntime := fmt.Sprintf("Version: %s | CPUs: %s", runtime.Version(), strconv.Itoa(runtime.NumCPU()))
|
||||
return map[string]string{
|
||||
"PLATFORM": platform,
|
||||
@@ -122,17 +119,20 @@ func main() {
|
||||
themeName := ctx.GlobalString("theme")
|
||||
switch {
|
||||
case console.IsValidTheme(themeName) != true:
|
||||
console.Fatals(ErrorMessage{
|
||||
err := iodine.New(errInvalidTheme{Theme: themeName}, nil)
|
||||
console.Errors(ErrorMessage{
|
||||
Message: fmt.Sprintf("Please choose from this list: %s.", console.GetThemeNames()),
|
||||
Error: fmt.Errorf("Theme ‘%s’ is not supported.", themeName),
|
||||
Error: err,
|
||||
})
|
||||
return err
|
||||
default:
|
||||
err := console.SetTheme(themeName)
|
||||
if err != nil {
|
||||
console.Fatals(ErrorMessage{
|
||||
console.Errors(ErrorMessage{
|
||||
Message: fmt.Sprintf("Failed to set theme ‘%s’.", themeName),
|
||||
Error: err,
|
||||
})
|
||||
return err
|
||||
}
|
||||
}
|
||||
checkConfig()
|
||||
|
||||
Reference in New Issue
Block a user