A powerful CLI tool with handy commands for Odyc.js developers. Generate code from sprites and perform various development tasks to make your life with Odyc.js easier.
- Sprite Code Generation: Convert PNG sprite images into JavaScript configuration files
- Color Palette Analysis: Automatically extract and optimize color palettes from sprites
- Multi-sprite Support: Process multiple PNG files in a single command
- Smart Color Indexing: Efficient color mapping with support for up to 62 unique colors
- Flexible Output: Generate JavaScript configuration files with customizable paths
- Developer-friendly: Beautiful terminal output with colored logging and progress indicators
- Go 1.24 or higher
- PNG sprite images (for sprite generation)
go install github.com/meldiron/odyc-cli@latest
# Show help
odyc-cli
odyc-cli --help
Generate JavaScript configuration from sprite PNG files.
odyc-cli sprites [OPTIONS]
Options:
-a, --assets <path>
- Path to assets directory containing PNG files (required)-o, --output <path>
- Path to output JavaScript file (required)-f, --force
- Overwrite output file if it exists-h, --help
- Show help for sprites command
Example:
odyc-cli sprites --assets ./game-sprites --output ./src/gameConfig.js --force
Generated Output:
var gameConfig = {
cellWidth: 6,
cellHeight: 5,
colors: [
"#ff0000ff",
"#00ff00ff",
"#0000ffff"
],
sprites: {
"player": `
..12..
.1221.
122221
.1221.
..12..
`,
"enemy": `
..13..
.1331.
133331
.1331.
..13..
`
}
};
odyc-cli/
βββ cmd/ # Commands implementation
βββ .github/ # GitHub Actions workflows
βββ main.go # Application entrypoint
The CLI is built using the Cobra framework for command-line interface management and charmbracelet/log for beautiful terminal logging.
Core Components:
- Main Entry Point (
main.go
): Sets up logging styles and executes commands - Root Command (
cmd/root.go
): Defines the base CLI structure and help information - Commands (
cmd/*.go
): All available commands
- Go 1.24 or higher
- golangci-lint (for linting)
- Git
-
Fork and Clone
git clone https://github.com/YOUR_USERNAME/odyc-cli.git cd odyc-cli
-
Install Dependencies
go mod download
-
Build and Run
go build -o odyc-cli . ./odyc-cli --help
# Build binary
go build -o odyc-cli .
# Run all tests
go test ./...
We use go fmt
to ensure consistent code formatting.
# Format all Go files
go fmt ./...
We use golangci-lint
for comprehensive code linting.
# Install golangci-lint (if not already installed)
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
# Run linter
golangci-lint run
Our CI/CD pipeline includes:
- Format Check: Ensures all Go code is properly formatted with
go fmt
- Lint Check: Runs
golangci-lint
to catch potential issues and enforce coding standards - Automated Testing: Runs on every push and pull request to
main
anddevelop
branches
We welcome contributions! Please see our Contributing Guide for details on how to:
- Report bugs and request features
- Submit pull requests
- Follow our coding standards
- Set up your development environment
This project adheres to a Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to the project maintainers.
This project is licensed under the MIT License - see the LICENSE file for details.
- Go - The programming language used to build CLI tool
- Cobra - Powerful CLI framework for Go
- Charmbracelet Log - Beautiful structured logging
- Charmbracelet Lipgloss - Style definitions for terminal UIs
- Testify - Testing toolkit with assertions and mocks
- golangci-lint - Comprehensive Go linter
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue if your problem isn't already reported
- Follow the issue template to provide necessary details
Made with β€οΈ for the Odyc.js community