Add version and help commands - fixes #14

This commit is contained in:
makeworld 2020-06-23 20:23:28 -04:00
parent cfe58cb5f3
commit 4eea75edeb
3 changed files with 19 additions and 1 deletions

View File

@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Option to continue anyway when cert doesn't match TOFU database
- Display all `text/*` documents, not just gemini and plain (#12)
- Prefer XDG environment variables if they're set, to specify config dir, etc (#11)
- Version and help commands - `-v`, `--version`, `--help`, `-h` (#14)
### Changed
- Connection timeout is 15 seconds (was 5s)

View File

@ -10,4 +10,6 @@
- Filed [issue 25](https://gitlab.com/tslocum/cview/-/issues/25)
- Modal styling messed up when wrapped - example occurence is the error modal for a long unsupported scheme URL
- Filed [issue 26](https://gitlab.com/tslocum/cview/-/issues/26)
- Add some bold back into modal text after this is fixed
- Add some bold back into modal text after this is fixed
- Bookmark keys aren't deleted, just set to ""
- Waiting on [this viper PR](https://github.com/spf13/viper/pull/519) to be merged

View File

@ -1,18 +1,33 @@
package main
import (
"fmt"
"os"
"github.com/makeworld-the-better-one/amfora/config"
"github.com/makeworld-the-better-one/amfora/display"
)
var version = "1.2.0"
func main() {
// err := logger.Init()
// if err != nil {
// panic(err)
// }
if len(os.Args) > 1 {
if os.Args[1] == "--version" || os.Args[1] == "-v" {
fmt.Println(version)
return
}
if os.Args[1] == "--help" || os.Args[1] == "-h" {
fmt.Println("Amfora is a fancy terminal browser for the Gemini protocol.\r\n")
fmt.Println("Usage:\r\namfora [URL]\r\namfora --version, -v")
return
}
}
err := config.Init()
if err != nil {
panic(err)