Skip to content

Meldiron/odyc-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Odyc CLI

Go Format Check Go Lint Check Go Tests Go Version License

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.

Cover

✨ Features

  • 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

πŸš€ Quick Start

Prerequisites

  • Go 1.24 or higher
  • PNG sprite images (for sprite generation)

Installation

Using Go Install

go install github.com/meldiron/odyc-cli@latest

Basic Usage

# Show help
odyc-cli
odyc-cli --help

πŸ“‹ Commands

sprites

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..
        `
    }
};

πŸ—οΈ Architecture

Project Structure

odyc-cli/
β”œβ”€β”€ cmd/                  # Commands implementation
β”œβ”€β”€ .github/              # GitHub Actions workflows
└── main.go               # Application entrypoint

Architecture Overview

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

πŸ› οΈ Development

Prerequisites for Contributors

  • Go 1.24 or higher
  • golangci-lint (for linting)
  • Git

Getting Started

  1. Fork and Clone

    git clone https://github.com/YOUR_USERNAME/odyc-cli.git
    cd odyc-cli
  2. Install Dependencies

    go mod download
  3. Build and Run

    go build -o odyc-cli .
    ./odyc-cli --help

Running Tests

# Build binary
go build -o odyc-cli .

# Run all tests
go test ./...

Code Formatting

We use go fmt to ensure consistent code formatting.

# Format all Go files
go fmt ./...

Code Linter

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

Continuous Integration

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 and develop branches

🀝 Contributing

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

πŸ“œ Code of Conduct

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.

πŸ“„ License

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

πŸ™ Acknowledgments

Core Dependencies

πŸ“ž Support

If you encounter any issues or have questions:

  1. Check the Issues page
  2. Create a new issue if your problem isn't already reported
  3. Follow the issue template to provide necessary details

Made with ❀️ for the Odyc.js community

About

Odyc.js CLI tool for managing sprites, and more.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Languages