Skip to content

jpwallace22/seed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

52 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Seed 🌱

Seed is a CLI tool that helps you quickly create directory structures from a tree representation. Whether you have a tree structure in your clipboard or a file, Seed can instantly "grow" it into a real directory structure.

Installation

macOS

brew install jpwallace22/seed/seed

Go Users

go install github.com/jpwallace22/seed@latest

Linux

Available for Debian/Ubuntu, RHEL/Fedora, and Arch Linux distributions.

Debian/Ubuntu

sudo apt install ./seed_*.deb  
# or
sudo dpkg -i seed_*.deb       

RHEL/Fedora

sudo rpm -i seed_*.rpm

Arch Linux

sudo pacman -U seed_*.pkg.tar.zst

Windows

Download the latest release for Windows from the releases page.

Manual Installation

For other platforms or manual installation:

  1. Download the appropriate binary for your system from the releases page
  2. Extract the archive if necessary
  3. Move the binary to a location in your PATH (e.g., /usr/local/bin on Unix-like systems)
  4. Verify the installation:
seed --version

Building from Source

git clone https://github.com/jpwallace22/seed.git
cd seed
go install

Note

Each release includes a checksums.txt file for verifying the integrity of your download.

Usage

Seed can create directory structures in two ways:

From Clipboard

seed -c
# or
seed --clipboard

This will read a tree structure from your clipboard and create the corresponding directories and files.

From String

seed "my-react-app
   β”œβ”€β”€ src
   β”‚   β”œβ”€β”€ components
   β”‚   β”œβ”€β”€ hooks
   β”‚   β”œβ”€β”€ utils
   β”‚   └── App.tsx
   β”œβ”€β”€ public
   β”‚   └── index.html
   └── package.json"

From File

seed -f path/to/file
# or
seed --file path/to/file

Input Format

Seed accepts tree structures in the common tree command format. For example:

Using ASCII characters

my-project
β”œβ”€β”€ src
β”‚   β”œβ”€β”€ components
β”‚   β”‚   β”œβ”€β”€ Button.tsx
β”‚   β”‚   └── Card.tsx
β”‚   β”œβ”€β”€ utils
β”‚   β”‚   └── helpers.ts
β”‚   └── App.tsx
β”œβ”€β”€ public
β”‚   └── index.html
└── package.json

Using spaces

Note

Only 4 spaces is supported at this time

my-project
    src
        components
            Button.tsx
            Card.tsx
        utils
            helpers.ts
        App.tsx
    public
        index.html
    package.json

You can generate this format using:

  • The tree command in Unix-like systems
  • VS Code extensions like "File Tree Generator"
  • Manually create it following the format above
  • Or commonly generated with AI text gen tools

Using JSON

Seed also accepts JSON input that describes the directory structure. The JSON format should be an array containing directory/file objects and an optional report object:

[
  {
    "type": "directory",
    "name": "my-project",
    "contents": [
      {
        "type": "directory",
        "name": "src",
        "contents": [
          {
            "type": "file",
            "name": "main.go"
          },
          {
            "type": "directory",
            "name": "utils",
            "contents": [
              {
                "type": "file",
                "name": "helper.go"
              }
            ]
          }
        ]
      }
    ]
  },
  {
    "type": "report",
    "directories": 3,
    "files": 2
  }
]

Each object in the structure must have:

  • type: Either "directory" or "file"
  • name: The name of the directory or file
  • contents: (Optional) An array of nested files and directories (only valid for directory type)

The report object is optional and contains:

  • directories: Total number of directories
  • files: Total number of files

Seed with throw if the report does not match what was created.

Example usage with JSON:

As string

seed -F json '{"type":"directory","name":"project","contents":[{"type":"file","name":"README.md"}]}'
# or
seed --format json '{"type":"directory","name":"project","contents":[{"type":"file","name":"README.md"}]}'

From clipboard

seed -F json -c
# or
seed --format json -c

From file

Note

Soon the filetype will be auto selected

seed -F json -f path/to/structure.json
# or
seed --format json -f path/to/structure.json

Features

  • πŸš€ Super Fast directory structure creation
  • πŸ“‹ Direct clipboard support
  • 🌲 Supports standard tree format
  • πŸ—οΈ Supports JSON format
  • πŸ“ Creates both files and directories

Performance

Seed is built with performance in mind. Here's a quick look at our parser performance:

Parser Type Nodes Time/Operation Allocations/Operation Memory/Operation
ASCII Tree 100 ~3.7ms 46 ~14KB
ASCII Tree 1000 ~13.5ms 76 ~16KB
ASCII Tree 5000 ~76ms 654 ~54KB
JSON 100 ~3.8ms 46 ~14KB
JSON 1000 ~14.1ms 78 ~16KB
JSON 5000 ~79ms 697 ~56KB
  • Time and memory complexity are linear
  • For detailed benchmarks, methodology, and historical data, see the benchmark documentation.

Run benchmarks locally:

make benchmark:new        # Standard benchmarks
make benchmark:report     # Compare against last benchmarks

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Todo

  • Implement ability to parse from file path

  • Add JSON support

  • Benchmarks

  • man page (before heavy distro to linux)

  • Increase package manager distribution

  • Support StdIn

  • Add YAML support

  • flag to adjust spacing between 2 and 4 for people who write their own trees with just spaces

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Justin Wallace (@jpwallace22)

Acknowledgments

  • Inspired by the Unix tree command
  • Built with Cobra

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published