mkdir-tree
is a cli tool that generates directory structures from various input formats. It's inspired by the tree
command-line tool but focuses on creating directory structures rather than just displaying them.
- Create directory structures from text, JSON, XML, or HTML input
- Simple command-line interface
- No external dependencies - just Python standard library
-
Clone this repository:
git clone https://github.com/yourusername/mkdir-tree.git cd mkdir-tree
-
Make the script executable:
chmod +x mkdir-tree.py
-
(Optional) Add the script to your PATH or create an alias in your shell configuration file (e.g.,
.zshrc
):alias mkdir-tree='python /path/to/mkdir-tree.py'
python mkdir-tree.py [-f {text,json,xml,html}] input_file
Options:
-f
,--format
: Specify the input file format (default: text)input_file
: Path to the input file containing the directory structure
A simple indented text format:
project/
src/
main.py
utils.py
docs/
readme.md
tests/
test_main.py
A JSON object representing the directory structure:
{
"project": {
"src": {
"main.py": null,
"utils.py": null
},
"docs": {
"readme.md": null
},
"tests": {
"test_main.py": null
}
}
}
An XML representation of the directory structure:
<project>
<src>
<main.py/>
<utils.py/>
</src>
<docs>
<readme.md/>
</docs>
<tests>
<test_main.py/>
</tests>
</project>
An HTML unordered list representing the directory structure:
<ul>
<li>project
<ul>
<li>src
<ul>
<li>main.py</li>
<li>utils.py</li>
</ul>
</li>
<li>docs
<ul>
<li>readme.md</li>
</ul>
</li>
<li>tests
<ul>
<li>test_main.py</li>
</ul>
</li>
</ul>
</li>
</ul>
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.