Skip to content

Commit

Permalink
Add verbose flag
Browse files Browse the repository at this point in the history
  • Loading branch information
2lz4m3 committed Feb 18, 2024
1 parent eabb7ea commit 8437746
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ import (
)

var (
Verbose bool

rootCmd = &cobra.Command{
Use: "badrodem <file>...",
Short: "An UTF-8 BOM adder.",
Long: `badrodem is an anagram of "bom-adder".
It adds an UTF-8 BOM (Byte Order Mark, 0xEF 0xBB 0xBF)
to the beginning of the text file.`,
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Printf("Language: %s\n", localize.I18n.Tag)
err := run.Run()
return err
},
Expand All @@ -42,4 +45,6 @@ func Execute(versionString string) {
func init() {
cobra.MousetrapHelpText = ""
rootCmd.DisableFlagsInUseLine = true

rootCmd.PersistentFlags().BoolVarP(&Verbose, "verbose", "", false, "verbose output")
}
6 changes: 5 additions & 1 deletion localize/myi18n.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
package localize

import "github.com/nicksnyder/go-i18n/v2/i18n"
import (
"github.com/nicksnyder/go-i18n/v2/i18n"
"golang.org/x/text/language"
)

var (
I18n MyI18n
)

type MyI18n struct {
Tag language.Tag
Bundle *i18n.Bundle
Localizer *i18n.Localizer
}
Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func main() {
} else {
tag = language.English
}
localize.I18n.Tag = tag

// set up localizer
localize.I18n.Bundle = i18n.NewBundle(tag)
Expand Down

0 comments on commit 8437746

Please sign in to comment.