-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
35 lines (30 loc) · 1018 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
"fmt"
"os"
"github.com/orange-cloudavenue/cloudavenue-cli/cmd"
"github.com/orange-cloudavenue/cloudavenue-cli/pkg/errorscustom"
)
const (
errorMessage = "** Error **: "
)
//go:generate go run tools/tools.go
func main() {
if err := cmd.Execute(); err != nil {
switch {
case errorscustom.IsNoHomeDirectory(err):
fmt.Println(errorMessage+"Check your system to set and access write to your home directory.", err)
case errorscustom.IsConfigFile(err):
fmt.Println(errorMessage+"Please check your configuration file.", err)
case errorscustom.IsClient(err):
fmt.Println(errorMessage+"Unable to initialize client", err)
fmt.Println("Please check your configuration (https://orange-cloudavenue.github.io/cloudavenue-cli/getting-started/configuration/).")
case errorscustom.IsNotValidOutput(err):
fmt.Println(errorMessage+"Please read help to check format output is possible.", err)
default:
fmt.Println(errorMessage + err.Error())
}
os.Exit(1)
}
os.Exit(0)
}