-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make 'sh:' directives a bit more usable (#17)
* Use %pistol-filename% and shellescape for sh: * Somewhat standardize release procedure * Add tests and make it surely work * README: mention debugging
- Loading branch information
1 parent
4c80cb6
commit 862350d
Showing
11 changed files
with
200 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,47 @@ | ||
pistol: | ||
go build ./cmd/pistol | ||
all: pistol | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, version 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
NAME := pistol | ||
VERSION := v0.1 (2020-04-17) (breaking release, see README) | ||
version := $(word 1, $(VERSION)) | ||
|
||
build: | ||
go build -ldflags "-X 'main.VERSION=$(VERSION)'" ./cmd/pistol | ||
|
||
install: | ||
go install ./cmd/pistol | ||
go install -ldflags "-X 'main.VERSION=$(VERSION)'" ./cmd/pistol | ||
|
||
# requires: bat (https://github.com/sharkdp/bat), elinks | ||
test: pistol | ||
@echo ------------------- | ||
@echo fpath | ||
@echo ------------------- | ||
@./pistol --config tests/config tests/fpath-no-sh | ||
@tput sgr0 | ||
@echo ------------------- | ||
@echo fpath + sh: | ||
@echo ------------------- | ||
@./pistol --config tests/config tests/fpath-with-sh | ||
@tput sgr0 | ||
@echo ------------------- | ||
@echo mimetype | ||
@echo ------------------- | ||
@./pistol --config tests/config tests/mimetype-no-sh | ||
@tput sgr0 | ||
@echo ------------------- | ||
@echo mimetype + sh: | ||
@echo ------------------- | ||
@./pistol --config tests/config tests/mimetype-with-sh | ||
|
||
deps: | ||
go get github.com/c4milo/github-release | ||
go get github.com/mitchellh/gox | ||
|
||
changelog: | ||
@latest_tag=$$(git describe --tags `git rev-list --tags --max-count=1`); \ | ||
comparison="$$latest_tag..HEAD"; \ | ||
if [ -z "$$latest_tag" ]; then comparison=""; fi; \ | ||
git --no-pager log $$comparison --oneline --no-merges | ||
|
||
.PHONY: pistol | ||
.PHONY: build install changelog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# detects: fpath, sh: no | ||
fpath .*/tests/fpath-no-sh$ bat --map-syntax :Markdown --paging=never --style=numbers --color=always %pistol-filename% | ||
# detects: fpath, sh: yes | ||
fpath .*/tests/fpath-with-sh$ sh: bat --map-syntax :Markdown --paging=never --style=numbers --color=always %pistol-filename% | head -2 | ||
# detects: mimetype, sh: no | ||
text/html elinks -dump -dump-color-mode 1 %pistol-filename% | ||
# detects: mimetype, sh: yes | ||
text/plain sh: bat --map-syntax :Markdown --paging=never --style=numbers --color=always %pistol-filename% | head -1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fpath detected, shell is not used |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
fpath detected - line numbers should appear, | ||
Shell is used - There should be more text after this | ||
|
||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vehicula eros a | ||
orci eleifend, aliquet venenatis arcu volutpat. Donec eget volutpat tellus. | ||
Duis vestibulum lobortis tortor, eget euismod justo semper sed. Mauris id | ||
imperdiet diam, et sodales odio. Vestibulum placerat mi ante, pretium maximus | ||
tellus lobortis sit amet. Fusce in magna at erat auctor interdum. Vivamus id mi | ||
malesuada, luctus magna at, dignissim turpis. Sed finibus volutpat felis, eget | ||
lacinia mi. Nam accumsan congue ante sed venenatis. Duis imperdiet vestibulum | ||
massa, id dignissim metus sollicitudin ac. Suspendisse tincidunt a dolor non | ||
hendrerit. Phasellus non velit nulla. Orci varius natoque penatibus et magnis | ||
dis parturient montes, nascetur ridiculus mus. Suspendisse vulputate eleifend | ||
pellentesque. Aenean feugiat ullamcorper scelerisque. |
Oops, something went wrong.