X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=main.go;h=090144d9bab0e96ae23c0ad9ca758dae73930eb1;hb=7fce75df06a85c21083544fcbdcd73d122e3ca52;hp=508bbdd35e1f881048216be44fb37d11ff8c606b;hpb=0df439bb10fe1f178b32aff8467e9671888eac4b;p=src%2Fxds%2Fxds-cli.git diff --git a/main.go b/main.go index 508bbdd..090144d 100644 --- a/main.go +++ b/main.go @@ -76,16 +76,25 @@ func main() { } appUsage := fmt.Sprintf("command line tool for X(cross) Development System.") appDescription := fmt.Sprintf("%s utility for X(cross) Development System\n", AppName) - /* SEB UPDATE DOC - appDescription += ` - xds-cli configuration is driven either by environment variables or by command line - options or using a config file knowning that the following priority order is used: - 1. use option value (for example use project ID set by --id option), - 2. else use variable 'XDS_xxx' (for example 'XDS_PROJECT_ID' variable) when a - config file is specified with '--config|-c' option, - 3. else use 'XDS_xxx' (for example 'XDS_PROJECT_ID') environment variable. - ` - */ + appDescription += ` + Setting of global options is driven either by environment variables or by command + line options or using a config file knowning that the following priority order is used: + 1. use option value (for example --url option), + 2. else use variable 'XDS_xxx' (for example 'XDS_SERVER_URL' variable) when a + config file is specified with '--config|-c' option, + 3. else use 'XDS_xxx' (for example 'XDS_SERVER_URL') environment variable. + + Examples: + # Get help of 'projects' sub-command + ` + AppName + ` projects --help + + # List all SDKs + ` + AppName + ` sdks ls + + # Add a new project + ` + AppName + ` prj add --label="myProject" --type=cs --path=$HOME/xds-workspace/myProject +` + // Create a new App instance app := cli.NewApp() app.Name = AppName @@ -160,6 +169,17 @@ func main() { app.Before = func(ctx *cli.Context) error { var err error + // Don't init anything when no argument or help option is set + if ctx.NArg() == 0 { + return nil + } + for _, a := range ctx.Args() { + switch a { + case "-h", "--h", "-help", "--help": + return nil + } + } + // Load config file if requested confFile := ctx.String("config") if confFile != "" { @@ -237,6 +257,7 @@ func XdsConnInit(ctx *cli.Context) error { return cli.NewExitError(errmsg, 1) } HTTPCli.SetLogLevel(ctx.String("loglevel")) + Log.Infoln("HTTP session ID : ", HTTPCli.GetClientID()) // Create io Websocket client Log.Debugln("Connecting IO.socket client on ", baseURL)