Skip to content

Commit

Permalink
Add product name and description to output (#452)
Browse files Browse the repository at this point in the history
Co-authored-by: David Shiflet <[email protected]>
Co-authored-by: Stuart Padley <[email protected]>
Co-authored-by: Apoorv Deshmukh <[email protected]>
  • Loading branch information
4 people authored Oct 31, 2023
1 parent 33a6ea5 commit 2a22218
Show file tree
Hide file tree
Showing 15 changed files with 3,391 additions and 3,368 deletions.
3 changes: 2 additions & 1 deletion cmd/modern/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ func (c *Root) DefineCommand(...cmdparser.CommandOptions) {
}

const feedbackUrl = "https://github.com/microsoft/go-sqlcmd/issues/new"

commandOptions := cmdparser.CommandOptions{
Use: "sqlcmd",
Short: localizer.Sprintf(`sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools
Short: localizer.ProductBanner() + localizer.Sprintf(`
Feedback:
%s`, feedbackUrl),
Expand Down
10 changes: 7 additions & 3 deletions cmd/sqlcmd/sqlcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,10 @@ func Execute(version string) {
setVars(vars, &args)

if args.Version {
fmt.Printf("%v\n", version)
fmt.Println(localizer.ProductBanner())
fmt.Println()
fmt.Printf("Version: %v\n", version)
fmt.Println()
fmt.Println(localizer.Sprintf("Legal docs and information: aka.ms/SqlcmdLegal"))
fmt.Println(localizer.Sprintf("Third party notices: aka.ms/SqlcmdNotices"))
os.Exit(0)
Expand All @@ -246,8 +249,9 @@ func Execute(version string) {
}
setFlags(rootCmd, &args)
rootCmd.SetHelpFunc(func(cmd *cobra.Command, argss []string) {
fmt.Println(cmd.Long)
fmt.Println(localizer.Sprintf("Version %v\n", version))
fmt.Println(localizer.ProductBanner())
fmt.Println()
fmt.Println(localizer.Sprintf("Version: %v\n", version))
cmd.Flags().SetInterspersed(false)
fmt.Println(localizer.Sprintf("Flags:"))
cmd.Flags().VisitAll(func(flag *pflag.Flag) {
Expand Down
5 changes: 5 additions & 0 deletions internal/localizer/localizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,8 @@ func Errorf(format string, a ...any) error {
func Sprintf(key message.Reference, args ...interface{}) string {
return Translator.Sprintf(key, args...)
}

// ProductBanner() returns the localized product banner string
func ProductBanner() string {
return Sprintf("sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools")
}
6,472 changes: 3,234 additions & 3,238 deletions internal/translations/catalog.go

Large diffs are not rendered by default.

25 changes: 13 additions & 12 deletions internal/translations/locales/de-DE/out.gotext.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
"fuzzy": true
},
{
"id": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools\n\nFeedback:\n {FeedbackUrl}",
"message": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools\n\nFeedback:\n {FeedbackUrl}",
"translation": "sqlcmd: SQL Server, Azure SQL und Tools installieren/erstellen/abfragen\n\nFeedback:\n {FeedbackUrl}",
"translatorComment": "Copied from source.",
"id": "Feedback:\n {FeedbackUrl}",
"message": "Feedback:\n {FeedbackUrl}",
"translation": "",
"placeholders": [
{
"id": "FeedbackUrl",
Expand All @@ -29,8 +28,7 @@
"argNum": 1,
"expr": "feedbackUrl"
}
],
"fuzzy": true
]
},
{
"id": "help for backwards compatibility flags (-S, -U, -E etc.)",
Expand Down Expand Up @@ -2487,10 +2485,9 @@
"fuzzy": true
},
{
"id": "Version {Version}",
"message": "Version {Version}",
"translation": "Version {Version}",
"translatorComment": "Copied from source.",
"id": "Version: {Version}",
"message": "Version: {Version}",
"translation": "",
"placeholders": [
{
"id": "Version",
Expand All @@ -2500,8 +2497,7 @@
"argNum": 1,
"expr": "version"
}
],
"fuzzy": true
]
},
{
"id": "Flags:",
Expand Down Expand Up @@ -3278,6 +3274,11 @@
"translatorComment": "Copied from source.",
"fuzzy": true
},
{
"id": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools",
"message": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools",
"translation": ""
},
{
"id": "Sqlcmd: Error:",
"message": "Sqlcmd: Error:",
Expand Down
19 changes: 13 additions & 6 deletions internal/translations/locales/en-US/out.gotext.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
"fuzzy": true
},
{
"id": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools\n\nFeedback:\n {FeedbackUrl}",
"message": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools\n\nFeedback:\n {FeedbackUrl}",
"translation": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools\n\nFeedback:\n {FeedbackUrl}",
"id": "Feedback:\n {FeedbackUrl}",
"message": "Feedback:\n {FeedbackUrl}",
"translation": "Feedback:\n {FeedbackUrl}",
"translatorComment": "Copied from source.",
"placeholders": [
{
Expand Down Expand Up @@ -2487,9 +2487,9 @@
"fuzzy": true
},
{
"id": "Version {Version}",
"message": "Version {Version}",
"translation": "Version {Version}",
"id": "Version: {Version}",
"message": "Version: {Version}",
"translation": "Version: {Version}",
"translatorComment": "Copied from source.",
"placeholders": [
{
Expand Down Expand Up @@ -3278,6 +3278,13 @@
"translatorComment": "Copied from source.",
"fuzzy": true
},
{
"id": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools",
"message": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools",
"translation": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools",
"translatorComment": "Copied from source.",
"fuzzy": true
},
{
"id": "Sqlcmd: Error:",
"message": "Sqlcmd: Error:",
Expand Down
25 changes: 13 additions & 12 deletions internal/translations/locales/es-ES/out.gotext.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
"fuzzy": true
},
{
"id": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools\n\nFeedback:\n {FeedbackUrl}",
"message": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools\n\nFeedback:\n {FeedbackUrl}",
"translation": "ssqlcmd: Instalar/Crear/Consultar SQL Server, Azure SQL y Herramientas\n\nComentarios:\n {FeedbackUrl}",
"translatorComment": "Copied from source.",
"id": "Feedback:\n {FeedbackUrl}",
"message": "Feedback:\n {FeedbackUrl}",
"translation": "",
"placeholders": [
{
"id": "FeedbackUrl",
Expand All @@ -29,8 +28,7 @@
"argNum": 1,
"expr": "feedbackUrl"
}
],
"fuzzy": true
]
},
{
"id": "help for backwards compatibility flags (-S, -U, -E etc.)",
Expand Down Expand Up @@ -2487,10 +2485,9 @@
"fuzzy": true
},
{
"id": "Version {Version}",
"message": "Version {Version}",
"translation": "Versión {Version}",
"translatorComment": "Copied from source.",
"id": "Version: {Version}",
"message": "Version: {Version}",
"translation": "",
"placeholders": [
{
"id": "Version",
Expand All @@ -2500,8 +2497,7 @@
"argNum": 1,
"expr": "version"
}
],
"fuzzy": true
]
},
{
"id": "Flags:",
Expand Down Expand Up @@ -3278,6 +3274,11 @@
"translatorComment": "Copied from source.",
"fuzzy": true
},
{
"id": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools",
"message": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools",
"translation": ""
},
{
"id": "Sqlcmd: Error:",
"message": "Sqlcmd: Error:",
Expand Down
25 changes: 13 additions & 12 deletions internal/translations/locales/fr-FR/out.gotext.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
"fuzzy": true
},
{
"id": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools\n\nFeedback:\n {FeedbackUrl}",
"message": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools\n\nFeedback:\n {FeedbackUrl}",
"translation": "sqlcmd : installer/créer/interroger SQL Server, Azure SQL et les outils\n\nRetour:\n {FeedbackUrl}",
"translatorComment": "Copied from source.",
"id": "Feedback:\n {FeedbackUrl}",
"message": "Feedback:\n {FeedbackUrl}",
"translation": "",
"placeholders": [
{
"id": "FeedbackUrl",
Expand All @@ -29,8 +28,7 @@
"argNum": 1,
"expr": "feedbackUrl"
}
],
"fuzzy": true
]
},
{
"id": "help for backwards compatibility flags (-S, -U, -E etc.)",
Expand Down Expand Up @@ -2487,10 +2485,9 @@
"fuzzy": true
},
{
"id": "Version {Version}",
"message": "Version {Version}",
"translation": "Version {Version}",
"translatorComment": "Copied from source.",
"id": "Version: {Version}",
"message": "Version: {Version}",
"translation": "",
"placeholders": [
{
"id": "Version",
Expand All @@ -2500,8 +2497,7 @@
"argNum": 1,
"expr": "version"
}
],
"fuzzy": true
]
},
{
"id": "Flags:",
Expand Down Expand Up @@ -3278,6 +3274,11 @@
"translatorComment": "Copied from source.",
"fuzzy": true
},
{
"id": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools",
"message": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools",
"translation": ""
},
{
"id": "Sqlcmd: Error:",
"message": "Sqlcmd: Error:",
Expand Down
25 changes: 13 additions & 12 deletions internal/translations/locales/it-IT/out.gotext.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
"fuzzy": true
},
{
"id": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools\n\nFeedback:\n {FeedbackUrl}",
"message": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools\n\nFeedback:\n {FeedbackUrl}",
"translation": "sqlcmd: installare/creare/eseguire query su SQL Server, Azure SQL e strumenti\n\nFeedback:\n {FeedbackUrl}",
"translatorComment": "Copied from source.",
"id": "Feedback:\n {FeedbackUrl}",
"message": "Feedback:\n {FeedbackUrl}",
"translation": "",
"placeholders": [
{
"id": "FeedbackUrl",
Expand All @@ -29,8 +28,7 @@
"argNum": 1,
"expr": "feedbackUrl"
}
],
"fuzzy": true
]
},
{
"id": "help for backwards compatibility flags (-S, -U, -E etc.)",
Expand Down Expand Up @@ -2487,10 +2485,9 @@
"fuzzy": true
},
{
"id": "Version {Version}",
"message": "Version {Version}",
"translation": "Versione {Version}",
"translatorComment": "Copied from source.",
"id": "Version: {Version}",
"message": "Version: {Version}",
"translation": "",
"placeholders": [
{
"id": "Version",
Expand All @@ -2500,8 +2497,7 @@
"argNum": 1,
"expr": "version"
}
],
"fuzzy": true
]
},
{
"id": "Flags:",
Expand Down Expand Up @@ -3278,6 +3274,11 @@
"translatorComment": "Copied from source.",
"fuzzy": true
},
{
"id": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools",
"message": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools",
"translation": ""
},
{
"id": "Sqlcmd: Error:",
"message": "Sqlcmd: Error:",
Expand Down
25 changes: 13 additions & 12 deletions internal/translations/locales/ja-JP/out.gotext.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
"fuzzy": true
},
{
"id": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools\n\nFeedback:\n {FeedbackUrl}",
"message": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools\n\nFeedback:\n {FeedbackUrl}",
"translation": "sqlcmd: SQL Server、Azure SQL、およびツールのインストール/作成/クエリ\n\nフィードバック:\n {FeedbackUrl}",
"translatorComment": "Copied from source.",
"id": "Feedback:\n {FeedbackUrl}",
"message": "Feedback:\n {FeedbackUrl}",
"translation": "",
"placeholders": [
{
"id": "FeedbackUrl",
Expand All @@ -29,8 +28,7 @@
"argNum": 1,
"expr": "feedbackUrl"
}
],
"fuzzy": true
]
},
{
"id": "help for backwards compatibility flags (-S, -U, -E etc.)",
Expand Down Expand Up @@ -2487,10 +2485,9 @@
"fuzzy": true
},
{
"id": "Version {Version}",
"message": "Version {Version}",
"translation": "バージョン {Version}",
"translatorComment": "Copied from source.",
"id": "Version: {Version}",
"message": "Version: {Version}",
"translation": "",
"placeholders": [
{
"id": "Version",
Expand All @@ -2500,8 +2497,7 @@
"argNum": 1,
"expr": "version"
}
],
"fuzzy": true
]
},
{
"id": "Flags:",
Expand Down Expand Up @@ -3278,6 +3274,11 @@
"translatorComment": "Copied from source.",
"fuzzy": true
},
{
"id": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools",
"message": "sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools",
"translation": ""
},
{
"id": "Sqlcmd: Error:",
"message": "Sqlcmd: Error:",
Expand Down
Loading

0 comments on commit 2a22218

Please sign in to comment.