X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?p=src%2Fxds%2Fxds-cli.git;a=blobdiff_plain;f=cmd-sdks.go;h=bc9df15f2877dd40a917249eb9db9cd34f002ef1;hp=34f5409341349550a32c8ea1b829dd699daf2fc5;hb=a653132a916cfdc8576e14f9e8b7445f615803cc;hpb=75fbc67b5acf3258b604fc53ec096f46fc743270 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)