summaryrefslogtreecommitdiffstats
path: root/cmd-sdks.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd-sdks.go')
-rw-r--r--cmd-sdks.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/cmd-sdks.go b/cmd-sdks.go
index 34f5409..bc9df15 100644
--- a/cmd-sdks.go
+++ b/cmd-sdks.go
@@ -89,6 +89,10 @@ func initCmdSdks(cmdDef *[]cli.Command) {
Name: "force",
Usage: "force SDK installation when already installed",
},
+ cli.BoolFlag{
+ Name: "short, s",
+ Usage: "short output, only print create sdk id (useful from scripting)",
+ },
},
},
{
@@ -214,6 +218,7 @@ func sdksInstall(ctx *cli.Context) error {
id := GetID(ctx)
file := ctx.String("file")
force := ctx.Bool("force")
+ shortOut := ctx.Bool("short")
if id == "" && file == "" {
return cli.NewExitError("id or file parameter or option must be set", 1)
@@ -281,7 +286,9 @@ func sdksInstall(ctx *cli.Context) error {
return cli.NewExitError(err, 1)
}
Log.Debugf("Result of %s: %v", url, newSdk)
- fmt.Printf("Installation of '%s' SDK successfully started.\n", newSdk.Name)
+ if !shortOut {
+ fmt.Printf("Installation of '%s' SDK successfully started.\n", newSdk.Name)
+ }
// TODO: trap CTRL+C and print question: "Installation of xxx is in progress, press 'a' to abort, 'b' to continue in background or 'c' to continue installation"
@@ -290,7 +297,11 @@ func sdksInstall(ctx *cli.Context) error {
case res := <-exitChan:
if res.code == 0 {
Log.Debugln("Exit successfully")
- fmt.Println("SDK ID " + newSdk.ID + " successfully installed.")
+ if shortOut {
+ fmt.Println(newSdk.ID)
+ } else {
+ fmt.Println("SDK ID " + newSdk.ID + " successfully installed.")
+ }
}
if res.error != "" {
Log.Debugln("Exit with ERROR: ", res.error)