Github Extractor CLI
List github repositories or download individual files or whole repos conveniently. Faster than clone depth=1 for an entire repo and much faster if you just need a single file
See an Asciinema video of usage (including with fzf) below.
Install node then:
npx ghex -h
Or:
npm install -g ghex
ghex [options] <paths...>
One or more paths to download. Can be a whole repo, or a folder or a file within it. Supports globs but the path should be quoted. To exclude use a negative glob ("!" at the beginning). Can mix paths from different repos (conflicts resolved left to right). A trailing slash means a whole folder. Conflicting files are skipped by default.
List files. Useful as a dry run and with fzf. Does not download. Will show show conflicts for the current working directory or -d / --dest.
Append the owner/repo prefix to the path in list output. This is useful for feeding back into ghex.
Only show conflicts when listing.
Destination folder. Defaults to the current directory.
Ignores case when checking for conflicts. Default is case-sensitive--i.e. casing matters.
Overwrite all existing conflicting files. Default false.
After writing, outputs the path of each file plus a new line. Useful for piping to other commands. Also sets -quiet & --no-color.
Strip the first n directories from paths. If a path doesn't have enough directories to strip, it's skipped.
No success or error messages.
Remove the owner/repo prefix from the path in list output
Strip ansi escape characters used to color output. ghex respects the NO_COLOR env var if set also.
Entire repo:
npx ghex facebook/react
Specific folder:
npx ghex "facebook/react/packages/*"
Specify destination:
npx ghex -d local/dest facebook/react
Specific files
npx ghex facebook/react/.circleci/config.yml facebook/react/.github/stale.yml
Different repos mixed together"
npx ghex facebook/react micromatch/picomatch
Only conflicts
npx ghex -lc -d local/dest facebook/react
Specific folder
npx ghex -l "facebook/react/.circleci/*"