1
0
mirror of https://github.com/makew0rld/amfora.git synced 2024-11-03 02:37:23 -05:00
amfora/amfora.go

52 lines
1009 B
Go
Raw Normal View History

2020-06-18 16:54:48 -04:00
package main
import (
"fmt"
2020-06-18 16:54:48 -04:00
"os"
"github.com/makeworld-the-better-one/amfora/config"
"github.com/makeworld-the-better-one/amfora/display"
)
var version = "1.4.0-unreleased"
2020-06-18 16:54:48 -04:00
func main() {
// err := logger.Init()
// if err != nil {
// panic(err)
// }
if len(os.Args) > 1 {
if os.Args[1] == "--version" || os.Args[1] == "-v" {
2020-07-10 19:16:13 -04:00
fmt.Println("amfora v" + version)
return
}
if os.Args[1] == "--help" || os.Args[1] == "-h" {
2020-07-09 19:28:39 -04:00
fmt.Println("Amfora is a fancy terminal browser for the Gemini protocol.")
fmt.Println()
fmt.Println("Usage:")
fmt.Println("amfora [URL]")
fmt.Println("amfora --version, -v")
return
}
}
2020-06-18 16:54:48 -04:00
err := config.Init()
if err != nil {
2020-07-09 19:28:39 -04:00
fmt.Printf("Config error: %v\n", err)
os.Exit(1)
2020-06-18 16:54:48 -04:00
}
2020-07-09 19:28:39 -04:00
display.Init()
display.NewTab()
2020-07-03 12:22:44 -04:00
display.NewTab() // Open extra tab and close it to fully initialize the app and wrapping
display.CloseTab()
if len(os.Args[1:]) > 0 {
display.URL(os.Args[1])
2020-06-18 16:54:48 -04:00
}
if err = display.App.Run(); err != nil {
panic(err)
}
}