ascii_art_tree 1.0.6 copy "ascii_art_tree: ^1.0.6" to clipboard
ascii_art_tree: ^1.0.6 copied to clipboard

A minimalistic ASCII Art Tree generator with multiple styles.

ascii_art_tree #

pub package Null Safety Codecov Dart CI GitHub Tag New Commits Last Commits Pull Requests Code size License

A minimalistic ASCII Art Tree generator with multiple styles.

Usage #

import 'package:ascii_art_tree/ascii_art_tree.dart';

void main() async {
  var paths = [
    '/workspace/project-x/src/base.dart',
    '/workspace/project-x/src/entities.dart',
    '/workspace/project-x/src/system.dart',
    '/workspace/project-x/assets/file2.txt',
    '/workspace/project-x/assets/images/imgX.png',
    '/workspace/project-x/assets/images/imgY.png',
  ];

  var asciiArtTree = ASCIIArtTree.fromStringPaths(
    paths,
    style: ASCIIArtTreeStyle.elegant,
  );

  var tree = asciiArtTree.generate();
  print(tree);
}

Output in elegant style (default):

/
└─┬─ workspace
  └─┬─ project-x
    ├─┬─ src
    │ ├──> base.dart
    │ ├──> entities.dart
    │ └──> system.dart
    └─┬─ assets
      ├──> file2.txt
      └─┬─ images
        ├──> imgX.png
        └──> imgY.png

Output in dots style:

/
.workspace
...project-x
.....src
.......base.dart
.......entities.dart
.......system.dart
.....assets
.......file2.txt
.......images
.........imgX.png
.........imgY.png

Output in spaces style:

/
 workspace
   project-x
     src
       base.dart
       entities.dart
       system.dart
     assets
       file2.txt
       images
         imgX.png
         imgY.png

CLI Tool #

You can utilize the CLI tool ascii_art_tree with ease on any platform supported by Dart.

To activate the CLI tool just run:

dart pub global activate ascii_art_tree

Then you can create a ASCII Art Tree from the terminal.

CLI Examples #

  • Read a text file with path entries and generate the ASCII Art Tree in elegant style:

    ascii_art_tree /dir/paths.txt --elegant
    
  • Read a text file with path entries using ":" delimiter:

    ascii_art_tree /dir/paths.txt :    
    
  • Read a JSON file:

    ascii_art_tree /dir/tree.json
    

    Forcing from JSON:

    ascii_art_tree /dir/tree.txt --from-json
    
  • Generating a JSON output:

    ascii_art_tree /dir/paths.txt : --to-json
    

Features and bugs #

Please file feature requests and bugs at the issue tracker.

Author #

Graciliano M. Passos: gmpassos@GitHub.

Don't be shy, show some love, and become our GitHub Sponsor. Your support means the world to us, and it keeps the code caffeinated! ☕✨

Thanks a million! 🚀😄

License #

Dart free & open-source license.

1
likes
140
pub points
52%
popularity

Publisher

unverified uploader

A minimalistic ASCII Art Tree generator with multiple styles.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

collection, graph_explorer, path

More

Packages that depend on ascii_art_tree