Skip to content

Commit 2a22218

Browse files
rwestMSFTshueybubblesstuartpaapoorvdeshmukh
authored
Add product name and description to output (#452)
Co-authored-by: David Shiflet <david.shiflet@microsoft.com> Co-authored-by: Stuart Padley <stuartpa@hotmail.com> Co-authored-by: Apoorv Deshmukh <apdeshmukh@microsoft.com>
1 parent 33a6ea5 commit 2a22218

File tree

15 files changed

+3391
-3368
lines changed

15 files changed

+3391
-3368
lines changed

cmd/modern/root.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ func (c *Root) DefineCommand(...cmdparser.CommandOptions) {
4444
}
4545

4646
const feedbackUrl = "https://github.com/microsoft/go-sqlcmd/issues/new"
47+
4748
commandOptions := cmdparser.CommandOptions{
4849
Use: "sqlcmd",
49-
Short: localizer.Sprintf(`sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools
50+
Short: localizer.ProductBanner() + localizer.Sprintf(`
5051
5152
Feedback:
5253
%s`, feedbackUrl),

cmd/sqlcmd/sqlcmd.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,10 @@ func Execute(version string) {
228228
setVars(vars, &args)
229229

230230
if args.Version {
231-
fmt.Printf("%v\n", version)
231+
fmt.Println(localizer.ProductBanner())
232+
fmt.Println()
233+
fmt.Printf("Version: %v\n", version)
234+
fmt.Println()
232235
fmt.Println(localizer.Sprintf("Legal docs and information: aka.ms/SqlcmdLegal"))
233236
fmt.Println(localizer.Sprintf("Third party notices: aka.ms/SqlcmdNotices"))
234237
os.Exit(0)
@@ -246,8 +249,9 @@ func Execute(version string) {
246249
}
247250
setFlags(rootCmd, &args)
248251
rootCmd.SetHelpFunc(func(cmd *cobra.Command, argss []string) {
249-
fmt.Println(cmd.Long)
250-
fmt.Println(localizer.Sprintf("Version %v\n", version))
252+
fmt.Println(localizer.ProductBanner())
253+
fmt.Println()
254+
fmt.Println(localizer.Sprintf("Version: %v\n", version))
251255
cmd.Flags().SetInterspersed(false)
252256
fmt.Println(localizer.Sprintf("Flags:"))
253257
cmd.Flags().VisitAll(func(flag *pflag.Flag) {

internal/localizer/localizer.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,8 @@ func Errorf(format string, a ...any) error {
5757
func Sprintf(key message.Reference, args ...interface{}) string {
5858
return Translator.Sprintf(key, args...)
5959
}
60+
61+
// ProductBanner() returns the localized product banner string
62+
func ProductBanner() string {
63+
return Sprintf("sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools")
64+
}

internal/translations/catalog.go

Lines changed: 3234 additions & 3238 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/translations/locales/de-DE/out.gotext.json

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@
1616
"fuzzy": true
1717
},
1818
{
19-
"id": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools\n\nFeedback:\n {FeedbackUrl}",
20-
"message": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools\n\nFeedback:\n {FeedbackUrl}",
21-
"translation": "sqlcmd: SQL Server, Azure SQL und Tools installieren/erstellen/abfragen\n\nFeedback:\n {FeedbackUrl}",
22-
"translatorComment": "Copied from source.",
19+
"id": "Feedback:\n {FeedbackUrl}",
20+
"message": "Feedback:\n {FeedbackUrl}",
21+
"translation": "",
2322
"placeholders": [
2423
{
2524
"id": "FeedbackUrl",
@@ -29,8 +28,7 @@
2928
"argNum": 1,
3029
"expr": "feedbackUrl"
3130
}
32-
],
33-
"fuzzy": true
31+
]
3432
},
3533
{
3634
"id": "help for backwards compatibility flags (-S, -U, -E etc.)",
@@ -2487,10 +2485,9 @@
24872485
"fuzzy": true
24882486
},
24892487
{
2490-
"id": "Version {Version}",
2491-
"message": "Version {Version}",
2492-
"translation": "Version {Version}",
2493-
"translatorComment": "Copied from source.",
2488+
"id": "Version: {Version}",
2489+
"message": "Version: {Version}",
2490+
"translation": "",
24942491
"placeholders": [
24952492
{
24962493
"id": "Version",
@@ -2500,8 +2497,7 @@
25002497
"argNum": 1,
25012498
"expr": "version"
25022499
}
2503-
],
2504-
"fuzzy": true
2500+
]
25052501
},
25062502
{
25072503
"id": "Flags:",
@@ -3278,6 +3274,11 @@
32783274
"translatorComment": "Copied from source.",
32793275
"fuzzy": true
32803276
},
3277+
{
3278+
"id": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools",
3279+
"message": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools",
3280+
"translation": ""
3281+
},
32813282
{
32823283
"id": "Sqlcmd: Error:",
32833284
"message": "Sqlcmd: Error:",

internal/translations/locales/en-US/out.gotext.json

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
"fuzzy": true
1717
},
1818
{
19-
"id": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools\n\nFeedback:\n {FeedbackUrl}",
20-
"message": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools\n\nFeedback:\n {FeedbackUrl}",
21-
"translation": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools\n\nFeedback:\n {FeedbackUrl}",
19+
"id": "Feedback:\n {FeedbackUrl}",
20+
"message": "Feedback:\n {FeedbackUrl}",
21+
"translation": "Feedback:\n {FeedbackUrl}",
2222
"translatorComment": "Copied from source.",
2323
"placeholders": [
2424
{
@@ -2487,9 +2487,9 @@
24872487
"fuzzy": true
24882488
},
24892489
{
2490-
"id": "Version {Version}",
2491-
"message": "Version {Version}",
2492-
"translation": "Version {Version}",
2490+
"id": "Version: {Version}",
2491+
"message": "Version: {Version}",
2492+
"translation": "Version: {Version}",
24932493
"translatorComment": "Copied from source.",
24942494
"placeholders": [
24952495
{
@@ -3278,6 +3278,13 @@
32783278
"translatorComment": "Copied from source.",
32793279
"fuzzy": true
32803280
},
3281+
{
3282+
"id": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools",
3283+
"message": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools",
3284+
"translation": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools",
3285+
"translatorComment": "Copied from source.",
3286+
"fuzzy": true
3287+
},
32813288
{
32823289
"id": "Sqlcmd: Error:",
32833290
"message": "Sqlcmd: Error:",

internal/translations/locales/es-ES/out.gotext.json

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@
1616
"fuzzy": true
1717
},
1818
{
19-
"id": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools\n\nFeedback:\n {FeedbackUrl}",
20-
"message": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools\n\nFeedback:\n {FeedbackUrl}",
21-
"translation": "ssqlcmd: Instalar/Crear/Consultar SQL Server, Azure SQL y Herramientas\n\nComentarios:\n {FeedbackUrl}",
22-
"translatorComment": "Copied from source.",
19+
"id": "Feedback:\n {FeedbackUrl}",
20+
"message": "Feedback:\n {FeedbackUrl}",
21+
"translation": "",
2322
"placeholders": [
2423
{
2524
"id": "FeedbackUrl",
@@ -29,8 +28,7 @@
2928
"argNum": 1,
3029
"expr": "feedbackUrl"
3130
}
32-
],
33-
"fuzzy": true
31+
]
3432
},
3533
{
3634
"id": "help for backwards compatibility flags (-S, -U, -E etc.)",
@@ -2487,10 +2485,9 @@
24872485
"fuzzy": true
24882486
},
24892487
{
2490-
"id": "Version {Version}",
2491-
"message": "Version {Version}",
2492-
"translation": "Versión {Version}",
2493-
"translatorComment": "Copied from source.",
2488+
"id": "Version: {Version}",
2489+
"message": "Version: {Version}",
2490+
"translation": "",
24942491
"placeholders": [
24952492
{
24962493
"id": "Version",
@@ -2500,8 +2497,7 @@
25002497
"argNum": 1,
25012498
"expr": "version"
25022499
}
2503-
],
2504-
"fuzzy": true
2500+
]
25052501
},
25062502
{
25072503
"id": "Flags:",
@@ -3278,6 +3274,11 @@
32783274
"translatorComment": "Copied from source.",
32793275
"fuzzy": true
32803276
},
3277+
{
3278+
"id": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools",
3279+
"message": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools",
3280+
"translation": ""
3281+
},
32813282
{
32823283
"id": "Sqlcmd: Error:",
32833284
"message": "Sqlcmd: Error:",

internal/translations/locales/fr-FR/out.gotext.json

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@
1616
"fuzzy": true
1717
},
1818
{
19-
"id": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools\n\nFeedback:\n {FeedbackUrl}",
20-
"message": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools\n\nFeedback:\n {FeedbackUrl}",
21-
"translation": "sqlcmd : installer/créer/interroger SQL Server, Azure SQL et les outils\n\nRetour:\n {FeedbackUrl}",
22-
"translatorComment": "Copied from source.",
19+
"id": "Feedback:\n {FeedbackUrl}",
20+
"message": "Feedback:\n {FeedbackUrl}",
21+
"translation": "",
2322
"placeholders": [
2423
{
2524
"id": "FeedbackUrl",
@@ -29,8 +28,7 @@
2928
"argNum": 1,
3029
"expr": "feedbackUrl"
3130
}
32-
],
33-
"fuzzy": true
31+
]
3432
},
3533
{
3634
"id": "help for backwards compatibility flags (-S, -U, -E etc.)",
@@ -2487,10 +2485,9 @@
24872485
"fuzzy": true
24882486
},
24892487
{
2490-
"id": "Version {Version}",
2491-
"message": "Version {Version}",
2492-
"translation": "Version {Version}",
2493-
"translatorComment": "Copied from source.",
2488+
"id": "Version: {Version}",
2489+
"message": "Version: {Version}",
2490+
"translation": "",
24942491
"placeholders": [
24952492
{
24962493
"id": "Version",
@@ -2500,8 +2497,7 @@
25002497
"argNum": 1,
25012498
"expr": "version"
25022499
}
2503-
],
2504-
"fuzzy": true
2500+
]
25052501
},
25062502
{
25072503
"id": "Flags:",
@@ -3278,6 +3274,11 @@
32783274
"translatorComment": "Copied from source.",
32793275
"fuzzy": true
32803276
},
3277+
{
3278+
"id": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools",
3279+
"message": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools",
3280+
"translation": ""
3281+
},
32813282
{
32823283
"id": "Sqlcmd: Error:",
32833284
"message": "Sqlcmd: Error:",

internal/translations/locales/it-IT/out.gotext.json

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@
1616
"fuzzy": true
1717
},
1818
{
19-
"id": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools\n\nFeedback:\n {FeedbackUrl}",
20-
"message": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools\n\nFeedback:\n {FeedbackUrl}",
21-
"translation": "sqlcmd: installare/creare/eseguire query su SQL Server, Azure SQL e strumenti\n\nFeedback:\n {FeedbackUrl}",
22-
"translatorComment": "Copied from source.",
19+
"id": "Feedback:\n {FeedbackUrl}",
20+
"message": "Feedback:\n {FeedbackUrl}",
21+
"translation": "",
2322
"placeholders": [
2423
{
2524
"id": "FeedbackUrl",
@@ -29,8 +28,7 @@
2928
"argNum": 1,
3029
"expr": "feedbackUrl"
3130
}
32-
],
33-
"fuzzy": true
31+
]
3432
},
3533
{
3634
"id": "help for backwards compatibility flags (-S, -U, -E etc.)",
@@ -2487,10 +2485,9 @@
24872485
"fuzzy": true
24882486
},
24892487
{
2490-
"id": "Version {Version}",
2491-
"message": "Version {Version}",
2492-
"translation": "Versione {Version}",
2493-
"translatorComment": "Copied from source.",
2488+
"id": "Version: {Version}",
2489+
"message": "Version: {Version}",
2490+
"translation": "",
24942491
"placeholders": [
24952492
{
24962493
"id": "Version",
@@ -2500,8 +2497,7 @@
25002497
"argNum": 1,
25012498
"expr": "version"
25022499
}
2503-
],
2504-
"fuzzy": true
2500+
]
25052501
},
25062502
{
25072503
"id": "Flags:",
@@ -3278,6 +3274,11 @@
32783274
"translatorComment": "Copied from source.",
32793275
"fuzzy": true
32803276
},
3277+
{
3278+
"id": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools",
3279+
"message": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools",
3280+
"translation": ""
3281+
},
32813282
{
32823283
"id": "Sqlcmd: Error:",
32833284
"message": "Sqlcmd: Error:",

internal/translations/locales/ja-JP/out.gotext.json

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@
1616
"fuzzy": true
1717
},
1818
{
19-
"id": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools\n\nFeedback:\n {FeedbackUrl}",
20-
"message": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools\n\nFeedback:\n {FeedbackUrl}",
21-
"translation": "sqlcmd: SQL Server、Azure SQL、およびツールのインストール/作成/クエリ\n\nフィードバック:\n {FeedbackUrl}",
22-
"translatorComment": "Copied from source.",
19+
"id": "Feedback:\n {FeedbackUrl}",
20+
"message": "Feedback:\n {FeedbackUrl}",
21+
"translation": "",
2322
"placeholders": [
2423
{
2524
"id": "FeedbackUrl",
@@ -29,8 +28,7 @@
2928
"argNum": 1,
3029
"expr": "feedbackUrl"
3130
}
32-
],
33-
"fuzzy": true
31+
]
3432
},
3533
{
3634
"id": "help for backwards compatibility flags (-S, -U, -E etc.)",
@@ -2487,10 +2485,9 @@
24872485
"fuzzy": true
24882486
},
24892487
{
2490-
"id": "Version {Version}",
2491-
"message": "Version {Version}",
2492-
"translation": "バージョン {Version}",
2493-
"translatorComment": "Copied from source.",
2488+
"id": "Version: {Version}",
2489+
"message": "Version: {Version}",
2490+
"translation": "",
24942491
"placeholders": [
24952492
{
24962493
"id": "Version",
@@ -2500,8 +2497,7 @@
25002497
"argNum": 1,
25012498
"expr": "version"
25022499
}
2503-
],
2504-
"fuzzy": true
2500+
]
25052501
},
25062502
{
25072503
"id": "Flags:",
@@ -3278,6 +3274,11 @@
32783274
"translatorComment": "Copied from source.",
32793275
"fuzzy": true
32803276
},
3277+
{
3278+
"id": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools",
3279+
"message": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools",
3280+
"translation": ""
3281+
},
32813282
{
32823283
"id": "Sqlcmd: Error:",
32833284
"message": "Sqlcmd: Error:",

0 commit comments

Comments
 (0)