X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=cmd-projects.go;h=8c12cbf9ae57bdae9a005c971a19aa7bc25949a8;hb=2f718c72a51850f3ab1af8d93a381b594fb2c825;hp=713e3f8899d7b3cf07eecceb401967d2d8a769df;hpb=f2b2c900fcc8f02a5e532794772ed5359618c3cc;p=src%2Fxds%2Fxds-cli.git diff --git a/cmd-projects.go b/cmd-projects.go index 713e3f8..8c12cbf 100644 --- a/cmd-projects.go +++ b/cmd-projects.go @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 "IoT.bzh" + * Copyright (C) 2017-2018 "IoT.bzh" * Author Sebastien Douheret * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,7 +22,7 @@ import ( "fmt" "strings" - "github.com/iotbzh/xds-agent/lib/xaapiv1" + "gerrit.automotivelinux.org/gerrit/src/xds/xds-agent.git/lib/xaapiv1" "github.com/urfave/cli" ) @@ -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 }