aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-11-06 18:11:19 +0100
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-11-06 18:11:19 +0100
commit18893f9ed5f003133fad06b42a381effe4017bab (patch)
tree248d6fb1f6b180a72da8f17e3bc716c7e45d9549
parent2ef44971f04a1f6c3e05cf40ac82c7f18f255b58 (diff)
Improved help/description .
-rw-r--r--.vscode/settings.json10
-rw-r--r--main.go37
2 files changed, 37 insertions, 10 deletions
diff --git a/.vscode/settings.json b/.vscode/settings.json
index a659df9..d0f7e6d 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,5 +1,15 @@
// Place your settings in this file to overwrite default and user settings.
{
+
+ // The number of spaces a tab is equal to. This setting is overriden based on the file contents when `editor.detectIndentation` is on.
+ "editor.tabSize": 4,
+
+ // Insert spaces when pressing Tab. This setting is overriden based on the file contents when `editor.detectIndentation` is on.
+ "editor.insertSpaces": true,
+
+ // When opening a file, `editor.tabSize` and `editor.insertSpaces` will be detected based on the file contents.
+ "editor.detectIndentation": false,
+
// Configure glob patterns for excluding files and folders.
"files.exclude": {
"**/.tmp": true,
diff --git a/main.go b/main.go
index 508bbdd..eec23da 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,14 @@ func main() {
app.Before = func(ctx *cli.Context) error {
var err error
+ // Don't init anything when user wants help
+ 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 != "" {