summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmd-projects.go10
-rw-r--r--cmd-sdks.go15
2 files changed, 22 insertions, 3 deletions
diff --git a/cmd-projects.go b/cmd-projects.go
index fc4bc22..8c12cbf 100644
--- a/cmd-projects.go
+++ b/cmd-projects.go
@@ -51,6 +51,10 @@ func initCmdProjects(cmdDef *[]cli.Command) {
Name: "server-path, sp",
Usage: "project server path (only used with pathmap type)",
},
+ cli.BoolFlag{
+ Name: "short, s",
+ Usage: "short output, only print create project id (useful from scripting)",
+ },
cli.StringFlag{
Name: "type, t",
Usage: "project type (pathmap|pm, cloudsync|sc)",
@@ -201,7 +205,11 @@ func projectsAdd(ctx *cli.Context) error {
return cli.NewExitError(err, 1)
}
- fmt.Printf("New project '%s' (id %v) successfully created.\n", newPrj.Label, newPrj.ID)
+ if ctx.Bool("short") {
+ fmt.Println(newPrj.ID)
+ } else {
+ fmt.Printf("New project '%s' (id %v) successfully created.\n", newPrj.Label, newPrj.ID)
+ }
return nil
}
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)