From 7ed2b46b326976268ff7eb27161c17824254aefc Mon Sep 17 00:00:00 2001 From: Brian Evans Date: Mon, 14 Oct 2019 16:29:40 -0700 Subject: [PATCH 01/17] First go at a makefile, woo-hoo! --- Makefile | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ VERSION | 1 + main.go | 14 +++++++++++--- 3 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 Makefile create mode 100644 VERSION diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..99ba95a --- /dev/null +++ b/Makefile @@ -0,0 +1,51 @@ +BINARY := bombadillo +man1dir := /usr/local/share/man/man1 +#PKGS := $(shell go list ./... |grep -v /vendor) +VERSION := $(shell git describe --tags 2> /dev/null) +BUILD := $(shell date) +GOPATH ?= $(HOME)/go +GOBIN ?= ${GOPATH}/bin +BUILD_PATH ?= ${GOBIN} + +# If VERSION is empty or not deffined use the contents of the VERSION file +ifndef VERSION + VERSION := $(shell cat ./VERSION) +endif + +LDFLAGS := +ifdef CONF_PATH + LDFLAGS := -ldflags "-s -X main.version=${VERSION} -X main.build=${BUILD} -X main.conf_path${conf_path}" +else + LDFLAGS := -ldflags "-s -X main.version=${VERSION} -X main.build=${BUILD}" +endif + +.PHONY: test +test: + @echo ${LDFLAGS} + @echo ${VERSION} + @echo ${BUILD_PATH} + +.PHONY: build +build: + @go build ${LDFLAGS} -o ${BINARY} + +.PHONY: install +install: install-man + @go build ${LDFLAGS} -o ${BUILD_PATH}/${BINARY} + +.PHONY: install-man +install-man: bombadillo.1 + @gzip -k ./bombadillo.1 + @install -d ${man1dir} + @install -m 0644 ./bombadillo.1.gz ${man1dir} + +.PHONY: clean +clean: + @go clean -i + @rm ./bombadillo.1.gz 2> /dev/null + +.PHONY: uninstall +uninstall: clean + @rm -f ${man1dir}/bombadillo.1.gz + @echo Removing ${BINARY} + @rm -f ${BUILD_PATH}/${BINARY} diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..46b105a --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +v2.0.0 diff --git a/main.go b/main.go index 249139d..ded782d 100644 --- a/main.go +++ b/main.go @@ -32,7 +32,9 @@ import ( "tildegit.org/sloum/mailcap" ) -const version = "2.0.0" +var version string +var build string +var conf_path string var bombadillo *client var helplocation string = "gopher://colorfield.space:70/1/bombadillo-info" @@ -95,6 +97,11 @@ func lowerCaseOpt(opt, val string) string { } func loadConfig() error { + // If a compile time override exists for configlocation + // set it before loading the config. + if conf_path != "" { + bombadillo.Options["configlocation"] = conf_path + } file, err := os.Open(bombadillo.Options["configlocation"] + "/.bombadillo.ini") if err != nil { err = saveConfig() @@ -109,8 +116,9 @@ func loadConfig() error { for _, v := range settings.Settings { lowerkey := strings.ToLower(v.Key) if lowerkey == "configlocation" { - // The config should always be stored in home - // folder. Users cannot really edit this value. + // The config defaults to the home folder. + // Users cannot really edit this value. But + // a compile time override is available. // It is still stored in the ini and as a part // of the options map. continue From 59aa8a1ef29f75ea9f0d343c281666caa5233d98 Mon Sep 17 00:00:00 2001 From: sloumdrone Date: Mon, 14 Oct 2019 20:25:32 -0700 Subject: [PATCH 02/17] Removes old files, updates default homepage, and more makefile stuff --- Makefile | 23 ++++--- bombadillo-info | 162 ------------------------------------------------ defaults.go | 2 +- notes.md | 60 ------------------ 4 files changed, 15 insertions(+), 232 deletions(-) delete mode 100644 bombadillo-info delete mode 100644 notes.md diff --git a/Makefile b/Makefile index 99ba95a..e5d651e 100644 --- a/Makefile +++ b/Makefile @@ -1,22 +1,26 @@ BINARY := bombadillo man1dir := /usr/local/share/man/man1 -#PKGS := $(shell go list ./... |grep -v /vendor) -VERSION := $(shell git describe --tags 2> /dev/null) -BUILD := $(shell date) -GOPATH ?= $(HOME)/go +GOPATH ?= ${HOME}/go GOBIN ?= ${GOPATH}/bin BUILD_PATH ?= ${GOBIN} +# Use a dateformat rather than -I flag since OSX +# does not support -I. It also doesn't support +# %:z - so settle for %z. +BUILD_TIME := ${shell date "+%Y-%m-%dT%H:%M%z"} + # If VERSION is empty or not deffined use the contents of the VERSION file +VERSION := ${shell git describe --tags 2> /dev/null} ifndef VERSION - VERSION := $(shell cat ./VERSION) + VERSION := ${shell cat ./VERSION} endif -LDFLAGS := +# If an alternate configuration path is provided when make is run, +# include it as an ldflag ifdef CONF_PATH - LDFLAGS := -ldflags "-s -X main.version=${VERSION} -X main.build=${BUILD} -X main.conf_path${conf_path}" + LDFLAGS := -ldflags "-s -X main.version=${VERSION} -X main.build=${BUILD_TIME} -X main.conf_path=${CONF_PATH}" else - LDFLAGS := -ldflags "-s -X main.version=${VERSION} -X main.build=${BUILD}" + LDFLAGS := -ldflags "-s -X main.version=${VERSION} -X main.build=${BUILD_TIME}" endif .PHONY: test @@ -42,10 +46,11 @@ install-man: bombadillo.1 .PHONY: clean clean: @go clean -i - @rm ./bombadillo.1.gz 2> /dev/null + @rm -f ./bombadillo.1.gz 2> /dev/null .PHONY: uninstall uninstall: clean @rm -f ${man1dir}/bombadillo.1.gz @echo Removing ${BINARY} @rm -f ${BUILD_PATH}/${BINARY} + diff --git a/bombadillo-info b/bombadillo-info deleted file mode 100644 index dd5807a..0000000 --- a/bombadillo-info +++ /dev/null @@ -1,162 +0,0 @@ -i false null.host 70 -i false null.host 70 -i **** bombadillo **** false null.host 70 -i false null.host 70 -ibombadillo is a gopher client for the terminal. it functions as a pager false null.host 70 -iwith a "full screen" terminal user interface. keys are mapped similarly false null.host 70 -ito vim (as detailed below). source code can be downloaded from the link false null.host 70 -iand is written in golang. linux and osx are fully supported for both arm false null.host 70 -iand x86_64. false null.host 70 -i false null.host 70 -iin bombadillo, scroll down with 'j' and up with 'k'. this is being false null.host 70 -ilisted here to facilitate easier viewing of the rest of this doc false null.host 70 -ifor first time users. false null.host 70 -i false null.host 70 -i false null.host 70 -isource code is available here: false null.host 70 -hhttp://tildegit.org/sloum/bombadillo url:http://tildegit.org/sloum/bombadillo colorfield.space 70 -i false null.host 70 -iweb based documentation/links available here: false null.host 70 -hhttps://rawtext.club/~sloum/bombadillo.html url:https://rawtext.club/~sloum/bombadillo.html colorfield.space 70 -i false null.host 70 -i false null.host 70 -ito open the above link in bombadillo a user must enable the feature. to do so false null.host 70 -ia user would ":set openhttp true". this will open the http based web link in false null.host 70 -itheir default web browser. a user can change back to false at any time if false null.host 70 -iprefer to not open non-gopher links. if a default web browser is not set, the false null.host 70 -itrue value will still result in failure :( unfortunately, if you are in a false null.host 70 -inon-graphical environment entiely (such as in a remote shell) you will likely false null.host 70 -inot be able to open a web browser as lynx (or the like) are not generally false null.host 70 -iset up to work as a system default browser. -i false null.host 70 -ibombadillo uses, if it is available, the alternate terminal buffer. this will false null.host 70 -ihelp keep your terminal clean when you exit as well as create a better full false null.host 70 -iscreen experience in a terminal. a configuration flag to toggle this feature false null.host 70 -iis in the works. -i false null.host 70 -i false null.host 70 -i** quick start ** false null.host 70 -i false null.host 70 -iupon opening bombadillo for the first time a user will be presented with this false null.host 70 -iscreen and a top bar with the application title. to visit a page a user can false null.host 70 -ienter a colon followed by a gopher url or a link number (shown on the active false null.host 70 -ipage to the left of link text and to the right of the gopher type). For false null.host 70 -iexample: false null.host 70 -i false null.host 70 -i:colorfield.space false null.host 70 -i false null.host 70 -iupon doing so the user will see the colorfield.space gopher page false null.host 70 -iyou will see the ':' key come up a lot as it leads into many commands. false null.host 70 -i false null.host 70 -iyou can pass a url to bombadillo when opening it from the terminal. false null.host 70 -idoing so will open the client directly to that url. for example: false null.host 70 -i false null.host 70 -i bombadillo gopher://colorfield.space false null.host 70 -i false null.host 70 -i false null.host 70 -iA note on window resizing: false null.host 70 -i false null.host 70 -iIf you resize your terminal window the screen will wrap text in weird/wild false null.host 70 -iways. Pressing any key when the screen is in this state will redraw the false null.host 70 -iscreen and realign the text. false null.host 70 -i false null.host 70 -i false null.host 70 -i false null.host 70 -i** hot keys ** false null.host 70 -i false null.host 70 -isome keys function as "hot keys". when pressed, they will initite an false null.host 70 -iaction immediately. the following keys work as hot keys: false null.host 70 -i false null.host 70 -ikey behavior false null.host 70 -i-------- -------------------------------------------------------------- false null.host 70 -i q quit bombadillo false null.host 70 -i b back (go back a place in browsing history if available) false null.host 70 -i f forward (go forward a place in browsing history if available) false null.host 70 -i j scroll down (if there is room to do so) false null.host 70 -i k scroll up (if there is room to do so) false null.host 70 -i G scroll to bottom (end) false null.host 70 -i g scroll to top (home) false null.host 70 -i d page down false null.host 70 -i u page up false null.host 70 -i B toggle bookmarks sidebar into or out of view false null.host 70 -i : enter command mode false null.host 70 -i SPC enter command mode false null.host 70 -i TAB cycle window focus false null.host 70 -i false null.host 70 -i *window focus changes only have an effect if the bookmark window is open. false null.host 70 -i Changing focus will allow the focused window to be scrolled while both false null.host 70 -i windows are visible on screen. false null.host 70 -i false null.host 70 -i false null.host 70 -i false null.host 70 -i** commands ** false null.host 70 -i false null.host 70 -ionce in command mode, the following commands are available: false null.host 70 -i (most can function using just their first letter... ex: false null.host 70 -i :q will quit false null.host 70 -i :w . somefile.txt will save the current file as somefile.txt false null.host 70 -i all current commands work this way in addition to their long form) false null.host 70 -i false null.host 70 -i false null.host 70 -iaction syntax notes false null.host 70 -i----------------- -------------------------------- --------------------- false null.host 70 -iquit bombadillo :quit same as 'q' hot key false null.host 70 -ivisit homepage :home set by homeurl option false null.host 70 -ivisit help :help short version :? false null.host 70 -isearch :search will ask for kwds false null.host 70 -ivisit url :[url] valid gopher url false null.host 70 -ivisit link :[number] link # on active page false null.host 70 -iview bookmarks :bookmarks same as 'B' hot key false null.host 70 -ivisit bookmark :bookmarks [number] valid bookmark # false null.host 70 -iadd bookmark :add [url] [bookmark title] valid gopher url false null.host 70 -iadd bookmark :add [link #] [bookmark title] link # on active page false null.host 70 -iadd bookmark :add . [bookmark title] adds active page false null.host 70 -idelete bookmark :delete [number] valid bookmark # false null.host 70 -iset an option :set [option] [value] used for configuration false null.host 70 -icheck an option :check [option name] used to check config false null.host 70 -iwrite to file :write [url] [file name] valid gopher url false null.host 70 -iwrite to file :write [link #] [file name] link # on active page false null.host 70 -iwrite to file :write . [file name] saves active page false null.host 70 -i false null.host 70 -i *: navigating to a non-text gophertype will automaticall save false null.host 70 -i files save to the path set by the 'saveurl' option (defaults false null.host 70 -i to a user's Downloads folder in their home directory). false null.host 70 -i **: search is entered on its own and will query the user for keywords false null.host 70 -i and will then query the search service set as 'searchengine' false null.host 70 -i (defaults to veronica2) false null.host 70 -i false null.host 70 -i false null.host 70 -i false null.host 70 -i false null.host 70 -i** configuartion ** false null.host 70 -i false null.host 70 -ivarious configuartion options can be set via the 'set' command. false null.host 70 -ithe following are the currently avialable options, more will be false null.host 70 -icoming in the near future (including color theme options) false null.host 70 -i false null.host 70 -ionce a user sets an option or adds a bookmark a config file will be false null.host 70 -icreated in their home directory. the file will be named '.bombadillo.ini' false null.host 70 -iwhile it can be edited directly, it is recommended to use bombadillo false null.host 70 -ito interact with said file. -i false null.host 70 -i false null.host 70 -i option value type default false null.host 70 -i--------------- ------------------------- ------------------------ false null.host 70 -i false null.host 70 -ihomeurl valid gopher url this document false null.host 70 -isavelocation an non-relative filepath /[home path]/Downloads/ false null.host 70 -isearchengine a type 7 gopher url gopher.floodgap.com:70/7/v2/vs false null.host 70 -iopenhttp true/false false false null.host 70 -i false null.host 70 -i false null.host 70 -i false null.host 70 -i false null.host 70 -i false null.host 70 -i false null.host 70 -ifor more information please contact the following: false null.host 70 -1colorfield space / colorfield.space 70 -isloum@sdf.org false null.host 70 -htildegit url:http://tildergit.org/sloum colorfield.space 70 -i false null.host 70 -i false null.host 70 -i false null.host 70 diff --git a/defaults.go b/defaults.go index e3273d2..93b25cc 100644 --- a/defaults.go +++ b/defaults.go @@ -12,7 +12,7 @@ var defaultOptions = map[string]string{ // Edit these values before compile to have different default values // ... though they can always be edited from within bombadillo as well // it just may take more time/work. - "homeurl": "gopher://colorfield.space:70/1/bombadillo-info", + "homeurl": "gopher://bombadillo.colorfield.space:70/1/user-guide.map", "savelocation": userinfo.HomeDir, "searchengine": "gopher://gopher.floodgap.com:70/7/v2/vs", "openhttp": "false", diff --git a/notes.md b/notes.md deleted file mode 100644 index cc6d2e1..0000000 --- a/notes.md +++ /dev/null @@ -1,60 +0,0 @@ -TODO -- Add styles/color support -- Add code comments/documentation for all items -- Make sure html links using the URL convention work correctly - - - -Control keys/input: - -q quit -j scrolldown -k scrollup -f toggle showing favorites as subwindow -TODO - r refresh current page data (re-request) - -GO -:# go to link num -:url go to url - -SIMPLE -:quit quit -:home visit home -:bookmarks toogle bookmarks window -:search -:help - -DOLINK -:delete # delete bookmark with num -:bookmarks # visit bookmark with num - -DOLINKAS -:write # name write linknum to file -:add # name add link num as favorite - -DOAS -:write url name write url to file -:add url name add link url as favorite -:set something something set a system variable - - - -value, action, word - -- - - - - - - - - - - - - - - - - - - -Config format: - -[favorites] -colorfield.space ++ gopher://colorfield.space:70/ -My phlog ++ gopher://circumlunar.space/1/~sloum/ - -[options] -home ++ gopher://sdf.org -searchengine ++ gopher://floodgap.place/v2/veronicasomething -savelocation ++ ~/Downloads/ -httpbrowser ++ lynx -openhttp ++ true - - - From 3e6c61dcdc44803fd593ad1da17e037861ed80fb Mon Sep 17 00:00:00 2001 From: sloumdrone Date: Mon, 14 Oct 2019 20:27:40 -0700 Subject: [PATCH 03/17] Remaps help to the user guide at bombadillo.colorfield.space --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index ded782d..9f0eadb 100644 --- a/main.go +++ b/main.go @@ -37,7 +37,7 @@ var build string var conf_path string var bombadillo *client -var helplocation string = "gopher://colorfield.space:70/1/bombadillo-info" +var helplocation string = "gopher://bombadillo.colorfield.space:70/1/user-guide.map" var settings config.Config var mc *mailcap.Mailcap From 6609cca70e3197d6e84d61407246fa09fe182c1a Mon Sep 17 00:00:00 2001 From: sloumdrone Date: Mon, 14 Oct 2019 20:34:20 -0700 Subject: [PATCH 04/17] Removed a v from the sprintf for version output. --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 9f0eadb..1a8ff27 100644 --- a/main.go +++ b/main.go @@ -171,7 +171,7 @@ func main() { getVersion := flag.Bool("v", false, "See version number") flag.Parse() if *getVersion { - fmt.Printf("Bombadillo v%s\n", version) + fmt.Printf("Bombadillo %s\n", version) os.Exit(0) } args := flag.Args() From 32e769c9da1aa221819c9493892f6b7939fd52cc Mon Sep 17 00:00:00 2001 From: Brian Evans Date: Tue, 15 Oct 2019 08:53:47 -0700 Subject: [PATCH 05/17] Moves custom config path into defaults.go from makefile --- Makefile | 8 +------- defaults.go | 7 ++++++- main.go | 6 ------ 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index e5d651e..17e6b8f 100644 --- a/Makefile +++ b/Makefile @@ -15,13 +15,7 @@ ifndef VERSION VERSION := ${shell cat ./VERSION} endif -# If an alternate configuration path is provided when make is run, -# include it as an ldflag -ifdef CONF_PATH - LDFLAGS := -ldflags "-s -X main.version=${VERSION} -X main.build=${BUILD_TIME} -X main.conf_path=${CONF_PATH}" -else - LDFLAGS := -ldflags "-s -X main.version=${VERSION} -X main.build=${BUILD_TIME}" -endif +LDFLAGS := -ldflags "-s -X main.version=${VERSION} -X main.build=${BUILD_TIME}" .PHONY: test test: diff --git a/defaults.go b/defaults.go index 93b25cc..8766005 100644 --- a/defaults.go +++ b/defaults.go @@ -12,11 +12,16 @@ var defaultOptions = map[string]string{ // Edit these values before compile to have different default values // ... though they can always be edited from within bombadillo as well // it just may take more time/work. + // + // To change the default location for the config you can enter + // any valid path as a string, if you want an absolute, or + // concatenate with the main default: `userinfo.HomeDir` like so: + // "configlocation": userinfo.HomeDir + "/config/" "homeurl": "gopher://bombadillo.colorfield.space:70/1/user-guide.map", "savelocation": userinfo.HomeDir, "searchengine": "gopher://gopher.floodgap.com:70/7/v2/vs", "openhttp": "false", - "httpbrowser": "lynx", + "httpbrowser": "", "telnetcommand": "telnet", "configlocation": userinfo.HomeDir, "theme": "normal", // "normal", "inverted" diff --git a/main.go b/main.go index 1a8ff27..1189d77 100644 --- a/main.go +++ b/main.go @@ -34,7 +34,6 @@ import ( var version string var build string -var conf_path string var bombadillo *client var helplocation string = "gopher://bombadillo.colorfield.space:70/1/user-guide.map" @@ -97,11 +96,6 @@ func lowerCaseOpt(opt, val string) string { } func loadConfig() error { - // If a compile time override exists for configlocation - // set it before loading the config. - if conf_path != "" { - bombadillo.Options["configlocation"] = conf_path - } file, err := os.Open(bombadillo.Options["configlocation"] + "/.bombadillo.ini") if err != nil { err = saveConfig() From 33bca45b98137159e875273edace90e5f1fd31c5 Mon Sep 17 00:00:00 2001 From: Brian Evans Date: Tue, 15 Oct 2019 09:31:48 -0700 Subject: [PATCH 06/17] Makes makefile structure more modular and fixes clean to not remove installed binary --- Makefile | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 17e6b8f..b10a461 100644 --- a/Makefile +++ b/Makefile @@ -17,34 +17,31 @@ endif LDFLAGS := -ldflags "-s -X main.version=${VERSION} -X main.build=${BUILD_TIME}" -.PHONY: test -test: - @echo ${LDFLAGS} - @echo ${VERSION} - @echo ${BUILD_PATH} +.PHONY: install +install: build install-bin install-man clean .PHONY: build build: - @go build ${LDFLAGS} -o ${BINARY} - -.PHONY: install -install: install-man - @go build ${LDFLAGS} -o ${BUILD_PATH}/${BINARY} + go build ${LDFLAGS} -o ${BINARY} .PHONY: install-man install-man: bombadillo.1 - @gzip -k ./bombadillo.1 - @install -d ${man1dir} - @install -m 0644 ./bombadillo.1.gz ${man1dir} + gzip -k ./bombadillo.1 + install -d ${man1dir} + install -m 0644 ./bombadillo.1.gz ${man1dir} + +.PHONY: install-bin +install-bin: + install -d ${BUILD_PATH} + install ./${BINARY} ${BUILD_PATH}/${BINARY} .PHONY: clean clean: - @go clean -i - @rm -f ./bombadillo.1.gz 2> /dev/null + go clean + rm -f ./bombadillo.1.gz 2> /dev/null .PHONY: uninstall uninstall: clean - @rm -f ${man1dir}/bombadillo.1.gz - @echo Removing ${BINARY} - @rm -f ${BUILD_PATH}/${BINARY} + rm -f ${man1dir}/bombadillo.1.gz + rm -f ${BUILD_PATH}/${BINARY} From d22d8bf40622d7136574e1e88ea4c2b98af4a5d4 Mon Sep 17 00:00:00 2001 From: sloumdrone Date: Wed, 16 Oct 2019 19:23:39 -0700 Subject: [PATCH 07/17] Updated uninstall logic to work better, particularly with non-gopath install points --- Makefile | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index b10a461..6c21323 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,9 @@ -BINARY := bombadillo -man1dir := /usr/local/share/man/man1 -GOPATH ?= ${HOME}/go -GOBIN ?= ${GOPATH}/bin -BUILD_PATH ?= ${GOBIN} +BINARY := bombadillo +man1dir := /usr/local/share/man/man1 +GOPATH ?= ${HOME}/go +GOBIN ?= ${GOPATH}/bin +BUILD_PATH ?= ${GOBIN} +UNINST_FROM := ${shell which bombadillo} # Use a dateformat rather than -I flag since OSX # does not support -I. It also doesn't support @@ -18,7 +19,7 @@ endif LDFLAGS := -ldflags "-s -X main.version=${VERSION} -X main.build=${BUILD_TIME}" .PHONY: install -install: build install-bin install-man clean +install: install-bin install-man clean .PHONY: build build: @@ -31,9 +32,9 @@ install-man: bombadillo.1 install -m 0644 ./bombadillo.1.gz ${man1dir} .PHONY: install-bin -install-bin: +install-bin: build install -d ${BUILD_PATH} - install ./${BINARY} ${BUILD_PATH}/${BINARY} + install -m 0755 ./${BINARY} ${BUILD_PATH}/${BINARY} .PHONY: clean clean: @@ -43,5 +44,5 @@ clean: .PHONY: uninstall uninstall: clean rm -f ${man1dir}/bombadillo.1.gz - rm -f ${BUILD_PATH}/${BINARY} + rm -f ${UNINST_FROM} From 1031805bfca2bd27d6558964ec3a03e4d14e1bc5 Mon Sep 17 00:00:00 2001 From: asdf Date: Mon, 21 Oct 2019 13:23:58 +1100 Subject: [PATCH 08/17] Ammended variables to include prefix and destdir --- Makefile | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 6c21323..5786f8b 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,6 @@ -BINARY := bombadillo -man1dir := /usr/local/share/man/man1 -GOPATH ?= ${HOME}/go -GOBIN ?= ${GOPATH}/bin -BUILD_PATH ?= ${GOBIN} -UNINST_FROM := ${shell which bombadillo} +BINARY := bombadillo +PREFIX := /usr/local +MANPREFIX := ${PREFIX}/share/man # Use a dateformat rather than -I flag since OSX # does not support -I. It also doesn't support @@ -18,23 +15,23 @@ endif LDFLAGS := -ldflags "-s -X main.version=${VERSION} -X main.build=${BUILD_TIME}" -.PHONY: install -install: install-bin install-man clean - .PHONY: build build: go build ${LDFLAGS} -o ${BINARY} +.PHONY: install +install: install-bin install-man clean + .PHONY: install-man install-man: bombadillo.1 gzip -k ./bombadillo.1 - install -d ${man1dir} - install -m 0644 ./bombadillo.1.gz ${man1dir} + install -d ${DESTDIR}${MANPREFIX}/man1 + install -m 0644 ./bombadillo.1.gz ${DESTDIR}${MANPREFIX}/man1 .PHONY: install-bin install-bin: build - install -d ${BUILD_PATH} - install -m 0755 ./${BINARY} ${BUILD_PATH}/${BINARY} + install -d ${DESTDIR}${PREFIX}/bin + install -m 0755 ./${BINARY} ${DESTDIR}${PREFIX}/bin/${BINARY} .PHONY: clean clean: @@ -43,6 +40,6 @@ clean: .PHONY: uninstall uninstall: clean - rm -f ${man1dir}/bombadillo.1.gz - rm -f ${UNINST_FROM} + rm -f ${DESTDIR}${MANPREFIX}/man1/bombadillo.1.gz + rm -f ${DESTDIR}${PREFIX}/bin/${BINARY} From 68a91c58f22b0b007809949c67bd4f355075cee4 Mon Sep 17 00:00:00 2001 From: asdf Date: Tue, 22 Oct 2019 13:55:33 +1100 Subject: [PATCH 09/17] Updated README.md to reflect new build options --- README.md | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 9bf3b31..2bf2897 100644 --- a/README.md +++ b/README.md @@ -9,33 +9,47 @@ These instructions will get a copy of the project up and running on your local m ### Prerequisites -If building from source, you will need to have [Go](https://golang.org/) version >= 1.11. Bombadillo uses the module system, so if using 1.11 you will need to have that feature enabled. If using a version > 1.11, you already have modules enabled. +If building from source, you will need to have [Go](https://golang.org/) version >= 1.12. -Bombadillo does not use any outside dependencies beyond the Go standard library. +While Bombadillo has one external dependency of [Mailcap](https://tildegit.org/sloum/mailcap), no action is typically required to download this, as it is handled automatically during the build process. ### Installing -Assuming you have `go` installed, run the following: +Assuming you have all prerequisites installed, Bombadillo can be installed on your system using the following commands: ``` git clone https://tildegit.org/sloum/bombadillo.git cd bombadillo -go install +sudo make install ``` -Once you have done that you should, assuming `go install` is set up to install to a place on your path, you should be able to run the following from anywhere on your system to use Bombadillo: +Once this is done, you should be able to start Bombadillo using the following command: ``` bombadillo +``` + +#### Other installation options + +If you only want to install Bombadillo for your own user account, you could try the following in the cloned repository: + ``` +make PREFIX=~ install +``` + +You can then add `~/bin` to your PATH environment variable, and `~/share/man` to your manpath. + +The `PREFIX` option can be used to install Bombadillo to any location different to `/usr/local`. #### Troubleshooting -If you run `bombadillo` and get `bombadillo: command not found`, try running `go build` from within the cloned repo. Then try: `./bombadillo`. If that works it means that Go does not install to your path. `go build` added an executable file to the repo directory. Move that file to somewhere on your path. I suggest `/usr/local/bin` on most systems, but that may be a matter of personal preference. +If you run `bombadillo` and get `bombadillo: command not found`, try running `make` from within the cloned repository. Then try: `./bombadillo`. This means that Bombadillo is not being installed to a location in your `PATH`. + +Please feel free to [open an issue](https://tildegit.org/sloum/bombadillo/issues) if you experience any other issues with the installation. ### Downloading -If you would prefer to download a binary for your system, rather than build from source, please visit the [Bombadillo downloads](https://rawtext.club/~sloum/bombadillo.html#downloads) page. Don't see your OS/architecture? Bombadillo can be built for use with any POSIX compliant system that is supported as a target for the Go compiler (Linux, BSD, OS X, Plan 9). No testing has been done for Windows. The program will build, but will likely not work properly outside of the Linux subsystem. If you are a Windows user and would like to do some testing or get involved in development please reach out or open an issue. +If you would prefer to download a binary for your system, rather than build from source, please visit the [Bombadillo downloads](https://rawtext.club/~sloum/bombadillo.html#downloads) page. Don't see your OS/architecture? Bombadillo can be built for use with any POSIX compliant system that is supported as a target for the Go compiler (Linux, BSD, OS X, Plan 9). No testing has been done for Windows. The program will build, but will likely not work properly outside of the Linux subsystem. If you are a Windows user and would like to do some testing or get involved in development please reach out or [open an issue](https://tildegit.org/sloum/bombadillo/issues). ### Documentation From d5246a7d3ebb9066e7888907631bc69fd2580028 Mon Sep 17 00:00:00 2001 From: asdf Date: Tue, 22 Oct 2019 14:02:26 +1100 Subject: [PATCH 10/17] Corrected troubleshooting information --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2bf2897..814f10e 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ The `PREFIX` option can be used to install Bombadillo to any location different #### Troubleshooting -If you run `bombadillo` and get `bombadillo: command not found`, try running `make` from within the cloned repository. Then try: `./bombadillo`. This means that Bombadillo is not being installed to a location in your `PATH`. +If you run `bombadillo` and get `bombadillo: command not found`, try running `make` from within the cloned repository. Next, try: `./bombadillo`. If this works, it means that the installation was not completed to an area in your `PATH`. Please feel free to [open an issue](https://tildegit.org/sloum/bombadillo/issues) if you experience any other issues with the installation. From 95837e108a233f345130e965b0f39ca158f438ab Mon Sep 17 00:00:00 2001 From: asdf Date: Tue, 22 Oct 2019 14:45:39 +1100 Subject: [PATCH 11/17] Added printHelp, provide more info on -h and -v --- main.go | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 1189d77..1514243 100644 --- a/main.go +++ b/main.go @@ -112,7 +112,7 @@ func loadConfig() error { if lowerkey == "configlocation" { // The config defaults to the home folder. // 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 // of the options map. 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 + +Syntax: bombadillo [url] + bombadillo [options...] + +Example: bombadillo gopher://bombadillo.colorfield.space + bombadillo -v + +Options: +` + fmt.Fprint(os.Stdout, art) + flag.PrintDefaults() +} + func main() { - getVersion := flag.Bool("v", false, "See version number") + getVersion := flag.Bool("v", false, "Print version information and exit") + flag.Usage = printHelp flag.Parse() if *getVersion { - fmt.Printf("Bombadillo %s\n", version) + fmt.Printf("Bombadillo %s - build %s\n", version, build) os.Exit(0) } args := flag.Args() From 17b1e6eff280047e4829ee7c5fcfc35a6c666474 Mon Sep 17 00:00:00 2001 From: asdf Date: Tue, 22 Oct 2019 15:00:01 +1100 Subject: [PATCH 12/17] Unified wording, updated man page --- README.md | 2 +- bombadillo.1 | 5 +++-- main.go | 10 +++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 814f10e..f16e7b0 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/bombadillo.1 b/bombadillo.1 index 1d28a72..e01925f 100644 --- a/bombadillo.1 +++ b/bombadillo.1 @@ -5,7 +5,8 @@ .SH SYNOPSIS .nf .fam C -\fBbombadillo\fP [\fB-v\fP] [\fB-h\fP] [\fIurl\fP] +\fBbombadillo\fP [\fIurl\fP] +\fBbombadillo\fP [\fBOPTION\fP] .fam T .fi .SH DESCRIPTION @@ -14,7 +15,7 @@ .TP .B \fB-v\fP -Display the version number of \fBbombadillo\fP. +Display version information and exit. .TP .B \fB-h\fP diff --git a/main.go b/main.go index 1514243..4bd03f0 100644 --- a/main.go +++ b/main.go @@ -163,13 +163,13 @@ func handleSIGCONT(c <-chan os.Signal) { //printHelp produces a nice display message when the --help flag is used func printHelp() { - art := `Bombadillo + art := `Bombadillo - a non-web client -Syntax: bombadillo [url] - bombadillo [options...] +Syntax: bombadillo [url] + bombadillo [options...] -Example: bombadillo gopher://bombadillo.colorfield.space - bombadillo -v +Examples: bombadillo gopher://bombadillo.colorfield.space + bombadillo -v Options: ` From 1bc6e75ada094118964a5e5fdf6d536da8c5eb9f Mon Sep 17 00:00:00 2001 From: asdf Date: Tue, 22 Oct 2019 15:07:37 +1100 Subject: [PATCH 13/17] Unified wording for -v option --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 4bd03f0..6a71c13 100644 --- a/main.go +++ b/main.go @@ -178,7 +178,7 @@ Options: } func main() { - getVersion := flag.Bool("v", false, "Print version information and exit") + getVersion := flag.Bool("v", false, "Display version information and exit") flag.Usage = printHelp flag.Parse() if *getVersion { From 2b6a738d04868726abe25d72700113c4d9b9b902 Mon Sep 17 00:00:00 2001 From: asdf Date: Wed, 23 Oct 2019 13:52:47 +1100 Subject: [PATCH 14/17] Added uninstall information --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 814f10e..263f1a3 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,16 @@ If you run `bombadillo` and get `bombadillo: command not found`, try running `ma Please feel free to [open an issue](https://tildegit.org/sloum/bombadillo/issues) if you experience any other issues with the installation. +### Uninstalling + +To uninstall Bombadillo, simply run the following command from the cloned repository: + +``` +sudo make uninstall +``` + +Please note that directories created during the installation will not be removed. + ### Downloading If you would prefer to download a binary for your system, rather than build from source, please visit the [Bombadillo downloads](https://rawtext.club/~sloum/bombadillo.html#downloads) page. Don't see your OS/architecture? Bombadillo can be built for use with any POSIX compliant system that is supported as a target for the Go compiler (Linux, BSD, OS X, Plan 9). No testing has been done for Windows. The program will build, but will likely not work properly outside of the Linux subsystem. If you are a Windows user and would like to do some testing or get involved in development please reach out or [open an issue](https://tildegit.org/sloum/bombadillo/issues). From 2c6a0a85eea0ffad683574c5dabebf5691ff95f6 Mon Sep 17 00:00:00 2001 From: asdf Date: Tue, 22 Oct 2019 14:45:39 +1100 Subject: [PATCH 15/17] Added printHelp, provide more info on -h and -v --- main.go | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 1189d77..1514243 100644 --- a/main.go +++ b/main.go @@ -112,7 +112,7 @@ func loadConfig() error { if lowerkey == "configlocation" { // The config defaults to the home folder. // 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 // of the options map. 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 + +Syntax: bombadillo [url] + bombadillo [options...] + +Example: bombadillo gopher://bombadillo.colorfield.space + bombadillo -v + +Options: +` + fmt.Fprint(os.Stdout, art) + flag.PrintDefaults() +} + func main() { - getVersion := flag.Bool("v", false, "See version number") + getVersion := flag.Bool("v", false, "Print version information and exit") + flag.Usage = printHelp flag.Parse() if *getVersion { - fmt.Printf("Bombadillo %s\n", version) + fmt.Printf("Bombadillo %s - build %s\n", version, build) os.Exit(0) } args := flag.Args() From 5b1f8984b71f0ae5f8023baa4b9c56d8fed2f5f1 Mon Sep 17 00:00:00 2001 From: asdf Date: Tue, 22 Oct 2019 15:00:01 +1100 Subject: [PATCH 16/17] Unified wording, updated man page --- README.md | 2 +- bombadillo.1 | 5 +++-- main.go | 10 +++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 263f1a3..7593b85 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/bombadillo.1 b/bombadillo.1 index 1fea65a..e2a2504 100644 --- a/bombadillo.1 +++ b/bombadillo.1 @@ -4,7 +4,8 @@ .SH SYNOPSIS .nf .fam C -\fBbombadillo\fP [\fB-v\fP] [\fB-h\fP] [\fIurl\fP] +\fBbombadillo\fP [\fIurl\fP] +\fBbombadillo\fP [\fBOPTION\fP] .fam T .fi .SH DESCRIPTION @@ -13,7 +14,7 @@ .TP .B \fB-v\fP -Display the version number of \fBbombadillo\fP. +Display version information and exit. .TP .B \fB-h\fP diff --git a/main.go b/main.go index 1514243..4bd03f0 100644 --- a/main.go +++ b/main.go @@ -163,13 +163,13 @@ func handleSIGCONT(c <-chan os.Signal) { //printHelp produces a nice display message when the --help flag is used func printHelp() { - art := `Bombadillo + art := `Bombadillo - a non-web client -Syntax: bombadillo [url] - bombadillo [options...] +Syntax: bombadillo [url] + bombadillo [options...] -Example: bombadillo gopher://bombadillo.colorfield.space - bombadillo -v +Examples: bombadillo gopher://bombadillo.colorfield.space + bombadillo -v Options: ` From 3f0bf1ec41d607b401156c26f12dc9f9fbc74ae6 Mon Sep 17 00:00:00 2001 From: asdf Date: Tue, 22 Oct 2019 15:07:37 +1100 Subject: [PATCH 17/17] Unified wording for -v option --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 4bd03f0..6a71c13 100644 --- a/main.go +++ b/main.go @@ -178,7 +178,7 @@ Options: } func main() { - getVersion := flag.Bool("v", false, "Print version information and exit") + getVersion := flag.Bool("v", false, "Display version information and exit") flag.Usage = printHelp flag.Parse() if *getVersion {