GithubHelp home page GithubHelp logo

alder's Introduction

alder ๐ŸŒณ

A recursive directory listing program that supports file-size reporting, and pattern matching. Inspired by the tree UNIX command.

Alder: the better tree printer

Installation

alder should be installed globally using yarn.

yarn global add @aweary/alder

or with npm:

npm install -g @aweary/alder

Usage

  Usage: alder [options] [target]

  Options:

    -h, --help           output usage information
    -a, --all            Print all files, including hidden files
    -d, --depth <n>      Only render the tree to a specific depth
    -D, --directories    Only print directories
    -e, --exclude <s>    Exclude files matching a pattern
    -f, --full           Print the full path prefix for each file
    -i, --no-indent      Tree will not print the indentation lines
    -I, --git-ignore     Exclude files in .gitignore
    -p, --include <s>    Include only files that match a pattern
    -s, --sizes          Show file sizes in tree
    -t, --time-stamp     Print the last modified date for each file
    -V, --version        output the version number
    --prune              Prune empty directories from the output
    --filelimit <n>      Do not descend directories that contain more than # entries
    --jsx                Print directory structure as JSX

Exclude pattern

You can pass a string that will be parsed as a regular expression to --exclude:

# excluding single directory
alder --exclude=.git

# excluding multiple directories
alder --exclude=".git|bower_components|node_modules"

Include pattern

You can pass a string that will be parsed as a regular expression to --include:

# including single file pattern
alder --include=package

# including multiple files patterns
alder --include="package|webpack"

alder's People

Contributors

aweary avatar nitishdayal avatar oieduardorabelo avatar wogsland avatar xaviervia 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

alder's Issues

Auto ignore files and folders in .gitignore

Hello! Thanks for this.

This is a small feature request, I was running alder in a project that contains a node_modules folder and it takes a while, plus it has a lot file I was not interested in listing. I thought it would be nice if by default it would pick up the .gitignore file and skip those folders entirely. This would make scanning code project folders a breeze ๐ŸŒฌ

If you think this make sense I can try to PR it.

Double -d options in readme

Both depth/directories both say they have the shortcut of -d but alder -d 3 returns this error:

fs.js:951
  return binding.readdir(pathModule._makeLong(path), options.encoding);
                 ^

Error: ENOENT: no such file or directory, scandir '${pwd}/3'
   ...

It doesn't actually return the string ${pwd} but it does return the current directory/3

Error: ENOENT: no such file or directory

I've got the following error for some directories:

โžœ  java alder .
fs.js:968
  binding.stat(pathModule._makeLong(path), statValues);
          ^

Error: ENOENT: no such file or directory, stat '/Users/vbauer/Documents/workspace/java/bu/mbi/mbi-admin/build/ivy/tmp/lib/test/mbi-core-default.jar'
    at Object.fs.statSync (fs.js:968:11)
    at buildTree (/usr/local/lib/node_modules/@aweary/alder/alder.js:136:22)
    at buildTree (/usr/local/lib/node_modules/@aweary/alder/alder.js:184:7)
    at buildTree (/usr/local/lib/node_modules/@aweary/alder/alder.js:184:7)
    at buildTree (/usr/local/lib/node_modules/@aweary/alder/alder.js:184:7)
    at buildTree (/usr/local/lib/node_modules/@aweary/alder/alder.js:184:7)
    at buildTree (/usr/local/lib/node_modules/@aweary/alder/alder.js:184:7)
    at buildTree (/usr/local/lib/node_modules/@aweary/alder/alder.js:184:7)
    at buildTree (/usr/local/lib/node_modules/@aweary/alder/alder.js:184:7)
    at buildTree (/usr/local/lib/node_modules/@aweary/alder/alder.js:184:7)

Short option for -d reads directory by name of given number

Checked out this project just now, and after playing around with the options I had the following experience:

$ alder --depth 2

 .
 โ”œโ”€โ”€ appearance
 โ”‚   โ””โ”€โ”€ start
 โ”œโ”€โ”€ colors
 โ”‚   โ””โ”€โ”€ start
 โ”œโ”€โ”€ editing
 โ”‚   โ””โ”€โ”€ start
 โ”œโ”€โ”€ lang
 โ”‚   โ””โ”€โ”€ start
 โ””โ”€โ”€ project
     โ””โ”€โ”€ start
10 directories, 0 files (0 B)
$  alder -d 2
node:internal/fs/utils:347
    throw err;
    ^

Error: ENOENT: no such file or directory, scandir '/Users/agodin/.vim/pack/2'
    at Object.readdirSync (node:fs:1451:3)
    at buildTree (/Users/agodin/.nvm/versions/node/v18.14.2/lib/node_modules/@aweary/alder/alder.js:125:20)
    at Object.<anonymous> (/Users/agodin/.nvm/versions/node/v18.14.2/lib/node_modules/@aweary/alder/alder.js:193:1)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47 {
  errno: -2,
  syscall: 'scandir',
  code: 'ENOENT',
  path: '/Users/agodin/.vim/pack/2'
}

Node.js v18.14.2

It looks like the usage of -d is setting 2 as the argument for which directory to use as the cwd.

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.