mirror of
https://github.com/eeeXun/GTT.git
synced 2025-05-18 00:30:40 -07:00
setup config
This commit is contained in:
parent
fa67e9d2ce
commit
41863c3945
@ -18,6 +18,7 @@ func configInit() {
|
|||||||
}
|
}
|
||||||
config.AddConfigPath("$HOME/.config/gtt")
|
config.AddConfigPath("$HOME/.config/gtt")
|
||||||
|
|
||||||
|
// create config file if not exists
|
||||||
if err := config.ReadInConfig(); err != nil {
|
if err := config.ReadInConfig(); err != nil {
|
||||||
config.Set("transparent", false)
|
config.Set("transparent", false)
|
||||||
config.Set("theme", "Gruvbox")
|
config.Set("theme", "Gruvbox")
|
||||||
@ -28,4 +29,10 @@ func configInit() {
|
|||||||
}
|
}
|
||||||
config.SafeWriteConfig();
|
config.SafeWriteConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// setup
|
||||||
|
theme = config.GetString("theme")
|
||||||
|
transparent = config.GetBool("transparent")
|
||||||
|
translator.src_lang = config.GetString("source_language")
|
||||||
|
translator.dst_lang = config.GetString("destination_language")
|
||||||
}
|
}
|
||||||
|
6
main.go
6
main.go
@ -18,13 +18,11 @@ var (
|
|||||||
pages = tview.NewPages()
|
pages = tview.NewPages()
|
||||||
window Window
|
window Window
|
||||||
// config
|
// config
|
||||||
theme string = "Gruvbox"
|
theme string
|
||||||
transparent bool = true
|
transparent bool
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
translator.src_lang = "English"
|
|
||||||
translator.dst_lang = "Chinese (Traditional)"
|
|
||||||
// result, _ := translator.Translate("Hello world\nApple\nbumper")
|
// result, _ := translator.Translate("Hello world\nApple\nbumper")
|
||||||
// fmt.Println(result)
|
// fmt.Println(result)
|
||||||
configInit()
|
configInit()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user