Skip to content
@go-ruby-optparse

go-ruby-optparse

go-ruby-optparse

go-ruby-optparse

Ruby's OptionParser argv-parsing engine in pure Go — MRI-compatible, no cgo.

🌐 Website · 📚 Documentation

Docs License: BSD-3-Clause Go 1.26.4+ Coverage 100%


go-ruby-optparse is a pure-Go (no cgo) reimplementation of MRI's OptionParser argv-parsing engine — the interpreter-independent core that decides how an argument vector is matched against an option specification. It does the deterministic work: long, short, abbreviated and bundled options, the --[no-]opt negation form, type coercion, and the parse! / order! / permute! / getopts dispatch modes, with MRI's full error taxonomy (ambiguous, missing argument, invalid option, …). The per-option callbacks stay in the host, where the interpreter lives. It was extracted from rbgo's prelude/internals into a reusable standalone library: no dependency on the Ruby runtime, the dependency runs the other way. It is the OptionParser backend for go-embedded-ruby, bound by rbgo as a native module just like go-ruby-regexp and go-ruby-erb — differential-tested against MRI, 100% coverage, CI green across 6 arches and 3 OSes.

Repositories

Repo What it is
optparse the library: Ruby's OptionParser in pure Go
docs MkDocs Material documentation, versioned with mike, served at /docs/
go-ruby-optparse.github.io the Hugo landing page
brand logos and brand assets

Principles

  • Pure Go, zero cgo. Cross-compiles and embeds anywhere; a static binary by default.
  • Extracted from rbgo, reusable by anyone. A standalone library lifted from rbgo's prelude/internals; rbgo binds it as a native module, the same pattern as go-ruby-regexp and go-ruby-erb.
  • MRI byte-exact. Output matches reference Ruby exactly, validated by a differential oracle against the ruby binary.
  • Standalone & reusable. No dependency on the Ruby runtime; the dependency runs the other way.
  • 100% test coverage is the target, enforced as a CI gate.

Status

Complete — MRI byte-exact. Faithful port of MRI's lib/optparse.rb matching engine: long / short / abbreviated / bundled options, the --[no-]opt form, type coercion, the parse! / order! / permute! / getopts modes, and the full error taxonomy. The per-option callbacks stay in the host. Validated by a differential oracle against the system ruby — residual argv and error classes compared — at 100% coverage, gofmt + go vet clean, CI green across the six 64-bit Go targets and three OSes. Differential-tested against MRI at 100% coverage, gofmt + go vet clean, CI green across the six 64-bit Go targets (amd64, arm64, riscv64, loong64, ppc64le, s390x) and three operating systems. It is bound into the go-embedded-ruby (rbgo) ecosystem as a native module.

BSD-3-Clause.

Popular repositories Loading

  1. optparse optparse Public

    Pure-Go MRI-compatible Ruby optparse, CGO=0 — bound by go-embedded-ruby/rbgo

    Go

  2. docs docs Public

    Documentation for go-ruby-optparse

  3. brand brand Public

    Brand assets for go-ruby-optparse

  4. go-ruby-optparse.github.io go-ruby-optparse.github.io Public

    Landing page for go-ruby-optparse

    HTML

  5. .github .github Public

    Org profile for go-ruby-optparse

Repositories

Showing 5 of 5 repositories

People

This organization has no public members. You must be a member to see who’s a part of this organization.

Top languages

Loading…

Most used topics

Loading…