2020-06-18 23:54:48 +03:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2020-06-24 03:23:28 +03:00
|
|
|
"fmt"
|
2020-06-18 23:54:48 +03:00
|
|
|
"os"
|
|
|
|
|
|
|
|
"github.com/makeworld-the-better-one/amfora/config"
|
|
|
|
"github.com/makeworld-the-better-one/amfora/display"
|
|
|
|
)
|
|
|
|
|
2020-07-03 06:55:24 +03:00
|
|
|
var version = "1.3.0-unreleased"
|
2020-06-24 03:23:28 +03:00
|
|
|
|
2020-06-18 23:54:48 +03:00
|
|
|
func main() {
|
|
|
|
// err := logger.Init()
|
|
|
|
// if err != nil {
|
|
|
|
// panic(err)
|
|
|
|
// }
|
|
|
|
|
2020-06-24 03:23:28 +03:00
|
|
|
if len(os.Args) > 1 {
|
|
|
|
if os.Args[1] == "--version" || os.Args[1] == "-v" {
|
2020-06-24 20:18:23 +03:00
|
|
|
fmt.Print(version + "\r\n")
|
2020-06-24 03:23:28 +03:00
|
|
|
return
|
|
|
|
}
|
|
|
|
if os.Args[1] == "--help" || os.Args[1] == "-h" {
|
2020-06-24 20:18:23 +03:00
|
|
|
fmt.Print("Amfora is a fancy terminal browser for the Gemini protocol.\r\n\r\n")
|
|
|
|
fmt.Print("Usage:\r\namfora [URL]\r\namfora --version, -v\r\n")
|
2020-06-24 03:23:28 +03:00
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-18 23:54:48 +03:00
|
|
|
err := config.Init()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
display.Init()
|
|
|
|
|
2020-06-24 20:18:23 +03:00
|
|
|
display.NewTab()
|
|
|
|
if len(os.Args[1:]) > 0 {
|
2020-06-22 02:48:58 +03:00
|
|
|
display.URL(os.Args[1])
|
2020-06-18 23:54:48 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if err = display.App.Run(); err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|