{"id":22981017,"url":"https://github.com/rubyworks/dotopts","last_synced_at":"2025-08-11T06:40:36.393Z","repository":{"id":6563338,"uuid":"7805203","full_name":"rubyworks/dotopts","owner":"rubyworks","description":"Command Line Options Configuration (for Ruby Tools)","archived":false,"fork":false,"pushed_at":"2013-02-16T19:06:41.000Z","size":308,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-27T14:47:03.020Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rubyworks.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-24T19:25:12.000Z","updated_at":"2016-06-14T19:35:39.000Z","dependencies_parsed_at":"2022-09-14T04:31:30.047Z","dependency_job_id":null,"html_url":"https://github.com/rubyworks/dotopts","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/rubyworks/dotopts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubyworks%2Fdotopts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubyworks%2Fdotopts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubyworks%2Fdotopts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubyworks%2Fdotopts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rubyworks","download_url":"https://codeload.github.com/rubyworks/dotopts/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubyworks%2Fdotopts/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269842893,"owners_count":24484107,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-15T01:46:44.893Z","updated_at":"2025-08-11T06:40:36.340Z","avatar_url":"https://github.com/rubyworks.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DotOpts\n\n**Automated Command-line Options (for Ruby Executables)**\n\n[Website](http://rubyworks.github.com/dotopts) /\n[Report Issue](http://github.com/rubyworks/dotopts/issues) /\n[Source Code](http://github.com/rubyworks/dotopts) /\n[![Build Status](https://secure.travis-ci.org/rubyworks/dotopts.png)](http://travis-ci.org/rubyworks/dotopts) /\n[![Gem Version](https://badge.fury.io/rb/dotopts.png)](http://badge.fury.io/rb/dotopts)\n\n## About\n\nDotOpts is an automatic command-line argument augmenter. It looks for a\nproject's local `.option` (or `.opts`) configuration file and applies the \nappropriate arguments when a matching command is invoked.\n\n\n## Features\n\n* Works with any and all Ruby-based executables.\n* Can be used to set environment variables in addition to arguments.\n* Supports environment variable substitution.\n* Supports conditional augmentation using environment settings.\n* Simple and easy to understand plain-text configuration format.\n\n\n## Install\n\nIf you are using an application that depends on DotOpts for configuration,\nthere is nothing you have to do. Installing the said application via\nRubyGems should also install DotOpts and require it as needed.\n\n### General Setup\n\nTo use DotOpts universally, even for command-line applications that do not\ndirectly utilize it, you can install DotOpts via RubyGems:\n\n    gem install dotopts\n\nThen add `-rdotopts` to your `RUBYOPT` environment variable.\n\n    export RUBYOPT=\"-rdotopts\"\n\nThis ensures DotOpts is used whenever Ruby is used.\n\n### Special Setup\n\nAnother approach is to use DotOpts per-project development project using\nvia Bundler, adding DotOpts to your project's Gemfile.\n\n    gem 'dotopts'\n\nThis will allow DotOpts to work whenever using `bundle exec` or Bundler\ncreated binstub.\n\n\n## Usage\n\n### Setting Arguments\n\nA simple example of a projects `.option` file:\n\n    yardoc\n    yard doc\n      --title=\"Bad Ass Program\"\n\nThis simply says, that whenever `yardoc` or `yard doc` is executed, and\nno other arguments are given, then add the `--title=\"Bad Ass Program\"`\nargument to the end of the command's arguments (internally `ARGV`).\n\n\n### Setting Environment Variables\n\nEnvironment variables can also be set by prepending first and subsequent\nlines with `$ `.\n\n    yardoc\n    yard doc\n      $ RUBYOPT=\"-rbadass\"\n      --title=\"Bad Ass Program\"\n\nThe space after the cash sign is important! Otherwise it will be interpreted \nas a variable substitution.\n\n\n### Conditional Profiles\n\nThe `.option` configuration file supports profiles via the square brackets.\nProfiles are chosen via the `$profile` or `$p` environment variable.\n\n```\n  [coverage]\n  rubytest\n    -r microtest\n```\n\nSo the above means that `-r micortest` should be added the argument list when\n`rubytest` is executed, but only if `$profile` or `$p` is equal to `\"coverage\"`.\n\nSquare brackets can also be used to match against any environment variable\nby using the `=` sign.\n\n```\n  [RUBY_ENGINE=jruby]\n  rake test\n    -r jruby-sandbox\n```\n\nTo condition a configuration on multiple environment settings, add each\nto the square brackets separated by a space. \n\n```\n  [coverage RUBY_ENGINE=jruby]\n  rubytest\n    -r jruby-sandbox\n    -r microtest\n```\n\nFinally, environment values can be matched against simple regular expressions\nusing a tilde (`~`) before the value. Be sure to put the value in quotes when\nusing regular expressions.\n\n```\n  [~\"cov(erage)?\" RUBY_ENGINE=~\"jruby|rubinius\"]\n  rubytest\n    -r jruby-sandbox\n    -r microtest\n```\n\n### Tool Support\n\nRuby tool developers can support DotOpts out-of-the-box simple by running\n`require 'dotopts'` in their program before parsing ARGV. DotOpts\nsimply injects arguments into `ARGV` so it can work with any command-line\noptions parser.\n\n\n## Development\n\n### Suggestions \u0026 Contributions\n\nDotOpts is a brand new application, and still rather wet behind the ears, so to\nspeak. So your input is critical to making it better. Any and all suggestions and\ncontributions are much appreciated. If you have any ideas on how to improve DotOpts,\nor find any flaws in its design that need address, please drop a comment on the\n[Issues](http://github.com/rubyworks/dotopts/issues) page. Or even better, be proactive!\nFork the project and submit a pull request. Thanks.\n\n### Universal Solution?\n\nIt would be awesome if it were possible to have DotOpts apply to *all* executables,\nnot just Ruby-based executables. But I do not know how this can be done for Bash, Zsh\nor any other shell. Of course, each scripting language could potentially have\nits own implementation of DotOpts, which would cover many more executables, but it\nwould still not cover all of them.\n\nIf you are a shell genius and have an epiphany on how it might be done, please \ndrop me a note via [Issues](http://github.com/rubyworks/dotopts/issues). I'd be more\nthan happy to code and maintain it.\n\n\n## Copyrights \u0026 Licensing\n\nDotOpts is copyrighted open-source software.\n\n*Copyright (c) 2013 Rubyworks. All rights reserved.*\n\nIt can be modified and redistributed in accordance with the [BSD-2-Clause](http://spdex.org/licenses/bsd-2-clause) license.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubyworks%2Fdotopts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frubyworks%2Fdotopts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubyworks%2Fdotopts/lists"}