-
Notifications
You must be signed in to change notification settings - Fork 84
Expand file tree
/
Copy pathcurrent-context.go
More file actions
36 lines (30 loc) · 931 Bytes
/
current-context.go
File metadata and controls
36 lines (30 loc) · 931 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
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
package config
import (
"github.com/microsoft/go-sqlcmd/internal/cmdparser"
"github.com/microsoft/go-sqlcmd/internal/config"
"github.com/microsoft/go-sqlcmd/internal/localizer"
)
// CurrentContext implements the `sqlcmd config current-context` command
type CurrentContext struct {
cmdparser.Cmd
}
func (c *CurrentContext) DefineCommand(...cmdparser.CommandOptions) {
options := cmdparser.CommandOptions{
Use: "current-context",
Short: localizer.Sprintf("Display the name of the current-context"),
Examples: []cmdparser.ExampleOptions{
{
Description: localizer.Sprintf("Display the current-context name"),
Steps: []string{
"sqlcmd config current-context"},
},
},
Run: c.run}
c.Cmd.DefineCommand(options)
}
func (c *CurrentContext) run() {
output := c.Output()
output.Infof("%v\n", config.CurrentContextName())
}