{"id":18257126,"url":"https://github.com/yzhong52/ascii_tree","last_synced_at":"2025-04-04T18:30:58.101Z","repository":{"id":48141318,"uuid":"515390385","full_name":"yzhong52/ascii_tree","owner":"yzhong52","description":"A command line tool for drawing tree structures with ascii characters.","archived":false,"fork":false,"pushed_at":"2024-08-27T02:13:58.000Z","size":94,"stargazers_count":23,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-20T16:52:45.597Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://crates.io/crates/astree","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yzhong52.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-19T01:09:22.000Z","updated_at":"2025-02-20T18:06:37.000Z","dependencies_parsed_at":"2024-08-08T06:34:26.399Z","dependency_job_id":null,"html_url":"https://github.com/yzhong52/ascii_tree","commit_stats":{"total_commits":33,"total_committers":2,"mean_commits":16.5,"dds":0.4242424242424242,"last_synced_commit":"fc3c213ee5e59f88f4e5a67ba295564559bd8793"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yzhong52%2Fascii_tree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yzhong52%2Fascii_tree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yzhong52%2Fascii_tree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yzhong52%2Fascii_tree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yzhong52","download_url":"https://codeload.github.com/yzhong52/ascii_tree/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247229186,"owners_count":20904996,"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":[],"created_at":"2024-11-05T10:24:56.045Z","updated_at":"2025-04-04T18:30:57.816Z","avatar_url":"https://github.com/yzhong52.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ascii Tree\n\nA command line tool for drawing tree structures with ascii characters.\n\n  - [Installation](#installation)\n    - [Install Via Homebrew](#install-via-homebrew)\n    - [Install Via Cargo](#install-via-cargo)\n  - [Usage](#usage)\n    - [Input From File](#input-from-file)\n    - [Horizontal Tree](#horizontal-tree)\n    - [Vertical Tree](#vertical-tree)\n      - [Vertical Tree Styles](#vertical-tree-styles)\n      - [Vertical Tree Maximum Label Width](#vertical-tree-maximum-label-width)\n      - [Vertical Tree Horizontal Spacing](#vertical-tree-horizontal-spacing)\n      - [Vertical Tree Multi Lines](#vertical-tree-multi-lines)\n  - [Development](#development)\n\n## Installation\n\n### Install Via Homebrew\n\nInstall homebrew https://brew.sh/:\n\n```\n/bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\"\n```\n\nInstall astree https://github.com/ascii-draw/homebrew-ascii-tree:\n\n```\nbrew tap ascii-draw/ascii-tree\nbrew install astree\n```\n\n### Install Via Cargo\n\nInstall cargo \u003chttps://doc.rust-lang.org/cargo/getting-started/installation.html\u003e:\n\n```\ncurl https://sh.rustup.rs -sSf | sh\n```\n\nInstall astree from \u003chttps://crates.io/crates/astree\u003e:\n\n```\ncargo install astree\n```\n\n## Usage\n\nCheck out the help message:\n\n```\n$ astree -h\nA command line tool for drawing tree structures with ascii characters\n\nUsage: astree \u003cCOMMAND\u003e\n\nCommands:\n  vertical    Print the tree virtually. Use 'v' for shorthand\n  horizontal  Print the tree horizontally. Use 'h' for shorthand\n  help        Print this message or the help of the given subcommand(s)\n\nOptions:\n  -h, --help     Print help information (use `--help` for more detail)\n  -V, --version  Print version information\n```\n\nFor example, we can use it like this:\n\n```\nastree horizontal -i \"$(cat \u003c\u003c 'EOF'\n# Root\n## Child 1\n### Grandchild 1\n### Grandchild 2\nEOF\n)\"\n```\n\nHere, each additional `#` indicates a nested child.\n\nOutput:\n\n```\nRoot\n└─ Child 1\n   ├─ Grandchild 1\n   └─ Grandchild 2\n```\n\n### Input From File\n\nAlternatively, we can also save the markdown file, such as `tree.md`.\n\n```\n# Root\n## Child 1\n### Grandchild 1\n### Grandchild 2\n```\n\nAnd invoke the command like so:\n\n```\nastree horizontal -i tree.md\n```\n\nOutput:\n\n```\nRoot\n└─ Child 1\n   ├─ Grandchild 1\n   └─ Grandchild 2\n```\n\n### Horizontal Tree\n\nExample of drawing a horizontal tree:\n\n```\n$ astree horizontal -i examples/with_grandchildren_0.md\nRoot\n├─ Child 1\n│  ├─ Grandchild 1.1\n│  └─ Grandchild 1.2\n├─ Child 2\n│  └─ Child 2.1\n└─ Child 3\n```\n\nExample of drawing a tree with multiple root nodes:\n```\n$ astree horizontal -i examples/multi_tree.md\n.\n├─ Root 1\n│  ├─ Child 1.1\n│  │  ├─ Grandchild 1.1.1\n│  │  └─ Grandchild 1.1.2\n│  └─ Child 1.2\n└─ Root 2\n   └─ Child 2.1\n```\n### Vertical Tree\n\nExample of drawing a vertical tree:\n\n```\nastree vertical --input examples/with_grandchildren_1.md\n             ┌──────┐\n             │ Root │\n             └──┬───┘\n           ┌────┴────┐\n           │ Child 1 │\n           └────┬────┘\n       ┌────────┴────────┐\n┌──────┴───────┐  ┌──────┴───────┐\n│ Grandchild 1 │  │ Grandchild 2 │\n└──────────────┘  └──────────────┘\n```\n\nExample of drawing a forest with multiple root nodes:\n\n```\n$ astree vertical -i examples/multi_tree.md\n                               ┌────────┐\n                               │ Root 1 │\n                               └───┬────┘\n                    ┌──────────────┴──────────────┐\n              ┌─────┴─────┐                 ┌─────┴─────┐\n              │ Child 1.1 │                 │ Child 1.2 │\n              └─────┬─────┘                 └───────────┘\n         ┌──────────┴──────────┐\n┌────────┴─────────┐  ┌────────┴─────────┐\n│ Grandchild 1.1.1 │  │ Grandchild 1.1.2 │\n└──────────────────┘  └──────────────────┘\n  ┌────────┐\n  │ Root 2 │\n  └───┬────┘\n┌─────┴─────┐\n│ Child 2.1 │\n└───────────┘\n```\n\n#### Vertical Tree Styles\n\nWith thick lines:\n\n```\nastree vertical --input examples/with_grandchildren_1.md --style thick\n             ┏━━━━━━┓\n             ┃ Root ┃\n             ┗━━┳━━━┛\n           ┏━━━━┻━━━━┓\n           ┃ Child 1 ┃\n           ┗━━━━┳━━━━┛\n       ┏━━━━━━━━┻━━━━━━━━┓\n┏━━━━━━┻━━━━━━━┓  ┏━━━━━━┻━━━━━━━┓\n┃ Grandchild 1 ┃  ┃ Grandchild 2 ┃\n┗━━━━━━━━━━━━━━┛  ┗━━━━━━━━━━━━━━┛\n```\n\nWith double lines:\n\n```\nastree vertical --input examples/with_grandchildren_1.md --style double\n             ╔══════╗\n             ║ Root ║\n             ╚══╦═══╝\n           ╔════╩════╗\n           ║ Child 1 ║\n           ╚════╦════╝\n       ╔════════╩════════╗\n╔══════╩═══════╗  ╔══════╩═══════╗\n║ Grandchild 1 ║  ║ Grandchild 2 ║\n╚══════════════╝  ╚══════════════╝\n```\n\nWith chest style:\n\n```\nastree vertical --input examples/with_grandchildren_2.md --style chest\n                       ╔━━━━━━╗\n                       ┃ Root ┃\n                       ╚━━┳━━━╝\n              ╔━━━━━━━━━━━┻━━━━━━━━━━━╗\n          ╔━━━┻━━━╗               ╔━━━┻━━━╗\n          ┃ Left  ┃               ┃ Right ┃\n          ┃ Child ┃               ┃ Child ┃\n          ╚━━━┳━━━╝               ╚━━━┳━━━╝\n      ╔━━━━━━━┻━━━━━━━╗         ╔━━━━━┻━━━━━━╗\n╔━━━━━┻━━━━━━╗  ╔━━━━━┻━━━━━━╗  ┃   Right    ┃\n┃ Grandchild ┃  ┃ Grandchild ┃  ┃ Grandchild ┃\n┃    (1)     ┃  ┃    (2)     ┃  ╚━━━━━━━━━━━━╝\n╚━━━━━━━━━━━━╝  ╚━━━━━━━━━━━━╝\n```\n\nWith balloon style:\n\n```\nastree vertical --input examples/with_children_2.md --style balloon2\n   ╭───────────╮\n   │ Root Node │\n   ╰─────¤─────╯\n    ╭────┴─────╮\n╭───¤───╮  ╭───¤───╮\n│ Child │  │ Child │\n│  (1)  │  │  (2)  │\n╰───────╯  ╰───────╯\n```\n\n#### Vertical Tree Maximum Label Width\n\nTo specify the maximum width of the label with `--width \u003cWIDTH\u003e`. For example:\n\n```\nastree vertical --input examples/with_long_label.md --width 10\n     ┌──────────┐\n     │ A Simple │\n     │   Root   │\n     └────┬─────┘\n    ┌─────┴──────┐\n┌───┴────┐  ┌────┴────┐\n│ A long │  │ Another │\n│ child  │  │  long   │\n└────────┘  │  child  │\n            └─────────┘\n```\n\n#### Vertical Tree Horizontal Spacing\n\nBy default, there is a two-spaces gap between boxes. This can be set with `--spacing \u003cSPACING\u003e`.\n\n```\nastree vertical --input examples/with_many_children.md --width 10 --spacing 0\n               ┌──────────┐\n               │ A Simple │\n               │   Root   │\n               └────┬─────┘\n    ┌──────────┬────┴─────┬──────────┐\n┌───┴────┐┌────┴────┐┌────┴────┐┌────┴─────┐\n│ A long ││ Another ││ A third ││ One more │\n│ child  ││  long   ││  child  ││  child   │\n└────────┘│  child  │└─────────┘└──────────┘\n          └─────────┘\n\nastree vertical --input examples/with_many_children.md --width 10 --spacing 10\n         ┌──────────┐\n         │ A Simple │\n         │   Root   │\n         └────┬─────┘\n    ┌─────────┴──────────┐\n┌───┴────┐          ┌────┴────┐\n│ A long │          │ Another │\n│ child  │          │  long   │\n└────────┘          │  child  │\n                    └─────────┘\n```\n\n#### Vertical Tree Multi Lines\n\nTitle lines in your Markdown file define the tree structure. Any content under a title is automatically included as separate lines within the same structural level.\n\n```\nastree vertical --input examples/with_content.md\n           ┌──────┐\n           │ Root │\n           └──┬───┘\n      ┌───────┴────────┐\n┌─────┴──────┐  ┌──────┴──────┐\n│ Left Child │  │ Right Child │\n│ Quota: 100 │  │ Quota: 200  │\n└────────────┘  └─────────────┘\n```\n\n## Development\n\nSee [development.md](./development.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyzhong52%2Fascii_tree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyzhong52%2Fascii_tree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyzhong52%2Fascii_tree/lists"}