Merge pull request 'Adds version command' (#198) from version-command into release2.3.3

Reviewed-on: #198
This commit is contained in:
Sloom Sloum Sluom IV 2020-11-20 04:02:19 +00:00
commit b8ae9d659c
7 changed files with 21 additions and 15 deletions

View File

@ -13,17 +13,9 @@ test : GOCMD := go1.11.13
# %:z - so settle for %z.
BUILD_TIME := ${shell date "+%Y-%m-%dT%H:%M%z"}
# If VERSION is empty or not defined use the contents of the VERSION file
VERSION := ${shell git describe --exact-match 2> /dev/null}
ifndef VERSION
VERSION := ${shell cat ./VERSION}
endif
LDFLAGS := -ldflags "-s -X main.version=${VERSION} -X main.build=${BUILD_TIME}"
.PHONY: build
build:
${GOCMD} build ${LDFLAGS} -o ${BINARY}
${GOCMD} build -o ${BINARY}
.PHONY: install
install: install-bin install-man install-desktop clean

View File

@ -1 +1 @@
2.3.2
2.3.3

View File

@ -209,6 +209,10 @@ set [setting name] [value]
Sets the value for a given configuration setting. \fIs\fP can be used instead of the full \fIset\fP.
.TP
.B
version
Shows the current Bombadillo version number.
.TP
.B
write .
Writes the current document to a file. The file is named by the last component of the url path. If the last component is blank or \fI/\fP a default name will be used. The file saves to the directory set by the \fIsavelocation\fP setting. \fIw\fP can be entered rather than the full \fIwrite\fP.
.TP
@ -246,7 +250,7 @@ The path to the directory that \fBbombadillo\fP should write files to. This must
.TP
.B
searchengine
The url to use for the LINE COMMANDs \fI?\fP and \fIsearch\fP. Should be a valid search path that terms may be appended to.
The url to use for the LINE COMMAND \fIsearch\fP. Should be a valid search path that terms may be appended to.
.TP
.B
telnetcommand
@ -259,6 +263,8 @@ Can toggle between visual modes. Valid values are \fInormal\fP, \fIcolor\fP, and
.B
timeout
The number of seconds after which connections to gopher or gemini servers should time out if the server has not responded.
.TP
.B
webmode
Controls behavior when following web links. The following values are valid: \fInone\fP will disable following web links, \fIgui\fP will have the browser attempt to open web links in a user's default graphical web browser; \fIlynx\fP, \fIw3m\fP, and \fIelinks\fP will have the browser attempt to use the selected terminal web browser to handle the rendering of web pages and will display the pages directly in Bombadillo.

View File

@ -258,6 +258,7 @@ func (c *client) TakeControlInput() {
}
err = c.NextSearchItem(0)
if err != nil {
c.PageState.History[c.PageState.Position].WrapContent(c.Width-1,(c.Options["theme"] == "color"))
c.Draw()
}
case ':', ' ':
@ -345,6 +346,13 @@ func (c *client) simpleCommand(action string) {
c.search("", "", "?")
case "HELP", "?":
c.Visit(helplocation)
case "VERSION":
ver := version
if ver == "" {
ver = "Improperly compiled, no version information"
}
c.SetMessage("Bombadillo version: " + ver, false)
c.DrawMessage()
default:
c.SetMessage(syntaxErrorMessage(action), true)
c.DrawMessage()

View File

@ -72,7 +72,7 @@ func (s *scanner) scanText() Token {
"S", "SET", "R", "RELOAD", "SEARCH",
"Q", "QUIT", "B", "BOOKMARKS", "H",
"HOME", "?", "HELP", "C", "CHECK",
"P", "PURGE":
"P", "PURGE", "VERSION":
return Token{Action, capInput}
}

View File

@ -23,6 +23,7 @@ var ERRS = map[string]string{
"SET": "`set [setting] [value]`",
"W": "`w [target]`",
"WRITE": "`write [target]`",
"VERSION": "`version`",
"?": "`? [[command]]`",
"HELP": "`help [[command]]`",
}

View File

@ -35,8 +35,7 @@ import (
"tildegit.org/sloum/bombadillo/gemini"
)
var version string
var build string
var version string = "2.3.3"
var bombadillo *client
var helplocation string = "gopher://bombadillo.colorfield.space:70/1/user-guide.map"
@ -211,7 +210,7 @@ func main() {
flag.Usage = printHelp
flag.Parse()
if *getVersion {
fmt.Printf("Bombadillo %s - build %s\n", version, build)
fmt.Printf("Bombadillo %s\n", version)
os.Exit(0)
}
args := flag.Args()