New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cli-tree

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cli-tree

  • 1.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

ruby-cli-tree

A command line printer of tree structures (e.g. directory tree) written in Ruby.

This library can be used to build a tree structure, and render or print it like an ASCII graph.

e.g. it can be used to implement a directory tree printer just like the Linux utility tree. See bin/tree.rb

Installation

gem install cli-tree

Usage

  1. require 'cli-tree'
  2. Create a TreeNode: tree = TreeNode.new(node_name, children = [])
  3. Add more TreeNode objects to children: tree.children << child_node
  4. Add more TreeNode objects to child_node, and so on.
  5. Call puts tree.render or tree.print to print the tree.

Example

require 'cli-tree'

tree = TreeNode.new("root", [
  TreeNode.new("foo", [
    TreeNode.new("bar"),
    TreeNode.new("baz")
  ])
])

puts tree.render
# or simply
tree.print

Output:

root
└── foo
    ├── bar
    └── baz

FAQs

Package last updated on 02 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc