-
Notifications
You must be signed in to change notification settings - Fork 84
Expand file tree
/
Copy pathopen.go
More file actions
37 lines (30 loc) · 1019 Bytes
/
open.go
File metadata and controls
37 lines (30 loc) · 1019 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
package root
import (
"github.com/microsoft/go-sqlcmd/cmd/modern/root/open"
"github.com/microsoft/go-sqlcmd/internal/cmdparser"
"github.com/microsoft/go-sqlcmd/internal/localizer"
)
// Open defines the `sqlcmd open` sub-commands
type Open struct {
cmdparser.Cmd
}
func (c *Open) DefineCommand(...cmdparser.CommandOptions) {
options := cmdparser.CommandOptions{
Use: "open",
Short: localizer.Sprintf("Open tools (e.g Visual Studio Code, SSMS) for current context"),
SubCommands: c.SubCommands(),
}
c.Cmd.DefineCommand(options)
}
// SubCommands sets up the sub-commands for `sqlcmd open` such as
// `sqlcmd open ads`, `sqlcmd open vscode`, and `sqlcmd open ssms`
func (c *Open) SubCommands() []cmdparser.Command {
dependencies := c.Dependencies()
return []cmdparser.Command{
cmdparser.New[*open.Ads](dependencies),
cmdparser.New[*open.VSCode](dependencies),
cmdparser.New[*open.Ssms](dependencies),
}
}