modulepackage
0.0.0-20250113013423-db8d82a40784
Repository: https://github.com/will-wright-eng/parse.git
Documentation: pkg.go.dev
# README
Markdown File Generator CLI
A command-line tool that generates files and directory structures from markdown files. This tool allows you to define your project structure and file contents in a markdown file and automatically generates the corresponding files and directories.
Features
- š Generate files and directories from markdown specifications
- š Support for multiple markdown header formats
Installation
From Source
# Clone the repository
git clone https://github.com/will-wright-eng/parse
cd parse
# Initialize the project
make init
# Build the project
make build
# Optionally, install to your ~/.go/bin
make install
Prerequisites
- Go 1.21 or higher
- Make (for using the Makefile commands)
Usage
Basic Command
parse generate -i input.md -o output_dir
Available Flags
-i, --input
: Input markdown file (required)-o, --output
: Output directory (default: "./tmp")-f, --force
: Force overwrite existing files--strip-comments
: Strip comments from code blocks--skip
: Patterns of files to skip (e.g., ".tmp,.bak")
Markdown File Format
The tool supports multiple formats for specifying files in your markdown:
## path/to/file1.txt
```python
def hello():
print("Hello")
```
file: path/to/file2.js
```javascript
console.log('Hello');
```
path/to/file3.go
```go
package main
func main() {
println("Hello")
}
```
Project Structure
.
āāā Makefile # Build and development commands
āāā README.md # Project documentation
āāā cmd/ # Command-line interface
ā āāā generate.go # Generate command implementation
ā āāā root.go # Root command configuration
ā āāā version.go # Version command
āāā internal/ # Internal packages
ā āāā config/ # Configuration handling
ā āāā generator/ # File generation logic
ā āāā logger/ # Logging utilities
ā āāā parser/ # Markdown parsing
ā āāā version/ # Version information
āāā main.go # Application entry point
Development
Available Make Commands
Usage: make [command]
Commands:
help Display this help screen
init Project initialization
add-pkgs Add packages to go.mod
run Run the application
run-generate Run the generate command
watch Run the application with live reload
build Build the application
build-linux Build for Linux
build-darwin Build for macOS
build-windows Build for Windows
test Run tests
test-coverage Generate test coverage report
benchmark Run benchmarks
lint Run linters
fmt Format code
vet Run go vet
deps Install dependencies
deps-update Update dependencies
clean Clean build artifacts
install Install the application
uninstall Uninstall the application
envs Print environment variables
Example file format
config/settings.json
```json
{
"environment": "development",
"port": 3000,
"database": {
"host": "localhost",
"port": 5432
}
}
```
src/main.js
```javascript
console.log('Application starting...');
```
Running:
parse generate -i template.md -o myproject
Will create:
myproject/
āāā config/
ā āāā settings.json
āāā src/
āāā main.js
Built with ā¤ļø using Go
# Packages
cmd/generate.go.