summaryrefslogtreecommitdiffstats
path: root/cmd-projects.go
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2018-01-23 15:38:23 +0100
committerSebastien Douheret <sebastien.douheret@iot.bzh>2018-01-23 15:38:23 +0100
commita653132a916cfdc8576e14f9e8b7445f615803cc (patch)
treef8cdaf28382c219ea6299cd53afd01d2343122ed /cmd-projects.go
parent75fbc67b5acf3258b604fc53ec096f46fc743270 (diff)
Added -s | --short option (useful from scripting)
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'cmd-projects.go')
-rw-r--r--cmd-projects.go10
1 files changed, 9 insertions, 1 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
}