mirror of
https://github.com/vbatts/go-mtree.git
synced 2024-11-25 17:45:39 +00:00
*: WIP adding man page
Clean up Makefile for the tools to be pulled in as needed by jobs like building man pages (or linting, etc.) Building docs in the default step. But installing the man page is currently an exercise for the reader. Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
48e5e86700
commit
626d2f2040
3 changed files with 51 additions and 26 deletions
3
.github/workflows/validation.yml
vendored
3
.github/workflows/validation.yml
vendored
|
@ -21,8 +21,5 @@ jobs:
|
||||||
with:
|
with:
|
||||||
go-version: ${{ matrix.go }}
|
go-version: ${{ matrix.go }}
|
||||||
|
|
||||||
- name: Install tools
|
|
||||||
run: make install.tools
|
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: make lint
|
run: make lint
|
||||||
|
|
46
Makefile
46
Makefile
|
@ -6,32 +6,22 @@ SOURCE_FILES := $(shell find . -type f -name "*.go")
|
||||||
CLEAN_FILES := *~
|
CLEAN_FILES := *~
|
||||||
TAGS :=
|
TAGS :=
|
||||||
ARCHES := linux,386 linux,amd64 linux,arm linux,arm64 linux,mips64 linux,riscv64 openbsd,amd64 windows,amd64 windows,arm64 darwin,amd64 darwin,arm64
|
ARCHES := linux,386 linux,amd64 linux,arm linux,arm64 linux,mips64 linux,riscv64 openbsd,amd64 windows,amd64 windows,arm64 darwin,amd64 darwin,arm64
|
||||||
GO_VER := go1.14
|
|
||||||
|
|
||||||
default: build validation
|
default: build validation lint docs
|
||||||
|
|
||||||
.PHONY: validation
|
.PHONY: validation
|
||||||
validation: .test .vet .cli.test
|
validation: .test .vet .cli.test
|
||||||
|
|
||||||
.PHONY: validation.tags
|
.PHONY: validation.tags
|
||||||
validation.tags: .test.tags .vet.tags .cli.test .staticcheck
|
validation.tags: .test.tags .vet.tags .cli.test
|
||||||
|
|
||||||
.PHONY: gocyclo
|
.PHONY: gocyclo
|
||||||
gocyclo: .gocyclo
|
gocyclo: .gocyclo
|
||||||
|
|
||||||
CLEAN_FILES += .gocyclo
|
CLEAN_FILES += .gocyclo
|
||||||
|
.gocyclo: .gocyclo.tool
|
||||||
.gocyclo:
|
|
||||||
gocyclo -avg -over 15 -ignore 'vendor/*' . && touch $@
|
gocyclo -avg -over 15 -ignore 'vendor/*' . && touch $@
|
||||||
|
|
||||||
.PHONY: staticcheck
|
|
||||||
staticcheck: .staticcheck
|
|
||||||
|
|
||||||
CLEAN_FILES += .staticcheck
|
|
||||||
|
|
||||||
.staticcheck:
|
|
||||||
staticcheck . && touch $@
|
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: .test
|
test: .test
|
||||||
|
|
||||||
|
@ -48,15 +38,13 @@ NO_VENDOR_DIR := $(shell find . -type f -name '*.go' ! -path './vendor*' ! -path
|
||||||
lint: .lint
|
lint: .lint
|
||||||
|
|
||||||
CLEAN_FILES += .lint
|
CLEAN_FILES += .lint
|
||||||
|
.lint: .golangci-lint.tool $(SOURCE_FILES)
|
||||||
.lint: $(SOURCE_FILES)
|
|
||||||
set -e ; golangci-lint run && touch $@
|
set -e ; golangci-lint run && touch $@
|
||||||
|
|
||||||
.PHONY: vet
|
.PHONY: vet
|
||||||
vet: .vet .vet.tags
|
vet: .vet .vet.tags
|
||||||
|
|
||||||
CLEAN_FILES += .vet .vet.tags
|
CLEAN_FILES += .vet .vet.tags
|
||||||
|
|
||||||
.vet: $(SOURCE_FILES)
|
.vet: $(SOURCE_FILES)
|
||||||
go vet $(NO_VENDOR_DIR) && touch $@
|
go vet $(NO_VENDOR_DIR) && touch $@
|
||||||
|
|
||||||
|
@ -67,30 +55,42 @@ CLEAN_FILES += .vet .vet.tags
|
||||||
cli.test: .cli.test
|
cli.test: .cli.test
|
||||||
|
|
||||||
CLEAN_FILES += .cli.test .cli.test.tags
|
CLEAN_FILES += .cli.test .cli.test.tags
|
||||||
|
|
||||||
.cli.test: $(BUILD) $(wildcard ./test/cli/*.sh)
|
.cli.test: $(BUILD) $(wildcard ./test/cli/*.sh)
|
||||||
@go run ./test/cli-test/main.go ./test/cli/*.sh && touch $@
|
@go run ./test/cli-test/main.go ./test/cli/*.sh && touch $@
|
||||||
|
|
||||||
.cli.test.tags: $(BUILD) $(wildcard ./test/cli/*.sh)
|
.cli.test.tags: $(BUILD) $(wildcard ./test/cli/*.sh)
|
||||||
@set -e ; for tag in $(TAGS) ; do go run -tags $$tag ./test/cli-test/main.go ./test/cli/*.sh ; done && touch $@
|
@set -e ; for tag in $(TAGS) ; do go run -tags $$tag ./test/cli-test/main.go ./test/cli/*.sh ; done && touch $@
|
||||||
|
|
||||||
|
docs: gomtree.1
|
||||||
|
|
||||||
|
CLEAN_FILES += gomtree.1
|
||||||
|
%.1: %.1.md .go-md2man.tool
|
||||||
|
go-md2man -in $< -out $@
|
||||||
|
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
build: $(BUILD)
|
build: $(BUILD)
|
||||||
|
|
||||||
$(BUILD): $(SOURCE_FILES)
|
$(BUILD): $(SOURCE_FILES)
|
||||||
go build -ldflags="-X 'main.Version=$(shell git describe --always --dirty)'" -mod=vendor -o $(BUILD) $(BUILDPATH)
|
go build -ldflags="-X 'main.Version=$(shell git describe --always --dirty)'" -mod=vendor -o $(BUILD) $(BUILDPATH)
|
||||||
|
|
||||||
install.tools:
|
TOOLS += .gocyclo.tool
|
||||||
@go install github.com/fatih/color@latest ; \
|
.gocyclo.tool:
|
||||||
go install github.com/fzipp/gocyclo/cmd/gocyclo@latest ; \
|
go install github.com/fzipp/gocyclo/cmd/gocyclo@latest && touch $@
|
||||||
go install honnef.co/go/tools/cmd/staticcheck@latest ; \
|
|
||||||
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
TOOLS += .go-md2man.tool
|
||||||
|
.go-md2man.tool:
|
||||||
|
go install github.com/cpuguy83/go-md2man@latest && touch $@
|
||||||
|
|
||||||
|
TOOLS += .golangci-lint.tool
|
||||||
|
.golangci-lint.tool:
|
||||||
|
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest && touch $@
|
||||||
|
|
||||||
|
install.tools: $(TOOLS)
|
||||||
|
|
||||||
./bin:
|
./bin:
|
||||||
mkdir -p $@
|
mkdir -p $@
|
||||||
|
|
||||||
CLEAN_FILES += bin
|
CLEAN_FILES += bin
|
||||||
|
|
||||||
build.arches: ./bin
|
build.arches: ./bin
|
||||||
@set -e ;\
|
@set -e ;\
|
||||||
for pair in $(ARCHES); do \
|
for pair in $(ARCHES); do \
|
||||||
|
|
28
gomtree.1.md
Normal file
28
gomtree.1.md
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
gomtree 1 "March 2016" gomtree "User Manual"
|
||||||
|
==================================================
|
||||||
|
|
||||||
|
# NAME
|
||||||
|
gomtree - filesystem hierarcy validation tooling and format
|
||||||
|
|
||||||
|
# SYNOPSIS
|
||||||
|
**gomtree** [**-in**=*/path/to/md/file*] [**-out**=*/path/to/output*]
|
||||||
|
|
||||||
|
# DESCRIPTION
|
||||||
|
**go-md2man** converts standard markdown formatted documents into manpages. It is
|
||||||
|
written purely in Go so as to reduce dependencies on 3rd party libs.
|
||||||
|
|
||||||
|
By default, the input is stdin and the output is stdout.
|
||||||
|
|
||||||
|
# EXAMPLES
|
||||||
|
Convert the markdown file *go-md2man.1.md* into a manpage:
|
||||||
|
```
|
||||||
|
go-md2man < go-md2man.1.md > go-md2man.1
|
||||||
|
```
|
||||||
|
|
||||||
|
Same, but using command line arguments instead of shell redirection:
|
||||||
|
```
|
||||||
|
go-md2man -in=go-md2man.1.md -out=go-md2man.1
|
||||||
|
```
|
||||||
|
|
||||||
|
# HISTORY
|
||||||
|
March 2016, Originally authored by Vincent Batts (vbatts@hashbangbash.com).
|
Loading…
Reference in a new issue