Merge branch 'command-line-cleanup' of asdf/bombadillo into develop

This commit is contained in:
Sloom Sloum Sluom IV 2019-10-23 21:57:23 -04:00 committed by Gitea
commit 24e2509831
3 changed files with 24 additions and 6 deletions

View File

@ -1,4 +1,4 @@
# Bombadillo # Bombadillo - a non-web client
Bombadillo is a modern [Gopher](https://en.wikipedia.org/wiki/Gopher_(protocol)) client for the terminal, and functions as a pager/terminal UI. Bombadillo features vim-like keybindings, configurable settings, and a robust command selection. Bombadillo is under active development. Bombadillo is a modern [Gopher](https://en.wikipedia.org/wiki/Gopher_(protocol)) client for the terminal, and functions as a pager/terminal UI. Bombadillo features vim-like keybindings, configurable settings, and a robust command selection. Bombadillo is under active development.

View File

@ -4,7 +4,8 @@
.SH SYNOPSIS .SH SYNOPSIS
.nf .nf
.fam C .fam C
\fBbombadillo\fP [\fB-v\fP] [\fB-h\fP] [\fIurl\fP] \fBbombadillo\fP [\fIurl\fP]
\fBbombadillo\fP [\fBOPTION\fP]
.fam T .fam T
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
@ -13,7 +14,7 @@
.TP .TP
.B .B
\fB-v\fP \fB-v\fP
Display the version number of \fBbombadillo\fP. Display version information and exit.
.TP .TP
.B .B
\fB-h\fP \fB-h\fP

23
main.go
View File

@ -112,7 +112,7 @@ func loadConfig() error {
if lowerkey == "configlocation" { if lowerkey == "configlocation" {
// The config defaults to the home folder. // The config defaults to the home folder.
// Users cannot really edit this value. But // Users cannot really edit this value. But
// a compile time override is available. // a compile time override is available.
// It is still stored in the ini and as a part // It is still stored in the ini and as a part
// of the options map. // of the options map.
continue continue
@ -161,11 +161,28 @@ func handleSIGCONT(c <-chan os.Signal) {
} }
} }
//printHelp produces a nice display message when the --help flag is used
func printHelp() {
art := `Bombadillo - a non-web client
Syntax: bombadillo [url]
bombadillo [options...]
Examples: bombadillo gopher://bombadillo.colorfield.space
bombadillo -v
Options:
`
fmt.Fprint(os.Stdout, art)
flag.PrintDefaults()
}
func main() { func main() {
getVersion := flag.Bool("v", false, "See version number") getVersion := flag.Bool("v", false, "Display version information and exit")
flag.Usage = printHelp
flag.Parse() flag.Parse()
if *getVersion { if *getVersion {
fmt.Printf("Bombadillo %s\n", version) fmt.Printf("Bombadillo %s - build %s\n", version, build)
os.Exit(0) os.Exit(0)
} }
args := flag.Args() args := flag.Args()