forked from sloum/bombadillo
Adds flag for displaying title and adds documentation
This commit is contained in:
parent
aeee577e24
commit
4182619a78
13
bombadillo.1
13
bombadillo.1
|
@ -6,6 +6,7 @@
|
||||||
.fam C
|
.fam C
|
||||||
\fBbombadillo\fP [\fIurl\fP]
|
\fBbombadillo\fP [\fIurl\fP]
|
||||||
\fBbombadillo\fP [\fBOPTION\fP]
|
\fBbombadillo\fP [\fBOPTION\fP]
|
||||||
|
\fBbombadillo\fP [\fBOPTION\fP] [\fIurl\fP]
|
||||||
.fam T
|
.fam T
|
||||||
.fi
|
.fi
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
|
@ -15,12 +16,16 @@
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB-v\fP
|
\fB-h\fP
|
||||||
Display version information and exit.
|
Usage help. Displays all command line options with a short description and exits.
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB-h\fP
|
\fB-t\fP
|
||||||
Usage help. Displays all command line options with a short description.
|
Set the window title to Bomabdillo and run Bombadillo.
|
||||||
|
.TP
|
||||||
|
.B
|
||||||
|
\fB-v\fP
|
||||||
|
Display version information and exit.
|
||||||
.SH PROTOCOL SUPPORT
|
.SH PROTOCOL SUPPORT
|
||||||
All of the below protocols are supported. With the exception of gopher, the protocol name must be present as the scheme component of a url in the form of \fI[protocol]://[the rest of the url]\fP.
|
All of the below protocols are supported. With the exception of gopher, the protocol name must be present as the scheme component of a url in the form of \fI[protocol]://[the rest of the url]\fP.
|
||||||
.TP
|
.TP
|
||||||
|
|
|
@ -5,6 +5,6 @@ GenericName=Non-Web Browser
|
||||||
Comment=View gopher, gemini, finger, telnet, http(s) sites over the internet
|
Comment=View gopher, gemini, finger, telnet, http(s) sites over the internet
|
||||||
Terminal=true
|
Terminal=true
|
||||||
Categories=Network;WebBrowser;ConsoleOnly;
|
Categories=Network;WebBrowser;ConsoleOnly;
|
||||||
Exec=bombadillo %U
|
Exec=bombadillo -t %u
|
||||||
Icon=bombadillo-icon
|
Icon=bombadillo-icon
|
||||||
MimeType=x-scheme-handler/gopher;x-scheme-handler/gemini;x-scheme-handler/finger;
|
MimeType=x-scheme-handler/gopher;x-scheme-handler/gemini;x-scheme-handler/finger;
|
||||||
|
|
|
@ -49,17 +49,15 @@ func Exit(exitCode int, msg string) {
|
||||||
if msg != "" {
|
if msg != "" {
|
||||||
fmt.Print(msg, "\n")
|
fmt.Print(msg, "\n")
|
||||||
}
|
}
|
||||||
fmt.Print("\033[23;0t")
|
fmt.Print("\033[23;0t") // Restore window title from terminal stack
|
||||||
os.Exit(exitCode)
|
os.Exit(exitCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
// InitTerm sets the terminal modes appropriate for Bombadillo
|
// InitTerm sets the terminal modes appropriate for Bombadillo
|
||||||
func InitTerm() {
|
func InitTerm() {
|
||||||
SetCharMode()
|
SetCharMode()
|
||||||
fmt.Print("\033[22;0t")
|
|
||||||
Tput("rmam") // turn off line wrapping
|
Tput("rmam") // turn off line wrapping
|
||||||
Tput("smcup") // use alternate screen
|
Tput("smcup") // use alternate screen
|
||||||
fmt.Print("\033]0;Bombadillo\007")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CleanupTerm reverts changs to terminal mode made by InitTerm
|
// CleanupTerm reverts changs to terminal mode made by InitTerm
|
||||||
|
|
9
main.go
9
main.go
|
@ -168,8 +168,10 @@ func printHelp() {
|
||||||
|
|
||||||
Syntax: bombadillo [url]
|
Syntax: bombadillo [url]
|
||||||
bombadillo [options...]
|
bombadillo [options...]
|
||||||
|
bombadillo -t [url]
|
||||||
|
|
||||||
Examples: bombadillo gopher://bombadillo.colorfield.space
|
Examples: bombadillo gopher://bombadillo.colorfield.space
|
||||||
|
bombadillo -t
|
||||||
bombadillo -v
|
bombadillo -v
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
|
@ -180,6 +182,7 @@ Options:
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
getVersion := flag.Bool("v", false, "Display version information and exit")
|
getVersion := flag.Bool("v", false, "Display version information and exit")
|
||||||
|
addTitleToXWindow := flag.Bool("t", false, "Change the window title to Bomabdillo while running")
|
||||||
flag.Usage = printHelp
|
flag.Usage = printHelp
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
if *getVersion {
|
if *getVersion {
|
||||||
|
@ -189,6 +192,12 @@ func main() {
|
||||||
args := flag.Args()
|
args := flag.Args()
|
||||||
|
|
||||||
cui.InitTerm()
|
cui.InitTerm()
|
||||||
|
|
||||||
|
if *addTitleToXWindow {
|
||||||
|
fmt.Print("\033[22;0t") // Store window title on terminal stack
|
||||||
|
fmt.Print("\033]0;Bombadillo\007") // Update window title
|
||||||
|
}
|
||||||
|
|
||||||
defer cui.Exit(0, "")
|
defer cui.Exit(0, "")
|
||||||
initClient()
|
initClient()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue