summaryrefslogtreecommitdiffstats
path: root/gdb-xds.go
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2018-06-27 17:17:22 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2018-06-27 17:17:24 +0200
commitfe18836ebc98dbedfe01c3e88125cb97f2108075 (patch)
tree7a5d00a337850d4663884b78abb4d195223f32af /gdb-xds.go
parentb14158a8c5c4fdd440bc19c5c72f25a15699d29a (diff)
Improved helper message
Set valid project and sdk IDs in helper message. Change-Id: Icd9851e2e62d03e00197eed0e9c117d0f656ec93 Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'gdb-xds.go')
-rw-r--r--gdb-xds.go15
1 files changed, 10 insertions, 5 deletions
diff --git a/gdb-xds.go b/gdb-xds.go
index 54f2270..927901b 100644
--- a/gdb-xds.go
+++ b/gdb-xds.go
@@ -422,14 +422,18 @@ func (g *GdbXds) SendSignal(sig os.Signal) error {
//***** Private functions *****
func (g *GdbXds) printProjectsList() (int, error) {
+ var prjExample *xaapiv1.ProjectConfig
+ var sdkExample *xaapiv1.SDK
+
writer := new(tabwriter.Writer)
writer.Init(os.Stdout, 0, 8, 0, '\t', 0)
msg := ""
if len(g.projects) > 0 {
fmt.Fprintln(writer, "List of existing projects (use: export XDS_PROJECT_ID=<< ID >>):")
fmt.Fprintln(writer, "ID \t Label")
- for _, f := range g.projects {
+ for ii, f := range g.projects {
fmt.Fprintf(writer, " %s \t %s\n", f.ID, f.Label)
+ prjExample = &g.projects[ii]
}
}
@@ -440,21 +444,22 @@ func (g *GdbXds) printProjectsList() (int, error) {
}
fmt.Fprintln(writer, "\nList of installed cross SDKs (use: export XDS_SDK_ID=<< ID >>):")
fmt.Fprintln(writer, "ID \t Name")
- for _, s := range sdks {
+ for ii, s := range sdks {
if s.Status == xaapiv1.SdkStatusInstalled {
fmt.Fprintf(writer, " %s \t %s\n", s.ID, s.Name)
+ sdkExample = &sdks[ii]
}
}
- if len(g.projects) > 0 && len(sdks) > 0 {
+ if prjExample != nil && sdkExample != nil {
fmt.Fprintln(writer, "")
fmt.Fprintln(writer, "For example: ")
if runtime.GOOS == "windows" {
fmt.Fprintf(writer, " SET XDS_PROJECT_ID=%s && SET XDS_SDK_ID=%s && %s -x myGdbConf.ini\n",
- g.projects[0].ID[:8], sdks[0].ID[:8], AppName)
+ prjExample.ID[:8], sdkExample.ID[:8], AppName)
} else {
fmt.Fprintf(writer, " XDS_PROJECT_ID=%s XDS_SDK_ID=%s %s -x myGdbConf.ini\n",
- g.projects[0].ID[:8], sdks[0].ID[:8], AppName)
+ prjExample.ID[:8], sdkExample.ID[:8], AppName)
}
}
fmt.Fprintln(writer, "")