Git Product home page Git Product logo

files's Introduction

files

Find files

Usage

$ files

Requirements

golang

Installation

go get github.com/mattn/files

Tips

ctrlp.vim

let g:ctrlp_user_command = 'files -a %s'

License

MIT

Author

Yasuhiro Matsumoto (a.k.a mattn)

files's People

Contributors

ichizok avatar mattn avatar nabetama avatar pocari avatar ur4ltz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

files's Issues

対象ディレクトリがシンボリックリンクだとエラー

$ files path/to/symbolic-link-dir
panic: runtime error: slice bounds out of range

goroutine 1 [running]:
main.func·006(0xc20801e100, 0x1d)
        /home/thinca/.go/src/github.com/mattn/files/files.go:194 +0x119
main.main()
        /home/thinca/.go/src/github.com/mattn/files/files.go:209 +0x933

仕様かもしれませんが報告しておきます。

不必要な関数っぽい

files.goで
これらがmain()で使われてないので、消したほうがいいのでは......

var printLine = fmt.Println

var printPath = func(path string) {
    p, err := filepath.Abs(path)
    if err == nil {
        path = p
    }
    printLine(path)
}

大量のファイルがあるディレクトリで Asynchronized find すると結果がおかしい?

大量のファイルがあるディレクトリで Asynchronized find オプションをつけて実行したところ、結果を wc -l した数値が実行するたびに違いました。

$ files -a ./ | wc -l
  301490

$ files -a ./ | wc -l
  301490

$ files -a ./ | wc -l
  301490
$ files -a -A ./ | wc -l
  266893

$ files -a -A ./ | wc -l
  264223

$ files -a -A ./ | wc -l
  255086

まだこれだけの情報しかないですが報告します。
数万ファイル程度では何度 -A 付きで実行しても上記のようなズレが発生することはなかったです。

macOS 10.12.1

$ file `which files`
/Users/hirofumiwakasugi/.go/bin/files: Mach-O 64-bit executable x86_64

$  go version
go version go1.7.3 darwin/amd64

CtrlPで使用した時にountが大量発生

適当にstderrをnulにリダイレクトするbatをでっち上げて、それを経由すると以下は発生しなかったので
間違いなくfilesではなくCtrlPかVim側だと思うのですがどちらか分からなかったので

" ファイル数が1000を超える適当なフォルダで
:let g:ctrlp_user_command = 'files -a -A -M 1000 %s'
:CtrlPClearCache
:CtrlP

ountって行がcacheの末尾付近にいっぱい
(stderrに出力されてるOverflow max count?)

Windows10(x64)
Vim 7.4.1944+kaoriya(x64)
go 1.6.2 windows/amd64

The default for `-i` seems to be wrong?

-i が,おそらく与えられた表現にマッチしたところでその下を掘るのをやめる,のではなく,ファイルのパス全体についてマッチすればスキップするような挙動になっているように見えます.その結果,-i に渡されるデフォルトのオプションが間違っているような気がします.普段は -H が効いているので無視できているように見えるが,実際には files -i "^\\.git"$ では ./.git/HEAD などは無視されません.環境は Linux (Manjaro 20.0.3) で,files は最新版です.

こういう状況で

~/tmp $ git init foo
Initialized empty Git repository in ~/tmp/foo/.git/

~/tmp $ cd foo/
~/tmp/foo $ touch .hg
~/tmp/foo $ mkdir .git_janai
~/tmp/foo $ touch .git_janai/something.txt
~/tmp/foo $ touch README

~/tmp/foo $ ls -al
total 16
drwxr-xr-x 4 user user 4096 Aug  2 19:30 .
drwxr-xr-x 3 user user 4096 Aug  2 19:29 ..
drwxr-xr-x 7 user user 4096 Aug  2 19:29 .git
drwxr-xr-x 2 user user 4096 Aug  2 19:30 .git_janai
-rw-r--r-- 1 user user    0 Aug  2 19:30 .hg
-rw-r--r-- 1 user user    0 Aug  2 19:30 README

このような挙動になります

~/tmp/foo $ files .
README

~/tmp/foo $ files -H=false # .git/ 下のファイルが入る.(あと .hg はファイルだが入らない:こちらは想定内).
README
.git_janai/something.txt
.git/HEAD
.git/config
.git/description
.git/hooks/commit-msg.sample
[省略...]

試してみたところ,v0.0.4 以降でこのような挙動になっているようです.

~/tmp/foo $ ~/src/files_mattn/main -H=false -i  "^(\\.git|\\.hg|\\.svn|_darcs|\\.bzr)$" . # v0.0.3
.git_janai/something.txt
README

状況の把握に

現在のバージョンでも,手元では例えばこうするとそれらしい挙動になりはします

~/tmp/foo $ files -H=false  -i "^(\\.git|\\.hg)/" 
.hg
README
.git_janai/something.txt

状況の把握に自信がないのですがとりあえずご報告させてください.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.