Skip to content
/ grepath Public

Extract paths effortlessly from your command outputs with grepath

License

Notifications You must be signed in to change notification settings

kqito/grepath

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

grepath

grepath is a command-line utility to effortlessly extract file paths from command outputs. It's especially useful in pipelines for processing compiler or lint tool outputs.

Features

  • Extract file paths from a given text.
  • Optionally extract full paths including line and column numbers.
  • Remove duplicate paths.

Installation

Install prebuilt binaries via Homebrew

brew install kqito/tap/grepath

Install prebuilt binaries via shell script

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/kqito/grepath/releases/latest/download/grepath-installer.sh | sh

Or download directly from releases.

Usage

When we run grepath <file>, it reads the file and outputs the paths from the text.

For example, if you want to open error files in VSCode, you can use the following command:

grepath error.log | xargs -o code

Pipe from a command

You can use grepath in command-line pipelines to filter paths from the output of other commands. Here is an example usage:

cat error.log | grepath | xargs -o code

Command Line Options

grepath --help
Usage: grepath [<file>] [-d] [-l] [-u]

Args

Positional Arguments:
  file              file

Options:
  -d, --debug       help
  -u, --unique      unique Omit duplicate paths
  --help            display usage information

TODO

  • Support for windows paths
  • Support for custom regex patterns

Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page if you want to contribute.

License

About

Extract paths effortlessly from your command outputs with grepath

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages