diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 4f64e86..a080e79 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -10,6 +10,6 @@ jobs: uses: golangci/golangci-lint-action@v2 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. - version: v1.30 + version: v1.31 # Optional: show only new issues if it's a pull request. The default value is `false`. only-new-issues: true diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index 6e0d593..05d31be 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -23,4 +23,4 @@ jobs: version: 0.x args: release --rm-dist env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GH_REPOS }} diff --git a/.goreleaser.yml b/.goreleaser.yml index 5befe60..2d5add4 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -46,7 +46,6 @@ builds: archives: - format: binary - replacements: darwin: macOS 386: 32-bit diff --git a/CHANGELOG.md b/CHANGELOG.md index 695431d..2e07554 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added - `ansi` config setting, to disable ANSI colors in pages (#79, #86) +- Edit current URL with e (#87) ### Changed - Disabling the `color` config setting also disables ANSI colors in pages (#79, #86) diff --git a/Makefile b/Makefile index 09c159f..b9a1a5b 100644 --- a/Makefile +++ b/Makefile @@ -1,54 +1,35 @@ -GIT_EXISTS := $(shell git status > /dev/null 2>&1 ; echo $$?) +GITV != git describe --tags +GITC != git rev-parse --verify HEAD +SRC != find -type f -name '*.go' ! -name '*_test.go' +TEST != find -type f -name '*_test.go' -ifeq ($(GIT_EXISTS), 0) - ifeq ($(shell git tag --points-at HEAD),) - # Not currently on a tag - VERSION := $(shell git describe --tags | sed 's/-.*/-next/') # v1.2.3-next - else - # On a tag - VERSION := $(shell git tag --points-at HEAD) - endif +PREFIX ?= /usr/local +VERSION ?= $(GITV) +COMMIT ?= $(GITC) +BUILDER ?= Makefile - COMMIT := $(shell git rev-parse --verify HEAD) -endif +GO := go +INSTALL := install +RM := rm -INSTALL := install -o root -g 0 -INSTALL_DIR := /usr/local/bin -DESKTOP_DIR := /usr/share/applications - -.PHONY: all build install desktop clean uninstall fmt - -all: build - -build: -ifneq ($(GIT_EXISTS), 0) - # No Git repo - $(error No Git repo was found, which is needed to compile the commit and version) -endif - @echo "Downloading dependencies" - @go env -w GO111MODULE=on ; go mod download - @echo "Building binary" - @go env -w GO111MODULE=on CGO_ENABLED=0 ; go build -ldflags="-s -w -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.builtBy=Makefile" - -install: - @echo "Installing Amfora to $(INSTALL_DIR)" - @$(INSTALL) -m 755 amfora $(INSTALL_DIR) - -desktop: - @echo "Setting up desktop file" - @$(INSTALL) -m 644 amfora.desktop $(DESKTOP_DIR) - @update-desktop-database $(DESKTOP_DIR) +amfora: go.mod go.sum $(SRC) + GO111MODULE=on CGO_ENABLED=0 $(GO) build -o $@ -ldflags="-s -w -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.builtBy=$(BUILDER)" +.PHONY: clean clean: - @echo "Removing Amfora binary in local directory" - @$(RM) amfora + $(RM) -f amfora +.PHONY: install +install: amfora amfora.desktop + install -Dm 755 amfora $(PREFIX)/bin/amfora + install -Dm 644 amfora.desktop $(PREFIX)/share/applications/amfora.desktop + +.PHONY: uninstall uninstall: - @echo "Removing Amfora from $(INSTALL_DIR)" - @$(RM) $(INSTALL_DIR)/amfora - @echo "Removing desktop file" - -@$(RM) $(DESKTOP_DIR)/amfora.desktop - -@update-desktop-database $(DESKTOP_DIR) + $(RM) -f $(PREFIX)/bin/amfora + $(RM) -f $(PREFIX)/share/applications/amfora.desktop +# Development helpers +.PHONY: fmt fmt: go fmt ./... diff --git a/README.md b/README.md index 6ade436..12c265a 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Amfora aims to be the best looking [Gemini](https://gemini.circumlunar.space/) client with the most features... all in the terminal. It does not support Gopher or other non-Web protocols - check out [Bombadillo](http://bombadillo.colorfield.space/) for that. -It also aims to be completely cross platform, with full Windows support. If you're on Windows, I would not recommend using the default terminal software. Use [Windows Terminal](https://www.microsoft.com/en-us/p/windows-terminal/9n0dx20hk701) instead. Note that some of the application colors might not display correctly on Windows, but all functionality will still work. +It also aims to be completely cross platform, with full Windows support. If you're on Windows, I would not recommend using the default terminal software. Use [Windows Terminal](https://www.microsoft.com/en-us/p/windows-terminal/9n0dx20hk701) instead, and make sure it [works with UTF-8](https://akr.am/blog/posts/using-utf-8-in-the-windows-terminal). Note that some of the application colors might not display correctly on Windows, but all functionality will still work. It fully passes Sean Conman's client torture test, including the new Unicode tests. It mostly passes the Egsam test. @@ -37,6 +37,9 @@ curl -sSL https://raw.githubusercontent.com/makeworld-the-better-one/amfora/mast update-desktop-database ~/.local/share/applications ``` +Make sure to click "Watch" > "Releases only" in the top right to get notified about new releases! + + ### Arch Linux Arch Linux users can install Amfora from AUR. It has the package name `amfora`, and is maintained by @pboyd. @@ -47,9 +50,10 @@ yay -S amfora ### Homebrew -If you use [Homebrew](https://brew.sh/), you can install the package maintained by @Jackymancs4. +If you use [Homebrew](https://brew.sh/), you can install Amfora through the official tap. ``` -brew install jackymancs4/tap/amfora +brew tap makeworld-the-better-one/tap +brew install amfora ``` You can update it with: ``` @@ -59,17 +63,16 @@ brew upgrade amfora ### From Source This section is for programmers who want to install from source. Make sure you're using Go 1.13 at least, as earlier versions will fail to build. -The recommended way of installing Amfora fom source is using the Makefile. Note that this requires GNU Make, so use the `gmake` (not `make`) command on macOS. You may have to install it with `brew install make`. On Windows, you can install [Chocolatey](https://chocolatey.org/install) and run `choco install make`. +The recommended way of installing Amfora fom source is using the Makefile. -Note that the Makefile currently assumes that git is available, and that it is inside a git repository. +On Windows, you need install make, which can be done with [Chocolatey](https://chocolatey.org/install): `choco install make`. Please note the Makefile does not intend to support Windows, and so there may be issues. ```shell git clone https://github.com/makeworld-the-better-one/amfora cd amfora # git checkout v1.2.3 # Optionally pin to a specific version instead of the latest commit make -sudo make install # Not for Windows! -sudo make desktop # Optional, installs .desktop file. Not for Windows or macOS +sudo make install # If you want to install the binary for all users ``` Because you installed with the Makefile, running `amfora -v` will tell you exactly what commit the binary was built from. diff --git a/display/display.go b/display/display.go index 6a4a508..0f08676 100644 --- a/display/display.go +++ b/display/display.go @@ -295,6 +295,12 @@ func Init() { // Don't save bottom bar, so that whenever you switch tabs, it's not in that mode App.SetFocus(bottomBar) return nil + case "e": + // Letter e allows to edit current URL + bottomBar.SetLabel("[::b]Edit URL: [::-]") + bottomBar.SetText(tabs[curTab].page.URL) + App.SetFocus(bottomBar) + return nil case "R": Reload() return nil diff --git a/display/help.go b/display/help.go index 35010b9..1391a07 100644 --- a/display/help.go +++ b/display/help.go @@ -25,6 +25,7 @@ spacebar|Open bar at the bottom - type a URL, link number, search term. |Typing new:N will open link number N in a new tab |instead of the current one. Numbers|Go to links 1-10 respectively. +e|Edit current URL Enter, Tab|On a page this will start link highlighting. |Press Tab and Shift-Tab to pick different links. |Press Enter again to go to one, or Esc to stop.