All Projects โ†’ jez โ†’ As Tree

jez / As Tree

Licence: other
Print a list of paths as a tree of paths ๐ŸŒณ

Programming Languages

rust
11053 projects

Labels

Projects that are alternatives of or similar to As Tree

Vue Multiple Page
vue + webpack ๅคš้กต/ๅ•้กต ่„šๆ‰‹ๆžถ
Stars: โœญ 163 (-2.4%)
Mutual labels:  cli
Lua Resty Repl
Interactive console (REPL) for Openresty and luajit code
Stars: โœญ 165 (-1.2%)
Mutual labels:  cli
Craftsman
Craftsman is the workhorse behind the Wrapt framework and provides a suite of CLI commands for quickly scaffolding out new files and projects for your .NET Web APIs with simple CLI commands and configuration files.
Stars: โœญ 165 (-1.2%)
Mutual labels:  cli
Ionic Cli
The Ionic command-line interface
Stars: โœญ 1,967 (+1077.84%)
Mutual labels:  cli
Command
A library to build command line applications using PHP
Stars: โœญ 164 (-1.8%)
Mutual labels:  cli
Scrape Twitter
๐Ÿฆ Access Twitter data without an API key. [DEPRECATED]
Stars: โœญ 166 (-0.6%)
Mutual labels:  cli
Swiggy Analytics
Analyse your swiggy orders ๐Ÿ”
Stars: โœญ 163 (-2.4%)
Mutual labels:  cli
Jira Cli
A jira user friendly command line client
Stars: โœญ 167 (+0%)
Mutual labels:  cli
Manage Fastapi
๐Ÿš€ CLI tool for FastAPI. Generating new FastAPI projects & boilerplates made easy.
Stars: โœญ 163 (-2.4%)
Mutual labels:  cli
Grex
A command-line tool and library for generating regular expressions from user-provided test cases
Stars: โœญ 4,847 (+2802.4%)
Mutual labels:  cli
Gluegun
A delightful toolkit for building TypeScript-powered command-line apps.
Stars: โœญ 2,183 (+1207.19%)
Mutual labels:  cli
Chrome Headless Render Pdf
Stars: โœญ 164 (-1.8%)
Mutual labels:  cli
Bt
BitTorrent library and client with DHT, magnet links, encryption and more
Stars: โœญ 2,011 (+1104.19%)
Mutual labels:  cli
Netctl
Profile based systemd network management
Stars: โœญ 163 (-2.4%)
Mutual labels:  cli
Converter
database table to golang struct (table to struct) converter with cli and go lib support
Stars: โœญ 167 (+0%)
Mutual labels:  cli
Knctl
Knative CLI
Stars: โœญ 163 (-2.4%)
Mutual labels:  cli
Cert
Cert is the Go tool to get TLS certificate information.
Stars: โœญ 166 (-0.6%)
Mutual labels:  cli
Cash Cli
๐Ÿ’ฐ๐Ÿ’ฐ Convert currency rates directly from your terminal!
Stars: โœญ 168 (+0.6%)
Mutual labels:  cli
Protodep
Collect necessary .proto files (Protocol Buffers IDL) and manage dependencies
Stars: โœญ 167 (+0%)
Mutual labels:  cli
Stacks Cli
๐Ÿ“Š Analyze website stack from the terminal ๐Ÿ’ป
Stars: โœญ 1,962 (+1074.85%)
Mutual labels:  cli

as-tree

Build Status

Print a list of paths as a tree of paths.

For example, given:

dir1/foo.txt
dir1/bar.txt
dir2/qux.txt

it will print:

.
โ”œโ”€โ”€ dir1
โ”‚   โ”œโ”€โ”€ foo.txt
โ”‚   โ””โ”€โ”€ bar.txt
โ””โ”€โ”€ dir2
    โ””โ”€โ”€ qux.txt

This tool is particularly useful when used with find or fd to produce such a list of files. It's similar in spirit to tree, but find and fd tend to be more powerful when it comes to controlling which files to list.

Inspired by this feature request.

Install

There are pre-built binary releases in the Releases tab.

This project is written in Rust and builds under both Bazel and Cargo.

To install from source using Cargo:

cargo install -f --git https://github.com/jez/as-tree

To install from source using Bazel:

git clone https://github.com/jez/as-tree
cd as-tree
make install

Usage

โฏ as-tree --help
Print a list of paths as a tree of paths.

Usage:
  as-tree [options] [<filename>]

Arguments:
  <filename>        The file to read from. When omitted, reads from stdin.

Options:
  --color (always|auto|never)
                    Whether to colorize the output [default: auto]
  -f                Prints the full path prefix for each file.
  -h, --help        Print this help message

Example:
  find . -name '*.txt' | as-tree

Example

This tool is particularly useful with tools like fd which can prune the list of files to print better than tree can alone.

โฏ fd --exclude test | as-tree
.
โ”œโ”€โ”€ LICENSE.md
โ”œโ”€โ”€ Makefile
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ WORKSPACE
โ”œโ”€โ”€ bazel
โ”œโ”€โ”€ main
โ”‚   โ”œโ”€โ”€ BUILD
โ”‚   โ””โ”€โ”€ main.cc
โ”œโ”€โ”€ third_party
โ”‚   โ”œโ”€โ”€ BUILD
โ”‚   โ”œโ”€โ”€ externals.bzl
โ”‚   โ””โ”€โ”€ spdlog.BUILD
โ””โ”€โ”€ tools
    โ”œโ”€โ”€ BUILD
    โ”œโ”€โ”€ clang.bzl
    โ””โ”€โ”€ scripts
        โ”œโ”€โ”€ build_compilation_db.sh
        โ””โ”€โ”€ generate_compdb_targets.sh

Developing

Running the tests requires Bazel. The ./bazel shell script in this repo will download and cache a specific version of Bazel for you. From there, Bazel knows how to install all the dependencies it needs to build this project (including a Rust toolchain).

# Run the tests:
./bazel test --test_output=errors //test

# To add a test, create two files:
#
# - test/fixtures/foo.txt
# - test/fixtures/foo.txt.exp
#
# The first file is the input to feed to `as-tree`, and the second is the
# expected output of `as-tree` on that input

# Update all the tests:
./bazel test //test:update

# When you add a new dependency, you'll need to add it with Bazel too:
cargo install cargo-raze # (one time setup)
cd third_party/cargo
cargo raze

TODO(jez)

  • rustfmt / buildifier / shellcheck in CI
  • [ ] Only use box drawing characters if the locale supports it
    • See man locale, LC_CTYPE=C tree
  • [ ] Add a -0 flag to support files with newlines in their name
    • Seriously why is this allowed?
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].