Skip to content

Commit d06324b

Browse files
committed
Show open ads in Windows only right now
1 parent 4bd7994 commit d06324b

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

cmd/modern/root.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,19 @@ type Root struct {
2424
// It sets the cli name, description, and subcommands, and adds global flags.
2525
// It also provides usage examples for sqlcmd.
2626
func (c *Root) DefineCommand(...cmdparser.CommandOptions) {
27+
// Example usage steps
28+
steps := []string{"sqlcmd create mssql --using https://aka.ms/AdventureWorksLT.bak"}
29+
30+
if runtime.GOOS == "windows" {
31+
steps = append(steps, "sqlcmd open ads")
32+
}
33+
34+
steps = append(steps, `sqlcmd query "SELECT @version"`)
35+
steps = append(steps, "sqlcmd delete")
36+
2737
examples := []cmdparser.ExampleOptions{{
2838
Description: "Install/Create, Query, Uninstall SQL Server",
29-
Steps: []string{
30-
"sqlcmd create mssql --using https://aka.ms/AdventureWorksLT.bak",
31-
"sqlcmd open ads",
32-
`sqlcmd query "SELECT @version"`,
33-
"sqlcmd delete"}}}
39+
Steps: steps}}
3440

3541
commandOptions := cmdparser.CommandOptions{
3642
Use: "sqlcmd",

cmd/modern/root/install/mssql-base.go

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"github.com/spf13/viper"
1818
"net/url"
1919
"path/filepath"
20+
"runtime"
2021
"strings"
2122
)
2223

@@ -292,10 +293,9 @@ func (c *MssqlBase) createContainer(imageName string, contextName string) {
292293
)
293294

294295
output.Infof(
295-
"Created context %q in %q, configuring user account...",
296+
"Created context %q in \"%s\", configuring user account...",
296297
config.CurrentContextName(),
297-
config.GetConfigFileUsed(),
298-
)
298+
config.GetConfigFileUsed())
299299

300300
controller.ContainerWaitForLogEntry(
301301
containerId, c.errorLogEntryToWaitFor)
@@ -339,10 +339,15 @@ func (c *MssqlBase) createContainer(imageName string, contextName string) {
339339
)
340340
}
341341

342-
hints := [][]string{
343-
{"Open in Azure Data Studio", "sqlcmd open ads"},
344-
{"Run a query", "sqlcmd query \"SELECT @@version\""},
345-
{"Start interactive session", "sqlcmd query"}}
342+
hints := [][]string{}
343+
344+
// TODO: sqlcmd open ads only support on Windows right now, add Mac support
345+
if runtime.GOOS == "windows" {
346+
hints = append(hints, []string{"Open in Azure Data Studio", "sqlcmd open ads"})
347+
}
348+
349+
hints = append(hints, []string{"Run a query", "sqlcmd query \"SELECT @@version\""})
350+
hints = append(hints, []string{"Start interactive session", "sqlcmd query"})
346351

347352
if previousContextName != "" {
348353
hints = append(

0 commit comments

Comments
 (0)