Code Review
/
src
/
xds
/
xds-cli.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Fixed crach when no XDS Server connected.
[src/xds/xds-cli.git]
/
cmd-projects.go
diff --git
a/cmd-projects.go
b/cmd-projects.go
index
713e3f8
..
8c12cbf
100644
(file)
--- 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 <sebastien@iot.bzh>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Author Sebastien Douheret <sebastien@iot.bzh>
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@
-22,7
+22,7
@@
import (
"fmt"
"strings"
"fmt"
"strings"
- "g
ithub.com/iotbzh/xds-agen
t/lib/xaapiv1"
+ "g
errit.automotivelinux.org/gerrit/src/xds/xds-agent.gi
t/lib/xaapiv1"
"github.com/urfave/cli"
)
"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)",
},
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)",
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)
}
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
}
return nil
}