// Place your settings in this file to overwrite default and user settings.
{
- // Specify GOPATH here to override the one that is set as environment variable. The inferred GOPATH from workspace root overrides this, if go.inferGopath is set to true.
- "go.gopath": "${workspaceRoot}/../../../../../..",
-
- // 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": true,
-
- // Configure glob patterns for excluding files and folders.
- "files.exclude": {
- "**/.tmp": true,
- ".git": true,
- "glide.lock": true,
- "vendor": true,
- "debug": true,
- "bin": true,
- "tools": true
- },
- // Words to add to dictionary for a workspace.
- "cSpell.words": [
- "apiv",
- "iosk",
- "zhouhui",
- "ldflags",
- "socketio",
- "xdsconfig",
- "sdkid",
- "godotenv",
- "crosssdk",
- "prjs",
- "xaapiv",
- "urfave",
- "sebd",
- "golib",
- "joho",
- "XDSAGENT",
- "reflectme",
- "franciscocpg",
- "gerrit",
- "EVTSDK",
- "tgts",
- "sigs",
- "rdfs",
- "goselect",
- "creack",
- "Sillyf"
- ]
-}
+ // Specify GOPATH here to override the one that is set as environment variable. The inferred GOPATH from workspace root overrides this, if go.inferGopath is set to true.
+ "go.gopath": "${workspaceRoot}/../../../../../..",
+ // 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": true,
+ // Configure glob patterns for excluding files and folders.
+ "files.exclude": {
+ "**/.tmp": true,
+ ".git": true,
+ "glide.lock": true,
+ "vendor": true,
+ "debug": true,
+ "bin": true,
+ "tools": true
+ },
+ // Words to add to dictionary for a workspace.
+ "cSpell.words": [
+ "apiv",
+ "iosk",
+ "zhouhui",
+ "ldflags",
+ "socketio",
+ "xdsconfig",
+ "sdkid",
+ "godotenv",
+ "crosssdk",
+ "prjs",
+ "xaapiv",
+ "urfave",
+ "sebd",
+ "golib",
+ "joho",
+ "XDSAGENT",
+ "reflectme",
+ "franciscocpg",
+ "gerrit",
+ "EVTSDK",
+ "tgts",
+ "sigs",
+ "rdfs",
+ "goselect",
+ "creack",
+ "Sillyf"
+ ]
+}
\ No newline at end of file
}
func projectsGet(ctx *cli.Context) error {
- id := GetID(ctx)
+ id := GetID(ctx, "XDS_PROJECT_ID")
if id == "" {
return cli.NewExitError("id parameter or option must be set", 1)
}
func projectsRemove(ctx *cli.Context) error {
var res xaapiv1.ProjectConfig
- id := GetID(ctx)
+ id := GetID(ctx, "XDS_PROJECT_ID")
if id == "" {
return cli.NewExitError("id parameter or option must be set", 1)
}
}
func projectsSync(ctx *cli.Context) error {
- id := GetID(ctx)
+ id := GetID(ctx, "XDS_PROJECT_ID")
if id == "" {
return cli.NewExitError("id parameter or option must be set", 1)
}
}
func sdksGet(ctx *cli.Context) error {
- id := GetID(ctx)
+ id := GetID(ctx, "XDS_SDK_ID")
if id == "" {
return cli.NewExitError("id parameter or option must be set", 1)
}
}
func sdksInstall(ctx *cli.Context) error {
- id := GetID(ctx)
+ id := GetID(ctx, "XDS_SDK_ID")
file := ctx.String("file")
force := ctx.Bool("force")
shortOut := ctx.Bool("short")
}
func sdksUnInstall(ctx *cli.Context) error {
- id := GetID(ctx)
+ id := GetID(ctx, "XDS_SDK_ID")
if id == "" {
return cli.NewExitError("id parameter or option must be set", 1)
}
}
func sdksAbort(ctx *cli.Context) error {
- id := GetID(ctx)
+ id := GetID(ctx, "XDS_SDK_ID")
if id == "" {
return cli.NewExitError("id parameter or option must be set", 1)
}
}
func targetsGet(ctx *cli.Context) error {
- id := GetID(ctx)
+ id := GetID(ctx, "XDS_TARGET_ID")
if id == "" {
return cli.NewExitError("id parameter or option must be set", 1)
}
func targetsRemove(ctx *cli.Context) error {
var res xaapiv1.TargetConfig
- id := GetID(ctx)
+ id := GetID(ctx, "XDS_TARGET_ID")
if id == "" {
return cli.NewExitError("id parameter or option must be set", 1)
}
}
// Allow to create a new terminal when only target id is set
- idArg = GetIDName(ctx, "id")
+ idArg = GetIDName(ctx, "id", "XDS_TARGET_ID")
if idArg == "" {
return nil, nil, fmt.Errorf("id or termId argument must be set")
}
import (
"encoding/json"
"fmt"
+ "os"
"sort"
"strconv"
"strings"
}
// GetID Return a string ID set with --id option or as simple parameter
-func GetID(ctx *cli.Context) string {
- return GetIDName(ctx, "id")
+func GetID(ctx *cli.Context, idEnvVarName string) string {
+ return GetIDName(ctx, "id", idEnvVarName)
}
// GetIDName Return a string ID set with --XXX option or as simple parameter
-func GetIDName(ctx *cli.Context, idName string) string {
+func GetIDName(ctx *cli.Context, idName, idEnvVarName string) string {
if idName == "" {
return ""
}
+
+ // Get id set using option --id
id := ctx.String(idName)
+
+ // Check if id has been set using env variable
+ envSdkid, _ := os.LookupEnv(idEnvVarName)
+
+ // Support as 1st arg without --id option string (for example xds-cli sdk install 123456)
idArgs := ctx.Args().First()
- if id == "" && idArgs != "" {
+
+ // Set or overwrite id using first arg (knowing that 1st is overwrite env variable)
+ if (id == "" && idArgs != "") || (envSdkid != "" && idArgs != "") {
id = idArgs
}
return id