{"id":13587185,"url":"https://github.com/jez/as-tree","last_synced_at":"2025-04-05T03:02:55.825Z","repository":{"id":48668207,"uuid":"262922411","full_name":"jez/as-tree","owner":"jez","description":"Print a list of paths as a tree of paths 🌳","archived":false,"fork":false,"pushed_at":"2021-10-07T12:59:11.000Z","size":167,"stargazers_count":478,"open_issues_count":14,"forks_count":18,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-29T02:06:21.736Z","etag":null,"topics":["cli"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jez.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-11T02:47:12.000Z","updated_at":"2025-03-28T07:50:15.000Z","dependencies_parsed_at":"2022-09-02T21:02:18.625Z","dependency_job_id":null,"html_url":"https://github.com/jez/as-tree","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jez%2Fas-tree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jez%2Fas-tree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jez%2Fas-tree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jez%2Fas-tree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jez","download_url":"https://codeload.github.com/jez/as-tree/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247280214,"owners_count":20912967,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli"],"created_at":"2024-08-01T15:06:04.755Z","updated_at":"2025-04-05T03:02:55.804Z","avatar_url":"https://github.com/jez.png","language":"Rust","readme":"# as-tree\n\n[![Build Status](https://travis-ci.org/jez/as-tree.svg?branch=master)](https://travis-ci.org/jez/as-tree)\n\nPrint a list of paths as a tree of paths.\n\nFor example, given:\n\n```\ndir1/foo.txt\ndir1/bar.txt\ndir2/qux.txt\n```\n\nit will print:\n\n```\n.\n├── dir1\n│   ├── foo.txt\n│   └── bar.txt\n└── dir2\n    └── qux.txt\n```\n\nThis tool is particularly useful when used with `find` or `fd` to produce such\na list of files. It's similar in spirit to `tree`, but `find` and `fd` tend to\nbe more powerful when it comes to controlling which files to list.\n\nInspired by [this feature request](https://github.com/sharkdp/fd/issues/283).\n\n## Install\n\nThere are pre-built binary releases in the Releases tab.\n\nThis project is written in Rust and builds under both Bazel and Cargo.\n\nTo install from source using Cargo:\n\n```shell\ncargo install -f --git https://github.com/jez/as-tree\n```\n\nTo install from source using Bazel:\n\n```shell\ngit clone https://github.com/jez/as-tree\ncd as-tree\nmake install\n```\n\n## Usage\n\n```\n❯ as-tree --help\nPrint a list of paths as a tree of paths.\n\nUsage:\n  as-tree [options] [\u003cfilename\u003e]\n\nArguments:\n  \u003cfilename\u003e        The file to read from. When omitted, reads from stdin.\n\nOptions:\n  --color (always|auto|never)\n                    Whether to colorize the output [default: auto]\n  -f                Prints the full path prefix for each file.\n  -h, --help        Print this help message\n\nExample:\n  find . -name '*.txt' | as-tree\n```\n\n## Example\n\nThis tool is particularly useful with tools like `fd` which can prune the list\nof files to print better than `tree` can alone.\n\n```\n❯ fd --exclude test | as-tree\n.\n├── LICENSE.md\n├── Makefile\n├── README.md\n├── WORKSPACE\n├── bazel\n├── main\n│   ├── BUILD\n│   └── main.cc\n├── third_party\n│   ├── BUILD\n│   ├── externals.bzl\n│   └── spdlog.BUILD\n└── tools\n    ├── BUILD\n    ├── clang.bzl\n    └── scripts\n        ├── build_compilation_db.sh\n        └── generate_compdb_targets.sh\n```\n\n## Developing\n\nRunning the tests requires Bazel. The `./bazel` shell script in this repo will\ndownload and cache a specific version of Bazel for you. From there, Bazel knows\nhow to install all the dependencies it needs to build this project (including a\nRust toolchain).\n\n```shell\n# Run the tests:\n./bazel test --test_output=errors //test\n\n# To add a test, create two files:\n#\n# - test/fixtures/foo.txt\n# - test/fixtures/foo.txt.exp\n#\n# The first file is the input to feed to `as-tree`, and the second is the\n# expected output of `as-tree` on that input\n\n# Update all the tests:\n./bazel test //test:update\n\n# When you add a new dependency, you'll need to add it with Bazel too:\ncargo install cargo-raze # (one time setup)\ncd third_party/cargo\ncargo raze\n```\n\n## TODO(jez)\n\n- rustfmt / buildifier / shellcheck in CI\n- [ ] Only use box drawing characters if the locale supports it\n  - See `man locale`, `LC_CTYPE=C tree`\n- [ ] Add a `-0` flag to support files with newlines in their name\n  - Seriously why is this allowed?\n","funding_links":[],"categories":["Rust","\u003ca name=\"text-processing\"\u003e\u003c/a\u003eText processing","Other"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjez%2Fas-tree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjez%2Fas-tree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjez%2Fas-tree/lists"}