Giter Club home page Giter Club logo

ptags's Introduction

ptags

A parallel universal-ctags wrapper for git repository

Actions Status Crates.io codecov

Description

ptags is a universal-ctags wrapper to have the following features.

  • Search git tracked files only ( .gitignore support )
  • Call ctags command in parallel for acceleration
    • Up to x5 faster than universal-ctags

Install

Download binary

Download from release page, and extract to the directory in PATH.

Arch Linux

You can install from AUR.

If you use yay, you can install like below:

yay -S ptags       // latest tagged version
yay -S ptags-git   // current master of git repo

Cargo

You can install by cargo.

cargo install ptags

Requirement

ptags uses ctags and git command internally. The tested version is below.

Command Version
ctags Universal Ctags 0.0.0(f9e6e3c1) / Exuberant Ctags 5.8
git git version 2.14.2
git-lfs git-lfs/2.3.3

Usage

ptags 0.1.12-pre
[email protected]
A parallel universal-ctags wrapper for git repository

USAGE:
    ptags [FLAGS] [OPTIONS] [--] [DIR]

FLAGS:
        --config               Generate configuration sample file
        --exclude-lfs          Exclude git-lfs tracked files
    -h, --help                 Prints help information
        --include-ignored      Include ignored files
        --include-submodule    Include submodule files
        --include-untracked    Include untracked files
    -s, --stat                 Show statistics
        --unsorted             Disable tags sort
        --validate-utf8        Validate UTF8 sequence of tag file
    -V, --version              Prints version information
    -v, --verbose              Verbose mode

OPTIONS:
        --bin-ctags <bin_ctags>           Path to ctags binary [default: ctags]
        --bin-git <bin_git>               Path to git binary [default: git]
        --completion <completion>         Generate shell completion file [possible values: bash, fish,
                                          zsh, powershell]
    -e, --exclude <exclude>...            Glob pattern of exclude file ( ex. --exclude '*.rs' )
    -c, --opt-ctags <opt_ctags>...        Options passed to ctags
    -g, --opt-git <opt_git>...            Options passed to git
        --opt-git-lfs <opt_git_lfs>...    Options passed to git-lfs
    -f, --file <output>                   Output filename ( filename '-' means output to stdout ) [default: tags]
    -t, --thread <thread>                 Number of threads [default: 8]

ARGS:
    <DIR>    Search directory [default: .]

You can pass options to ctags by-c/--ctags_opt option like below.

ptags -c --links=no -c --languages=Rust

Searched file types per options are below. --include-submodule and --include_untracked are exclusive. This is the restriction of git ls-files. Any include/exclude options without the above combination can be used simultaneously.

File type Default --exclude-lfs --include-ignored --include-submodule --include-untracked
tracked o o o o o
untracked x x x x o
ignored x x o x x
lfs tracked o x o o o
in submodules x x x o x

You can override any default option by ~/.ptags.toml like below. The complete example of ~/.ptags.toml can be generated by --config option.

thread = 16
bin_ctags = "ctags2"
bin_git = "git2"

Benchmark

Environment

  • CPU: Ryzen Threadripper 1950X
  • MEM: 128GB
  • OS : CentOS 7.4.1708

Data

Name Repository Revision Files Size[GB]
source0 https://github.com/neovim/neovim f5b0f5e17 2370 0.1
source1 https://github.com/llvm-mirror/llvm ddf9edb4020 29670 1.2
source2 https://github.com/torvalds/linux 071e31e254e0 52998 2.2
source3 https://github.com/chromium/chromium d79c68510b7e 293205 13

Result

ptags is up to x5 faster than universal-ctags.

Command Version source0 source1 source2 source3
ctags -R Universal Ctags 0.0.0(f9e6e3c1) 0.41s ( x1 ) 3.42s ( x1 ) 23.64s ( x1 ) 32.23 ( x1 )
ptags -t 16 ptags 0.1.4 0.13s ( x3.15 ) 0.58s ( x5.90 ) 4.24s ( x5.58 ) 7.27s ( x4.43 )

ptags's People

Contributors

dalance avatar dependabot-preview[bot] avatar dependabot[bot] avatar github-actions[bot] avatar mateuszradomski avatar palfrey avatar segevfiner 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ptags's Issues

Code for including ignored files does not actually exist

Hi,

I had problems with the option --include-ignored. Meaning that no matter if the option was set or omitted the output was always the same. Looking into the source code

pub include_ignored: bool,
this bool is never used anywhere, so the logic for including the ignored files is not preset in the code.

Are you able to implement that yourself or are you accepting PRs? :))

Arch Linux AUR packages

I've added both the current master and the latest tag versions of this program to Arch Linux's user repository (AUR). You may add that to the Installation section of the readme.

The packages are:
https://aur.archlinux.org/packages/ptags/
and
https://aur.archlinux.org/packages/ptags-git/

Specifying a command to install AUR packages is kind of a taboo in Arch circles. The general wisdom is to git clone the package off of AUR and then makepkg it yourself, but there are so-called AUR-helpers that automate the process, provide easy updates and so on. One of them is yay, but adding that might enrage some purists and they may say you're pushing yay on them (when there are other helpers and the manual method).

To install the packages with yay, you'd write:

yay -S ptags

or

yay -S ptags-git

Feature request: `ctags -L` equivalent

This would allow replacing something like git ls-files | ctags -L -. Is this possible or is the types of optimisations ptags makes only possible when doing equivalent of ctags -R?

Option to skip the git support but keep the parallelism?

Hi. I was looking for a faster "ctags" and found this.

However, I'm in the game industry, where Perforce is the norm, so the requirement that git be used is messing me up. I tried it on my tree including with the "--include-untracked" option but no luck :-(.

ptags doesn't compile, fails with "error[E0277]: the trait bound `Opt: structopt_toml::structopt::StructOpt` is not satisfied"

> cargo --version
cargo 1.51.0 (43b129a20 2021-03-16)

> cargo install ptags

    Updating crates.io index
  Installing ptags v0.3.2
   Compiling libc v0.2.92
   Compiling proc-macro2 v1.0.24
...

   Compiling structopt-toml v0.4.5
   Compiling ptags v0.3.2
error[E0277]: the trait bound `Opt: structopt_toml::structopt::StructOpt` is not satisfied
  --> /home/rcir178/.cargo/registry/src/github.com-1ecc6299db9ec823/ptags-0.3.2/src/bin.rs:21:52
   |
21 | #[derive(Debug, Deserialize, Serialize, StructOpt, StructOptToml)]
   |                                                    ^^^^^^^^^^^^^ the trait `structopt_toml::structopt::StructOpt` is not implemented for `Opt`
   |
   = help: see issue #48214
   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
error: could not compile `ptags`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: failed to compile `ptags v0.3.2`, intermediate artifacts can be found at `/tmp/cargo-installANJhYz`

Caused by:
  build failed

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.