Giter Site home page Giter Site logo

gotree's Introduction

GoTree

GoTree Language Badge Go Report License Badge Status Badge GoDoc Build Status

Simple Go module to print tree structures in terminal. Heavily inspired by The Tree Command for Linux

The GoTree's goal is to be a simple tool providing a stupidly easy-to-use and fast way to print recursive structures.

Project Status

GoTree is on beta. Pull Requests are welcome

Features

  • Very simple and fast code
  • Intuitive names
  • Easy to extend
  • Uses only native libs
  • STUPIDLY EASY TO USE

Installation

Go Get

$ go get github.com/disiqueira/gotree

Usage

Simple create, populate and print example

package main

import (
    "fmt"

    "github.com/disiqueira/gotree"
)

func main() {
	artist := gotree.New("Pantera")
	album := artist.Add("Far Beyond Driven")
	album.Add("5 minutes Alone")

	fmt.Println(artist.Print())
}

Contributing

Bug Reports & Feature Requests

Please use the issue tracker to report any bugs or file feature requests.

Developing

PRs are welcome. To begin developing, do this:

$ git clone --recursive [email protected]:DiSiqueira/GoTree.git
$ cd GoTree/

Social Coding

  1. Create an issue to discuss about your idea
  2. [Fork it] (https://github.com/DiSiqueira/GoTree/fork)
  3. Create your feature branch (git checkout -b my-new-feature)
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create a new Pull Request
  7. Profit! ✅

License

The MIT License (MIT)

Copyright (c) 2013-2018 Diego Siqueira

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

gotree's People

Contributors

akash-nayak avatar d6o avatar disiqueira avatar jaroslaw-bochniak avatar konstantin8105 avatar shivammg avatar tobikris avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gotree's Issues

Use pointers in GTStructure to allow mutation of the items before printing

Hi,

I have just created a PR #5 which changes items in GTStructure from value receiver to a pointer. This is an API breaking change so not sure if you are open for it.

This change basically has two benefits:

  • pointer reference should be more efficient for the bigger data structures
  • it allows for construction of the data structure and modification of the items before actual printing is done. This is useful in cases when construction of the structure and its final state happens in different stages of the program. Thanks to pointers data can be modified without actual need of value copying entire structure.

WDYT about it? All remarks are welcomed.

I am happy to update README.md as well with the usage example if you think that this PR brings any value.

file system tree

wondering if it would makes sense to extend this to allow printing a file system tree ?

The reason being that i am toying with the idea to extend this lib a bit to show git status and maybe a few other things.

The idea is that you can just install it on any machine and have a decent folder view tool, along with the micro terminal IDE ( https://github.com/zyedidia/micro )

Wondering what you think..

Multiline nodes

May I create a feature for more beautiful view for node strings with "\n"(newlines).
Could you clarify.

Prototype:

	artist := gotree.New("Pantera")
	album := artist.Add("Far Beyond\nDriven") // <<----- add newline here
	album.Add("5 minutes Alone")
	artist.Add("Power Metal")
	fmt.Println(artist.Print())

	// Output:
	// Pantera
	// ├───+ Far Beyond 
	// │   │ Driven                         // <<<<----- good view on new line
	// │   └── 5 minutes Alone
	// └── Power Metal

Test is not executed

The test file contains a test, but it is only a visual inspection test.

A small refactor can allow to test dynamically, and I have a patch ready if you are interested.

`go get` downloads the v1 (old and broken version) instead of latest (v3)

Hi,

found this repo today, tried doing the go get line to add it to my project, discovered it downloads either some .a file or the pkg code for the v1 release. Not sure what is wrong with the repo, guessing a bad release setup in github or go.mod file?

Would much prefer to import your repo instead of forking the latest version to resolve this.

Thanks

Your recent refactor changed names that breaks Gorganizer

Had to revert to the version 20 days ago.

./gorganizer.go:24: undefined: gotree.GTStructure
./gorganizer.go:26: undefined: gotree.GTStructure
./gorganizer.go:38: undefined: gotree.GTStructure
./gorganizer.go:109: undefined: gotree.GTStructure
./gorganizer.go:114: undefined: gotree.PrintTree
./gorganizer.go:119: undefined: gotree.GTStructure
./ini.go:54: undefined: gotree.GTStructure
./ini.go:60: undefined: gotree.GTStructure
./ini.go:68: undefined: gotree.GTStructure
./ini.go:78: undefined: gotree.PrintTree

Bump version

When using dep (and maybe others) to install this library, it pickup the latest tagged version 0.1. I would like to use master without having to add a constraint in the Gopkg.toml.
Could you tag the latest master to a new semver version, 0.2.0 or something like that?
Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.