2020-06-18 16:54:48 -04:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2020-06-23 20:23:28 -04:00
|
|
|
"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"
|
|
|
|
)
|
|
|
|
|
2020-09-01 19:55:06 -04:00
|
|
|
var (
|
|
|
|
version = "1.5.0"
|
|
|
|
commit = "unknown"
|
|
|
|
builtBy = "unknown"
|
|
|
|
)
|
2020-06-23 20:23:28 -04:00
|
|
|
|
2020-06-18 16:54:48 -04:00
|
|
|
func main() {
|
|
|
|
// err := logger.Init()
|
|
|
|
// if err != nil {
|
|
|
|
// panic(err)
|
|
|
|
// }
|
|
|
|
|
2020-06-23 20:23:28 -04:00
|
|
|
if len(os.Args) > 1 {
|
|
|
|
if os.Args[1] == "--version" || os.Args[1] == "-v" {
|
2020-09-01 19:55:06 -04:00
|
|
|
fmt.Println("Amfora", version)
|
|
|
|
fmt.Println("Commit:", commit)
|
|
|
|
fmt.Println("Built by:", builtBy)
|
2020-06-23 20:23:28 -04:00
|
|
|
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")
|
2020-06-23 20:23:28 -04:00
|
|
|
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()
|
2020-06-24 13:18:23 -04:00
|
|
|
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()
|
2020-06-24 13:18:23 -04:00
|
|
|
if len(os.Args[1:]) > 0 {
|
2020-06-21 19:48:58 -04:00
|
|
|
display.URL(os.Args[1])
|
2020-06-18 16:54:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if err = display.App.Run(); err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|