Resolves conflict in defaults.go with upstream branch

This commit is contained in:
sloumdrone 2019-10-23 19:00:12 -07:00
commit 224b595a6f
8 changed files with 112 additions and 239 deletions

45
Makefile Normal file
View File

@ -0,0 +1,45 @@
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
# %: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}
endif
LDFLAGS := -ldflags "-s -X main.version=${VERSION} -X main.build=${BUILD_TIME}"
.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 ${DESTDIR}${MANPREFIX}/man1
install -m 0644 ./bombadillo.1.gz ${DESTDIR}${MANPREFIX}/man1
.PHONY: install-bin
install-bin: build
install -d ${DESTDIR}${PREFIX}/bin
install -m 0755 ./${BINARY} ${DESTDIR}${PREFIX}/bin/${BINARY}
.PHONY: clean
clean:
go clean
rm -f ./bombadillo.1.gz 2> /dev/null
.PHONY: uninstall
uninstall: clean
rm -f ${DESTDIR}${MANPREFIX}/man1/bombadillo.1.gz
rm -f ${DESTDIR}${PREFIX}/bin/${BINARY}

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.
@ -9,33 +9,57 @@ 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. 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.
### 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.
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

1
VERSION Normal file
View File

@ -0,0 +1 @@
v2.0.0

View File

@ -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

View File

@ -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

View File

@ -12,7 +12,12 @@ 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",
//
// 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",

31
main.go
View File

@ -33,10 +33,11 @@ import (
"tildegit.org/sloum/mailcap"
)
const version = "2.0.0"
var version string
var build 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
@ -111,8 +112,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
@ -161,11 +163,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() {
getVersion := flag.Bool("v", false, "See version number")
getVersion := flag.Bool("v", false, "Display version information and exit")
flag.Usage = printHelp
flag.Parse()
if *getVersion {
fmt.Printf("Bombadillo v%s\n", version)
fmt.Printf("Bombadillo %s - build %s\n", version, build)
os.Exit(0)
}
args := flag.Args()

View File

@ -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