forked from IBM/ibmcloud-cos-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
33 lines (27 loc) · 738 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
package main
import (
"os"
"github.com/IBM-Cloud/ibm-cloud-cli-sdk/plugin"
"github.com/IBM/ibmcloud-cos-cli/cos"
"github.com/urfave/cli"
)
// Start of the COS CLI Plugin Main program
func main() {
// var to hold exit code
exitCode := 0
// urfave-cli process some exit codes before bubble them up,
// this wrapper will help the exiterror bubble up until the error render
cli.OsExiter = wrapExiter(&exitCode)
// Start starts the plugin -
// Calling to the IBM Cloud CLI SDK
plugin.Start(new(cos.Plugin))
// Exit with an exit code
os.Exit(exitCode)
}
func wrapExiter(exitCodeHolder *int) func(int) {
return func(exitCode int) {
if exitCodeHolder != nil && *exitCodeHolder == 0 {
*exitCodeHolder = exitCode
}
}
}