diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ffd6b8e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +# NB: this image isn't used anywhere in the build pipeline. It exists to +# conveniently facilitate ad-hoc experimentation in a sandboxed environment +# during development. +FROM golang:1.15-alpine + +RUN apk add git less make + +WORKDIR /app diff --git a/Makefile b/Makefile index ae279ad..78c0cc9 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ dist_dir := ./dist CAT := cat COLUMN := column CTAGS := ctags +DOCKER := docker GO := go GREP := grep GZIP := gzip --best @@ -20,6 +21,8 @@ SED := sed SORT := sort ZIP := zip -m +docker_image := cheat-devel:latest + # build flags BUILD_FLAGS := -ldflags="-s -w" -mod vendor -trimpath GOBIN := @@ -105,6 +108,7 @@ clean: $(dist_dir) .PHONY: distclean distclean: $(RM) -f tags + @$(DOCKER) image rm -f $(docker_image) ## setup: install revive (linter) and scc (sloc tool) .PHONY: setup @@ -165,6 +169,16 @@ check: | vendor fmt lint vet test .PHONY: prepare prepare: | $(dist_dir) clean generate vendor fmt lint vet test +## docker-setup: create a docker image for use during development +.PHONY: docker-setup +docker-setup: + $(DOCKER) build -t $(docker_image) -f Dockerfile . + +## docker-sh: shell into the docker development container +.PHONY: docker-sh +docker-sh: + $(DOCKER) run -v $(shell pwd):/app -ti $(docker_image) /bin/ash + ## help: display this help text .PHONY: help help: diff --git a/README.md b/README.md index 3c399aa..7aaa58b 100644 --- a/README.md +++ b/README.md @@ -47,17 +47,17 @@ Installing `cheat` has no dependencies. To install it, download the executable from the [releases][] page and place it on your `PATH`. +Alternatively, if you have [go][] installed, you may install `cheat` using `go +get`: + +```sh +go get -u github.com/cheat/cheat/cmd/cheat +``` Configuring ----------- ### conf.yml ### `cheat` is configured by a YAML file that will be auto-generated on first run. -Should you need to create a config file manually, you can do -so via: - -```sh -mkdir -p ~/.config/cheat && cheat --init > ~/.config/cheat/conf.yml -``` By default, the config file is assumed to exist on an XDG-compliant configuration path like `~/.config/cheat/conf.yml`. If you would like to store @@ -211,3 +211,4 @@ Additionally, `cheat` supports enhanced autocompletion via integration with [cheatsheets]: https://github.com/cheat/cheatsheets [completions]: https://github.com/cheat/cheat/tree/master/scripts [fzf]: https://github.com/junegunn/fzf +[go]: https://golang.org