flusgen 1.0.1
flusgen: ^1.0.1 copied to clipboard
A CLI tool for generating folder structures for Flutter projects
FlusGen #
flusgen is a tool that helps you automatically generate folder and file structures for Flutter projects using the MVVM (Model-View-ViewModel) architecture pattern or Other. With this tool, you can quickly create predefined folders and files, as well as perform operations such as creating custom folders/files, renaming them, and deleting them.
📌 Project Description #
This project is designed to simplify the setup of folder and file structures in Flutter projects. Using this tool, you can generate consistent folder and file structures following a specific architecture pattern (such as MVVM or Other). Additionally, you can customize the existing structure by adding, renaming, or deleting folders and files.
✨ Key Features #
- ✅ Generate Structure: Automatically create a default folder and file structure based on predefined templates.
- ✅ Create Custom Folder: Add custom folders after generating the default structure.
- ✅ Rename Folder: Rename folders within the project structure.
- ✅ Delete Folder: Remove folders from the project structure.
- ✅ Create Custom File: Add custom files after generating the default structure.
- ✅ Rename File: Rename files within the project structure.
- ✅ Delete File: Remove files from the project structure.
🚀 Installation #
1️⃣ Install FlusGen #
Run the following command in Command Prompt (CMD) to activate the package:
dart pub global activate flusgen
2️⃣ Configure PATH #
To run commands globally, add the following directory to your PATH environment variable:
C:\Users\myaasiinh\AppData\Local\Pub\Cache\bin
Steps to Add PATH on Windows
-
Open Environment Variables:
- Press
Win + Sand search for "Environment Variables". - Click Edit the system environment variables.
- In the System Properties window, click Environment Variables.
- Press
-
Add PATH:
- Under System Variables, find the variable named
Pathand click Edit. - Click New, then enter:
C:\Users\myaasiinh\AppData\Local\Pub\Cache\bin - Click OK to save changes.
- Under System Variables, find the variable named
-
Restart Terminal or IDE:
- Close the terminal (Command Prompt, PowerShell, or VS Code terminal) and reopen it to apply the configuration.
🛠 Available Commands #
🔹 1. Generate Default Structure #
Generates the default folder and file structure:
flusgen generate-structure
🔹 2. Create Custom Folder #
Creates a custom folder after the default structure (Replace <folderPath> with the desired folder path):
flusgen create-custom-folder <folderPath>
📌 Example:
flusgen create-custom-folder lib/features/authentication
🔹 3. Rename Folder #
Renames an existing folder:
flusgen rename-folder <oldPath> <newPath>
📌 Example:
flusgen rename-folder lib/features/authentication lib/features/login
🔹 4. Delete Folder #
Removes a folder from the project structure:
flusgen delete-folder <folderPath>
📌 Example:
flusgen delete-folder lib/features/login
🔹 5. Create Custom File #
Creates a custom file inside a specific folder:
flusgen create-custom-file <filePath> [content]
📌 Example:
flusgen create-custom-file lib/features/authentication/auth_service.dart
🔹 6. Rename File #
Renames a file within the project structure:
flusgen rename-file <oldPath> <newPath>
📌 Example:
flusgen rename-file lib/features/authentication/auth_service.dart lib/features/authentication/login_service.dart
🔹 7. Delete File #
Deletes a file from the project structure:
flusgen delete-file <filePath>
📌 Example:
flusgen delete-file lib/features/authentication/auth_service.dart
🔹 8. Generate Structure from a File #
Generates a folder and file structure based on a .txt file, allowing for customization without relying on built-in templates.
flusgen generate-structure-from-file <filePath>
📌 Example:
flusgen generate-structure-from-file structure.txt
📄 File Format (.txt)
lib/
core/
config/
main_app.dart
features/
authentication/
controller/
auth_controller.dart
widget/
login_button.dart
- Use
/to indicate folders. - Use indentation to define hierarchy.
- Empty lines are ignored.
🎯 Use Cases #
✅ 1. Generate Default Structure #
Create a default folder and file structure:
flusgen generate-structure
✅ 2. Create Custom Folder #
Add a custom folder to the generated structure:
flusgen create-custom-folder lib/features/authentication
✅ 3. Rename Folder #
Rename the authentication folder to login:
flusgen rename-folder lib/features/authentication lib/features/login
✅ 4. Delete Folder #
Remove an unnecessary folder:
flusgen delete-folder lib/features/login
✅ 5. Create Custom File #
Add a custom file to the project structure:
flusgen create-custom-file lib/features/authentication/auth_service.dart
✅ 6. Rename File #
Rename auth_service.dart to login_service.dart:
flusgen rename-file lib/features/authentication/auth_service.dart lib/features/authentication/login_service.dart
✅ 7. Delete File #
Remove an unused file:
flusgen delete-file lib/features/authentication/auth_service.dart
✅ 8. Generate Structure from a File #
Generate a custom folder and file structure from a .txt file:
flusgen generate-structure-from-file structure.txt
🤝 Contributing #
If you would like to contribute to this project, feel free to submit a pull request. Follow these steps:
- Fork this repository.
- Create a new branch for your changes.
- Make your changes and ensure your code runs properly.
- Submit a pull request to merge your changes.
📜 License #
This project is licensed under the MIT License.
🎉 Enjoy using flusgen! If you have any questions, feel free to ask! 🚀