S VAIBHAVE
S VAIBHAVE

Reputation: 68

How do I get the directory tree structure from a Github repository link

Given a github repo link, I want to generate the directory tree structure and display it in a web application UI.

Other than scraping the link, is there any other method which I can use through Github API perhaps?

Upvotes: 1

Views: 5941

Answers (1)

IdrisAkintobi
IdrisAkintobi

Reputation: 21

If you can clone the repository to your local machine. You can use the tree command line tool.

Use your package installer to install tree.

Mac users brew install tree

Ubuntu and the likes sudo apt-get install tree

Windows choco install tree

To use the tool

tree [options] /path/to/directory

If the directory is not passed the current working directory will be used.

tree --gitignore /path/to/directory

Is one of the options i use often. It filter by using .gitignore files.

To view the available options tree --help

Upvotes: 1

Related Questions