Skip to content

Commit 99a9267

Browse files
committed
Merge main
2 parents e70df94 + d1965d1 commit 99a9267

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+29052
-696
lines changed

NOTICE.md

Lines changed: 10 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ SOFTWARE
3737
## github.com/Azure/azure-sdk-for-go/sdk/azidentity
3838

3939
* Name: github.com/Azure/azure-sdk-for-go/sdk/azidentity
40-
* Version: v1.1.0
41-
* License: [MIT](https://github.com/Azure/azure-sdk-for-go/blob/sdk/azidentity/v1.1.0/sdk/azidentity/LICENSE.txt)
40+
* Version: v1.2.1
41+
* License: [MIT](https://github.com/Azure/azure-sdk-for-go/blob/sdk/azidentity/v1.2.1/sdk/azidentity/LICENSE.txt)
4242

4343
```
4444
MIT License
@@ -99,8 +99,8 @@ SOFTWARE
9999
## github.com/AzureAD/microsoft-authentication-library-for-go/apps
100100

101101
* Name: github.com/AzureAD/microsoft-authentication-library-for-go/apps
102-
* Version: v0.5.1
103-
* License: [MIT](https://github.com/AzureAD/microsoft-authentication-library-for-go/blob/v0.5.1/LICENSE)
102+
* Version: v0.8.1
103+
* License: [MIT](https://github.com/AzureAD/microsoft-authentication-library-for-go/blob/v0.8.1/LICENSE)
104104

105105
```
106106
MIT License
@@ -188,35 +188,6 @@ SOFTWARE.
188188
189189
```
190190

191-
## github.com/alecthomas/kong
192-
193-
* Name: github.com/alecthomas/kong
194-
* Version: v0.6.2-0.20220922001058-c62bf25854a0
195-
* License: [MIT](https://github.com/alecthomas/kong/blob/c62bf25854a0/COPYING)
196-
197-
```
198-
Copyright (C) 2018 Alec Thomas
199-
200-
Permission is hereby granted, free of charge, to any person obtaining a copy of
201-
this software and associated documentation files (the "Software"), to deal in
202-
the Software without restriction, including without limitation the rights to
203-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
204-
of the Software, and to permit persons to whom the Software is furnished to do
205-
so, subject to the following conditions:
206-
207-
The above copyright notice and this permission notice shall be included in all
208-
copies or substantial portions of the Software.
209-
210-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
211-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
212-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
213-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
214-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
215-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
216-
SOFTWARE.
217-
218-
```
219-
220191
## github.com/beorn7/perks/quantile
221192

222193
* Name: github.com/beorn7/perks/quantile
@@ -344,8 +315,8 @@ SOFTWARE.
344315
## github.com/docker/distribution
345316

346317
* Name: github.com/docker/distribution
347-
* Version: v2.8.1
348-
* License: [Apache-2.0](https://github.com/docker/distribution/blob/v2.8.1/LICENSE)
318+
* Version: v2.8.2
319+
* License: [Apache-2.0](https://github.com/docker/distribution/blob/v2.8.2/LICENSE)
349320

350321
```
351322
Apache License
@@ -1437,11 +1408,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14371408
14381409
```
14391410

1440-
## github.com/golang-jwt/jwt
1411+
## github.com/golang-jwt/jwt/v4
14411412

1442-
* Name: github.com/golang-jwt/jwt
1443-
* Version: v3.2.2
1444-
* License: [MIT](https://github.com/golang-jwt/jwt/blob/v3.2.2/LICENSE)
1413+
* Name: github.com/golang-jwt/jwt/v4
1414+
* Version: v4.4.2
1415+
* License: [MIT](https://github.com/golang-jwt/jwt/blob/v4.4.2/LICENSE)
14451416

14461417
```
14471418
Copyright (c) 2012 Dave Grijalva

build/azure-pipelines/build-product.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,3 +239,4 @@ stages:
239239
tag: '$(getVersion.VERSION_TAG)'
240240
changeLogCompareToRelease: 'lastFullRelease'
241241
changeLogType: 'commitBased'
242+
isPreRelease: true

cmd/modern/root.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"github.com/microsoft/go-sqlcmd/cmd/modern/root"
1010
"github.com/microsoft/go-sqlcmd/internal/cmdparser"
1111
"github.com/microsoft/go-sqlcmd/internal/config"
12+
"github.com/microsoft/go-sqlcmd/internal/localizer"
1213
)
1314

1415
// Root type implements the very top-level command for sqlcmd (which contains
@@ -36,18 +37,19 @@ func (c *Root) DefineCommand(...cmdparser.CommandOptions) {
3637
steps = append(steps, "sqlcmd delete")
3738

3839
examples := []cmdparser.ExampleOptions{
39-
{Description: "Install/Create, Query, Uninstall SQL Server",
40+
{Description: localizer.Sprintf("Install/Create, Query, Uninstall SQL Server"),
4041
Steps: steps},
41-
{Description: "View configuration information and connection strings",
42+
{Description: localizer.Sprintf("View configuration information and connection strings"),
4243
Steps: []string{"sqlcmd config view", "sqlcmd config cs"}},
4344
}
4445

46+
const feedbackUrl = "https://github.com/microsoft/go-sqlcmd/issues/new"
4547
commandOptions := cmdparser.CommandOptions{
4648
Use: "sqlcmd",
47-
Short: `sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools
49+
Short: localizer.Sprintf(`sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools
4850
4951
Feedback:
50-
https://github.com/microsoft/go-sqlcmd/issues/new`,
52+
%s`, feedbackUrl),
5153
SubCommands: c.SubCommands(),
5254
Examples: examples,
5355
}
@@ -103,7 +105,7 @@ func (c *Root) addGlobalFlags() {
103105
Bool: &unused,
104106
Name: "?",
105107
Shorthand: "?",
106-
Usage: "help for backwards compatibility flags (-S, -U, -E etc.)",
108+
Usage: localizer.Sprintf("help for backwards compatibility flags (-S, -U, -E etc.)"),
107109
})
108110

109111
// BUG(stuartpa): - This is a temporary flag until we have migrated
@@ -112,14 +114,14 @@ func (c *Root) addGlobalFlags() {
112114
c.AddFlag(cmdparser.FlagOptions{
113115
Bool: &unused,
114116
Name: "version",
115-
Usage: "print version of sqlcmd",
117+
Usage: localizer.Sprintf("print version of sqlcmd"),
116118
})
117119

118120
c.AddFlag(cmdparser.FlagOptions{
119121
String: &c.configFilename,
120122
DefaultString: config.DefaultFileName(),
121123
Name: "sqlconfig",
122-
Usage: "configuration file",
124+
Usage: localizer.Sprintf("configuration file"),
123125
})
124126

125127
/* BUG(stuartpa): - At the moment this is a top level flag, but it doesn't
@@ -137,6 +139,6 @@ func (c *Root) addGlobalFlags() {
137139
Int: (*int)(&c.loggingLevel),
138140
DefaultInt: 2,
139141
Name: "verbosity",
140-
Usage: "log level, error=0, warn=1, info=2, debug=3, trace=4",
142+
Usage: localizer.Sprintf("log level, error=0, warn=1, info=2, debug=3, trace=4"),
141143
})
142144
}

cmd/modern/root/config.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ package root
55

66
import (
77
"fmt"
8+
89
"github.com/microsoft/go-sqlcmd/cmd/modern/root/config"
910
"github.com/microsoft/go-sqlcmd/internal/cmdparser"
11+
"github.com/microsoft/go-sqlcmd/internal/localizer"
1012
"github.com/microsoft/go-sqlcmd/internal/pal"
1113
)
1214

@@ -20,11 +22,11 @@ type Config struct {
2022
func (c *Config) DefineCommand(...cmdparser.CommandOptions) {
2123
options := cmdparser.CommandOptions{
2224
Use: "config",
23-
Short: `Modify sqlconfig files using subcommands like "sqlcmd config use-context mssql"`,
25+
Short: localizer.Sprintf(`Modify sqlconfig files using subcommands like "%s"`, localizer.UseContextCommand),
2426
SubCommands: c.SubCommands(),
2527
Examples: []cmdparser.ExampleOptions{
2628
{
27-
Description: "Add context for existing endpoint and user (use SQLCMD_PASSWORD or SQLCMDPASSWORD)",
29+
Description: localizer.Sprintf("Add context for existing endpoint and user (use %s or %s)", localizer.PasswordEnvVar, localizer.PasswordEnvVar2),
2830
Steps: []string{
2931
fmt.Sprintf("%s SQLCMD_PASSWORD=<placeholderpassword>", pal.CreateEnvVarKeyword()),
3032
"sqlcmd config add-user --name sa1434 --username sa",

cmd/modern/root/config/add-context.go

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"github.com/microsoft/go-sqlcmd/cmd/modern/sqlconfig"
1010
"github.com/microsoft/go-sqlcmd/internal/cmdparser"
1111
"github.com/microsoft/go-sqlcmd/internal/config"
12+
"github.com/microsoft/go-sqlcmd/internal/localizer"
1213
)
1314

1415
// AddContext implements the `sqlcmd config add-context` command
@@ -23,10 +24,10 @@ type AddContext struct {
2324
func (c *AddContext) DefineCommand(...cmdparser.CommandOptions) {
2425
options := cmdparser.CommandOptions{
2526
Use: "add-context",
26-
Short: "Add a context",
27+
Short: localizer.Sprintf("Add a context"),
2728
Examples: []cmdparser.ExampleOptions{
2829
{
29-
Description: "Add a context for a local instance of SQL Server on port 1433 using trusted authentication",
30+
Description: localizer.Sprintf("Add a context for a local instance of SQL Server on port 1433 using trusted authentication"),
3031
Steps: []string{
3132
"sqlcmd config add-endpoint --name localhost-1433",
3233
"sqlcmd config add-context --name mssql --endpoint localhost-1433"}},
@@ -39,17 +40,17 @@ func (c *AddContext) DefineCommand(...cmdparser.CommandOptions) {
3940
String: &c.name,
4041
Name: "name",
4142
DefaultString: "context",
42-
Usage: "Display name for the context"})
43+
Usage: localizer.Sprintf("Display name for the context")})
4344

4445
c.AddFlag(cmdparser.FlagOptions{
4546
String: &c.endpointName,
4647
Name: "endpoint",
47-
Usage: "Name of endpoint this context will use"})
48+
Usage: localizer.Sprintf("Name of endpoint this context will use")})
4849

4950
c.AddFlag(cmdparser.FlagOptions{
5051
String: &c.userName,
5152
Name: "user",
52-
Usage: "Name of user this context will use"})
53+
Usage: localizer.Sprintf("Name of user this context will use")})
5354
}
5455

5556
// run adds a context to the configuration and sets it as the current context. The
@@ -69,27 +70,27 @@ func (c *AddContext) run() {
6970

7071
if c.endpointName == "" || !config.EndpointExists(c.endpointName) {
7172
output.FatalfWithHintExamples([][]string{
72-
{"View existing endpoints to choose from", "sqlcmd config get-endpoints"},
73-
{"Add a new local endpoint", "sqlcmd create"},
74-
{"Add an already existing endpoint", "sqlcmd config add-endpoint --address localhost --port 1433"}},
75-
"Endpoint required to add context. Endpoint '%v' does not exist. Use --endpoint flag", c.endpointName)
73+
{localizer.Sprintf("View existing endpoints to choose from"), "sqlcmd config get-endpoints"},
74+
{localizer.Sprintf("Add a new local endpoint"), "sqlcmd create"},
75+
{localizer.Sprintf("Add an already existing endpoint"), "sqlcmd config add-endpoint --address localhost --port 1433"}},
76+
localizer.Sprintf("Endpoint required to add context. Endpoint '%v' does not exist. Use %s flag", c.endpointName, localizer.EndpointFlag))
7677
}
7778

7879
if c.userName != "" {
7980
if !config.UserNameExists(c.userName) {
8081
output.FatalfWithHintExamples([][]string{
81-
{"View list of users", "sqlcmd config get-users"},
82-
{"Add the user", fmt.Sprintf("sqlcmd config add-user --name %v", c.userName)},
83-
{"Add an endpoint", "sqlcmd create"}},
84-
"User '%v' does not exist", c.userName)
82+
{localizer.Sprintf("View list of users"), "sqlcmd config get-users"},
83+
{localizer.Sprintf("Add the user"), fmt.Sprintf("sqlcmd config add-user --name %v", c.userName)},
84+
{localizer.Sprintf("Add an endpoint"), "sqlcmd create"}},
85+
localizer.Sprintf("User '%v' does not exist", c.userName))
8586
}
8687
}
8788

8889
context.Name = config.AddContext(context)
8990
config.SetCurrentContextName(context.Name)
9091
output.InfofWithHintExamples([][]string{
91-
{"Open in Azure Data Studio", "sqlcmd open ads"},
92-
{"To start interactive query session", "sqlcmd query"},
93-
{"To run a query", "sqlcmd query \"SELECT @@version\""},
94-
}, "Current Context '%v'", context.Name)
92+
{localizer.Sprintf("Open in Azure Data Studio"), "sqlcmd open ads"},
93+
{localizer.Sprintf("To start interactive query session"), "sqlcmd query"},
94+
{localizer.Sprintf("To run a query"), "sqlcmd query \"SELECT @@version\""},
95+
}, localizer.Sprintf("Current Context '%v'", context.Name))
9596
}

cmd/modern/root/config/add-endpoint.go

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ package config
55

66
import (
77
"fmt"
8+
89
"github.com/microsoft/go-sqlcmd/cmd/modern/sqlconfig"
910

1011
"github.com/microsoft/go-sqlcmd/internal/cmdparser"
1112
"github.com/microsoft/go-sqlcmd/internal/config"
13+
"github.com/microsoft/go-sqlcmd/internal/localizer"
1214
)
1315

1416
// AddEndpoint implements the `sqlcmd config add-endpoint` command
@@ -23,10 +25,10 @@ type AddEndpoint struct {
2325
func (c *AddEndpoint) DefineCommand(...cmdparser.CommandOptions) {
2426
options := cmdparser.CommandOptions{
2527
Use: "add-endpoint",
26-
Short: "Add an endpoint",
28+
Short: localizer.Sprintf("Add an endpoint"),
2729
Examples: []cmdparser.ExampleOptions{
2830
{
29-
Description: "Add a default endpoint",
31+
Description: localizer.Sprintf("Add a default endpoint"),
3032
Steps: []string{"sqlcmd config add-endpoint --name my-endpoint --address localhost --port 1433"},
3133
},
3234
},
@@ -38,21 +40,21 @@ func (c *AddEndpoint) DefineCommand(...cmdparser.CommandOptions) {
3840
String: &c.name,
3941
Name: "name",
4042
DefaultString: "endpoint",
41-
Usage: "Display name for the endpoint",
43+
Usage: localizer.Sprintf("Display name for the endpoint"),
4244
})
4345

4446
c.AddFlag(cmdparser.FlagOptions{
4547
String: &c.address,
4648
Name: "address",
4749
DefaultString: "localhost",
48-
Usage: "The network address to connect to, e.g. 127.0.0.1 etc.",
50+
Usage: localizer.Sprintf("The network address to connect to, e.g. 127.0.0.1 etc."),
4951
})
5052

5153
c.AddFlag(cmdparser.FlagOptions{
5254
Int: &c.port,
5355
Name: "port",
5456
DefaultInt: 1433,
55-
Usage: "The network port to connect to, e.g. 1433 etc.",
57+
Usage: localizer.Sprintf("The network port to connect to, e.g. 1433 etc."),
5658
})
5759
}
5860

@@ -73,11 +75,11 @@ func (c *AddEndpoint) run() {
7375

7476
uniqueEndpointName := config.AddEndpoint(endpoint)
7577
output.InfofWithHintExamples([][]string{
76-
{"Add a context for this endpoint", fmt.Sprintf("sqlcmd config add-context --endpoint %v", uniqueEndpointName)},
77-
{"View endpoint names", "sqlcmd config get-endpoints"},
78-
{"View endpoint details", fmt.Sprintf("sqlcmd config get-endpoints %v", uniqueEndpointName)},
79-
{"View all endpoints details", "sqlcmd config get-endpoints --detailed"},
80-
{"Delete this endpoint", fmt.Sprintf("sqlcmd config delete-endpoint %v", uniqueEndpointName)},
78+
{localizer.Sprintf("Add a context for this endpoint"), fmt.Sprintf("sqlcmd config add-context --endpoint %v", uniqueEndpointName)},
79+
{localizer.Sprintf("View endpoint names"), "sqlcmd config get-endpoints"},
80+
{localizer.Sprintf("View endpoint details"), fmt.Sprintf("sqlcmd config get-endpoints %v", uniqueEndpointName)},
81+
{localizer.Sprintf("View all endpoints details"), "sqlcmd config get-endpoints --detailed"},
82+
{localizer.Sprintf("Delete this endpoint"), fmt.Sprintf("sqlcmd config delete-endpoint %v", uniqueEndpointName)},
8183
},
82-
"Endpoint '%v' added (address: '%v', port: '%v')", uniqueEndpointName, c.address, c.port)
84+
localizer.Sprintf("Endpoint '%v' added (address: '%v', port: '%v')", uniqueEndpointName, c.address, c.port))
8385
}

0 commit comments

Comments
 (0)