Merge branch 'master' into add-readme-comment

This commit is contained in:
lestrrat 2019-10-23 15:40:54 +09:00 committed by GitHub
commit 0a08098528
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 53 additions and 77 deletions

View file

@ -7,9 +7,6 @@ cache:
directories:
- vendor
- _internal_bin/$(go version | awk '{ print $NF }')
install:
- make glidecc
- make installdeps
script:
- make test
- make all

View file

@ -8,7 +8,6 @@ VERSION=$(patsubst "%",%,$(lastword $(shell grep 'const version' peco.go)))
RELEASE_DIR=releases
ARTIFACTS_DIR=$(RELEASE_DIR)/artifacts/$(VERSION)
SRC_FILES = $(wildcard *.go cmd/peco/*.go internal/*/*.go)
HAVE_GLIDE:=$(shell test -e $(INTERNAL_BIN_DIR)/$(THIS_GOOS)/$(THIS_GOARCH)/glide && echo "yes")
GITHUB_USERNAME=peco
BUILD_TARGETS= \
build-linux-arm64 \
@ -37,24 +36,9 @@ $(INTERNAL_BIN_DIR):
@echo "Creating $(INTERNAL_BIN_DIR)"
@mkdir -p $(INTERNAL_BIN_DIR)
$(INTERNAL_BIN_DIR)/$(THIS_GOOS)/$(THIS_GOARCH)/glide: $(INTERNAL_BIN_DIR)
ifeq ($(HAVE_GLIDE),)
@echo "Installing glide for $(THIS_GOOS)/$(THIS_GOARCH)..."
@mkdir -p $(INTERNAL_BIN_DIR)/$(THIS_GOOS)/$(THIS_GOARCH)
@wget -q -O - https://github.com/Masterminds/glide/releases/download/v0.12.3/glide-v0.12.3-$(THIS_GOOS)-$(THIS_GOARCH).tar.gz | tar xvz
@mv $(THIS_GOOS)-$(THIS_GOARCH)/glide $(INTERNAL_BIN_DIR)/$(THIS_GOOS)/$(THIS_GOARCH)/glide
@rm -rf $(THIS_GOOS)-$(THIS_GOARCH)
endif
glide: $(INTERNAL_BIN_DIR)/$(THIS_GOOS)/$(THIS_GOARCH)/glide
glidecc: glide
@echo "Clearing glide cache..."
@$(INTERNAL_BIN_DIR)/$(THIS_GOOS)/$(THIS_GOARCH)/glide cc
installdeps: glide $(SRC_FILES)
@echo "Installing dependencies..."
@$(INTERNAL_BIN_DIR)/$(THIS_GOOS)/$(THIS_GOARCH)/glide install
deps:
@echo "Downloading dependencies..."
@GO111MODULE=on go mod download
build-windows-amd64:
@$(MAKE) build GOOS=windows GOARCH=amd64 SUFFIX=.exe
@ -80,8 +64,8 @@ build-darwin-amd64:
build-darwin-386:
@$(MAKE) build GOOS=darwin GOARCH=386
$(RELEASE_DIR)/peco_$(GOOS)_$(GOARCH)/peco$(SUFFIX): installdeps
go build -o $(RELEASE_DIR)/peco_$(GOOS)_$(GOARCH)/peco$(SUFFIX) cmd/peco/peco.go
$(RELEASE_DIR)/peco_$(GOOS)_$(GOARCH)/peco$(SUFFIX): deps
@GO111MODULE=on go build -o $(RELEASE_DIR)/peco_$(GOOS)_$(GOARCH)/peco$(SUFFIX) cmd/peco/peco.go
all: $(BUILD_TARGETS)
@ -142,9 +126,9 @@ release-github-token: github_token
release-upload: release release-github-token
ghr -u $(GITHUB_USERNAME) -t $(shell cat github_token) --draft --replace $(VERSION) $(ARTIFACTS_DIR)
test: installdeps
test: deps
@echo "Running tests..."
@PATH=$(INTERNAL_BIN_DIR)/$(GOOS)/$(GOARCH):$(PATH) go test -v $(shell $(INTERNAL_BIN_DIR)/$(THIS_GOOS)/$(THIS_GOARCH)/glide nv)
@GO111MODULE=on PATH=$(INTERNAL_BIN_DIR)/$(GOOS)/$(GOARCH):$(PATH) go test -v ./...
clean:
-rm -rf $(RELEASE_DIR)/*/*

View file

@ -62,7 +62,7 @@ Different types of filters are available. Default is case-insensitive filter, so
The SmartCase filter uses case-*insensitive* matching when all of the queries are lower case, and case-*sensitive* matching otherwise.
The Regexp filter allows you to use any valid regular expression to match lines
The Regexp filter allows you to use any valid regular expression to match lines.
The Fuzzy filter allows you to find matches using partial patterns. For example, when searching for `ALongString`, you can enable the Fuzzy filter and search `ALS` to find it. The Fuzzy filter uses smart case search like the SmartCase filter.
@ -88,7 +88,7 @@ Go to the [releases page](https://github.com/peco/peco/releases), find the versi
_THIS IS THE RECOMMENDED WAY_ (except for OS X homebrew users)
### Mac OS X / Homebrew
### Mac OS X (Homebrew, Scarf)
If you're on OS X and want to use homebrew:
@ -96,6 +96,26 @@ If you're on OS X and want to use homebrew:
brew install peco
```
or with Scarf:
```
scarf install peco
```
### Debian / Ubuntu (APT, Scarf)
To install with apt:
```
apt install peco
```
or with Scarf:
```
scarf install peco
```
### Windows (Chocolatey NuGet Users)
There's a third-party [peco package available](https://chocolatey.org/packages/peco) for Chocolatey NuGet.
@ -107,7 +127,7 @@ C:\> choco install peco
### Building peco yourself
Make sure to clone the source code under $GOPATH (i.e. $GOPATH/src/github.com/peco/peco). This is required
as the main binary refers to an internal package, which requires that the the source code be located in
as the main binary refers to an internal package, which requires that the source code be located in
the correct package location.
Navigate to the directory above, then run:
@ -159,7 +179,7 @@ Specifies the default query to be used upon startup. This is useful for scripts
### --print-query
When exiting, prints out the query typed by the user as the first line of output. The query will be printed even if there are no matches, if the program is terminated normally (i.e. enter key). On the other hand, the query will NOT be printed if the user exits via a cancel (i.e. esc key)
When exiting, prints out the query typed by the user as the first line of output. The query will be printed even if there are no matches, if the program is terminated normally (i.e. enter key). On the other hand, the query will NOT be printed if the user exits via a cancel (i.e. esc key).
### --rcfile <filename>
@ -179,7 +199,7 @@ Changes how peco interprets incoming data. When this flag is set, you may insert
### --initial-index
Specifies the initial line position upon start up. E.g. If you want to start out with the second line selected, set it to "1" (because the index is 0 based)
Specifies the initial line position upon start up. E.g. If you want to start out with the second line selected, set it to "1" (because the index is 0 based).
### --initial-filter `IgnoreCase|CaseSensitive|SmartCase|Regexp|Fuzzy`
@ -187,7 +207,7 @@ Specifies the initial filter to use upon start up. You should specify the name o
### --prompt
Specifies the query line's prompt string. When specified, takes precedence over the configuration file's `Prompt` section. The default value is `QUERY>`
Specifies the query line's prompt string. When specified, takes precedence over the configuration file's `Prompt` section. The default value is `QUERY>`.
### --layout `top-down|bottom-up`
@ -208,7 +228,7 @@ For historical and back-compatibility reasons, the default is `success`, meaning
### --selection-prefix `string`
When specified, peco uses the specified prefix instead of changing line color to indicate currently selected line(s). default is to use colors. This option is experimental
When specified, peco uses the specified prefix instead of changing line color to indicate currently selected line(s). default is to use colors. This option is experimental.
### --exec `string`
@ -225,7 +245,7 @@ peco by default consults a few locations for the config files.
1. Location specified in --rcfile. If this doesn't exist, peco complains and exits
2. $XDG\_CONFIG\_HOME/peco/config.json
3. $HOME/.config/peco/config.json
4. for each directories listed in $XDG\_CONFIG\_DIRS, $DIR/peco/config.json
4. for each directory listed in $XDG\_CONFIG\_DIRS, $DIR/peco/config.json
5. If all else fails, $HOME/.peco/config.json
Below are configuration sections that you may specify in your config file:
@ -271,7 +291,7 @@ StickySelection allows selections to persist even between changes to the query.
For example, when you set this to true you can select a few lines, type in a
new query, select those lines, and then delete the query. The result is all
the lines that you selected before and after the modification to the query are
left in tact.
left intact.
Default value for StickySelection is false.
@ -539,7 +559,7 @@ This is an experimental feature. Please note that some details of this specifica
By default `peco` comes with `IgnoreCase`, `CaseSensitive`, `SmartCase`, `Regexp` and `Fuzzy` filters, but since v0.1.3, it is possible to create your own custom filter.
The filter will be executed via `Command.Run()` as an external process, and it will be passed the query values in the command line, and the original unaltered buffer is passed via `os.Stdin`. Your filter must perform the matching, and print out to `os.Stdout` matched lines. You filter MAY be called multiple times if the buffer
The filter will be executed via `Command.Run()` as an external process, and it will be passed the query values in the command line, and the original unaltered buffer is passed via `os.Stdin`. Your filter must perform the matching, and print out to `os.Stdout` matched lines. Your filter MAY be called multiple times if the buffer
given to peco is big enough. See `BufferThreshold` below.
Note that currently there is no way for the custom filter to specify where in the line the match occurred, so matched portions in the string WILL NOT BE HIGHLIGHTED.

View file

@ -337,7 +337,7 @@ func doFinish(ctx context.Context, state *Peco, _ termbox.Event) {
cmd.Stdin = &stdin
cmd.Stdout = state.Stdout
cmd.Stderr = state.Stderr
// Setup some enviroment variables. Start with a copy of the current
// Setup some environment variables. Start with a copy of the current
// environment...
env := os.Environ()

28
glide.lock generated
View file

@ -1,28 +0,0 @@
hash: 8051e8fdb2c2665e5b7564124f001405d135b883f8f3872abe25b8f9e53637cf
updated: 2018-10-25T15:59:43.595741+09:00
imports:
- name: github.com/davecgh/go-spew
version: d8f796af33cc11cb798c1aaeb27a4ebc5099927d
subpackages:
- spew
- name: github.com/google/btree
version: 4030bb1f1f0c35b30ca7009e9ebd06849dd45306
- name: github.com/jessevdk/go-flags
version: 9c49a3351d49777ccd40148b5cdf6f2998f51087
- name: github.com/lestrrat-go/pdebug
version: 39f9a71bcabe9432cbdfe4d3d33f41988acd2ce6
- name: github.com/mattn/go-runewidth
version: b20a3daf6a39840c202fd42cc23d53607162b045
- name: github.com/nsf/termbox-go
version: b66b20ab708e289ff1eb3e218478302e6aec28ce
- name: github.com/pkg/errors
version: 059132a15dd08d6704c67711dae0cf35ab991756
testImports:
- name: github.com/pmezard/go-difflib
version: 792786c7400a136282c1664665ae0a8db921c6c2
subpackages:
- difflib
- name: github.com/stretchr/testify
version: 04af85275a5c7ac09d16bb3b9b2e751ed45154e5
subpackages:
- assert

View file

@ -1,12 +0,0 @@
package: github.com/peco/peco
import:
- package: github.com/google/btree
- package: github.com/jessevdk/go-flags
- package: github.com/lestrrat-go/pdebug
- package: github.com/mattn/go-runewidth
- package: github.com/nsf/termbox-go
- package: github.com/pkg/errors
testImport:
- package: github.com/stretchr/testify
subpackages:
- assert

15
go.mod Normal file
View file

@ -0,0 +1,15 @@
module github.com/peco/peco
go 1.12
require (
github.com/davecgh/go-spew v1.1.0 // indirect
github.com/google/btree v0.0.0-20161213163243-0c3044bc8bad
github.com/jessevdk/go-flags v1.1.0
github.com/lestrrat-go/pdebug v0.0.0-20180220043849-39f9a71bcabe
github.com/mattn/go-runewidth v0.0.0-20161012013512-737072b4e32b
github.com/nsf/termbox-go v0.0.0-20180303152453-e2050e41c884
github.com/pkg/errors v0.0.0-20161029093637-248dadf4e906
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/testify v0.0.0-20161117074351-18a02ba4a312
)