Overview
What is Structure CLI?
In today’s fast-paced development environment, having a well-organized project structure is essential for efficiency and collaboration. This is where Structure CLI comes into play. It’s a powerful command-line tool designed to help developers generate a predefined directory structure and files based on a simple YAML configuration file. Whether you're setting up a new project or restructuring an existing one, Structure CLI makes it easy to manage your project files with just a few commands.
Key Features
- YAML-Based Configuration: Use a straightforward YAML file to define your project structure.
- Flexible Directory Creation: Create the project structure directly in the current directory or specify a root directory name.
- Easy to Use: Simply run the CLI with your desired flags and watch as the necessary directories and files are created automatically.
Prerequisites
Before getting started, ensure you have the following installed on your machine:
- Go (version 1.16 or later)
Installation
Setting up Structure CLI is a breeze. Follow these steps to get it up and running:
-
Clone the repository:
git clone git@github.com:johnretsas/structure.git cd structure
-
Build the binary:
go build -o structure
Usage
Once you have the CLI built, you can run it using the following command:
./structure [flags]
Available Flags
-
--here
Create the project structure directly in the current directory, bypassing the creation of a project root. -
--project-root <name>
Specify a name for the project root directory. This flag is required unless--here
is set. -
--structure <filename>
Define the YAML file that contains the project structure (default isstructure.yaml
).
Example Usage
-
Create a project structure in the current directory:
./structure --here
-
Create a project structure with a specified project root:
./structure --project-root my_project
Defining Your Project Structure
The YAML file plays a crucial role in defining the structure of your project. Here's a sample configuration to help you get started:
project:
main.go: file
pkg:
utils.go: file
helpers.go: file
cmd:
myapp.go: file
internal:
db:
connection.go: file
api:
handler.go: file
README.md: file
LICENSE: file
In this example:
- Each entry represents a file or directory.
- Directories are indicated by a colon at the end of the name, while files are listed without one.
Conclusion
The Structure CLI is a must-have tool for developers looking to streamline their project setup process. By leveraging the power of YAML, you can create, manage, and organize your project directories and files efficiently. Whether you're launching a new project or re-structuring an existing one, Structure CLI has you covered.
Contributing
Contributions are always welcome! If you have suggestions for new features or improvements, please submit a pull request or open an issue.
License
This project is licensed under the MIT License. For more details, refer to the LICENSE file.
With Structure CLI, managing your project structure becomes an effortless task, allowing you to focus more on what truly matters: writing great code!
🚀💻