Compare commits

...

44 Commits

Author SHA1 Message Date
Tristan Ancelet 777a1b992a Had to fix block.call to yield so that the compiler could be happy 2026-08-17 09:25:42 -05:00
tristan a17053f45c Added a specs for flag & arg. As well as changed a few ways I as handling cli args and determining how they're to be passed to each flag 2026-08-16 17:19:10 -05:00
Tristan Ancelet 6535753fa3 Had to fix some things in coerce 2026-08-14 15:55:28 -05:00
Tristan Ancelet 09389cb5e9 Added differnt check for default. Set it to empty string as a way of determining if a default was set. Ignoring empty strings 2026-08-14 15:01:04 -05:00
Tristan Ancelet d1746602b1 modified the way that the FlagMeta default string gets generated based on Array vs LITERALLY anything else 2026-08-14 14:57:05 -05:00
Tristan Ancelet 21462029e3 Fixed template 2026-08-14 14:34:10 -05:00
Tristan Ancelet 4a0dcb8b59 Had to fix expression to show type as {{...}} isn't expanded in macro expression betweeh {% ... %} 2026-08-14 14:19:38 -05:00
Tristan Ancelet 8780be3a42 Removed 'long' from macro expression 2026-08-14 14:18:02 -05:00
Tristan Ancelet fd510469ac Added allow_no_verification for users to bypass the 'must have options or validation' check. However, not doing so can cause unexpected failures where flags will begin consuming preceeding arguments 2026-08-14 14:14:53 -05:00
Tristan Ancelet f55cc25f2d Modified Command.argument to let the user provide a method call for runtime learning of options value. This will let the compiler check at compile time 2026-08-14 14:10:25 -05:00
Tristan Ancelet b05f49c2e8 Fixed something maybe 2026-08-14 14:00:31 -05:00
Tristan Ancelet d3ca70ea9e Added options for array checking of base types Strings/Int32/etc 2026-08-14 13:55:10 -05:00
Tristan Ancelet 697a0db3af Added debug message to print out a missing match + the format being matched 2026-08-12 16:34:16 -05:00
Tristan Ancelet a1a9c6fc04 Added format filter to enforce formatting on array objects 2026-08-12 16:26:35 -05:00
Tristan Ancelet ffde5165f7 Added format support for filtering arguments 2026-08-12 16:12:59 -05:00
Tristan Ancelet 53f510278c added thing 2026-08-12 13:12:09 -05:00
Tristan Ancelet e6d9306e69 Added exit & default to help if no main is specified 2026-08-12 13:10:30 -05:00
Tristan Ancelet 18c5a559b1 Added exit & default to help if no main is specified 2026-08-12 13:08:24 -05:00
Tristan Ancelet 28c45fae9e Added guard for empty @flags array in template 2026-08-12 13:01:41 -05:00
Tristan Ancelet f889aae5e1 added dynamic resizing of description for flag & the like 2026-08-12 12:56:59 -05:00
Tristan Ancelet e90d89689c Increased default spacing in commands and flags 2026-08-12 12:50:42 -05:00
Tristan Ancelet 9b3d823bc7 Comitting for testing 2026-08-12 12:43:44 -05:00
Tristan Ancelet d02eded273 Trying again 2026-08-12 12:40:08 -05:00
Tristan Ancelet fc592fee37 Trying again 2026-08-12 12:38:55 -05:00
Tristan Ancelet 47b4bfa494 had to fix syntax 2026-08-12 12:37:28 -05:00
Tristan Ancelet 1a2da86048 Allowed delim in macros 2026-08-12 12:36:23 -05:00
Tristan Ancelet 37c5083ae2 added def_init 2026-08-12 11:59:49 -05:00
Tristan Ancelet 976ed10f75 Added def_getter 2026-08-12 11:00:56 -05:00
Tristan Ancelet ea8ca62a63 Added StringIterpolation 2026-08-12 10:55:22 -05:00
Tristan Ancelet 0c7849dc7c Added options 2026-08-11 12:24:30 -05:00
Tristan Ancelet 47df89a6c1 Had to fix the selection macro. Was part of the way throught and skipped finishing it 2026-08-11 11:58:04 -05:00
Tristan Ancelet afd7ba7c7b Added options to Command.argument macro 2026-08-11 11:53:38 -05:00
Tristan Ancelet 8447a1ffbb Added prerun command annotation & implementation 2026-08-11 11:37:22 -05:00
Tristan Ancelet 4af08f8efe had to fix again 2026-08-11 11:24:22 -05:00
Tristan Ancelet 1085335c88 Had to add for lib setup 2026-08-11 11:22:02 -05:00
Tristan Ancelet 19ea00ef72 added a few things 2026-08-11 11:17:34 -05:00
tristan 8d17de7434 Fix annotation key mismatch: validate -> validation in generate.cr
anno[:validate] was always nil; validation procs were never wired
into Flag(T).new. Correct key is :validation to match the field
name set by the argument macro in command/argument.cr.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ATnpoEGXj4RyuMoBLGWcjs
2026-08-10 13:12:12 -05:00
Tristan Ancelet 405303e4f8 updated .gitignor 2026-08-10 13:00:23 -05:00
Tristan Ancelet 29327a3e83 Got Array(T) working in flag.cr. Hacky stuff it is to convince the compiler that a value isn't going to be nil if I set it 2026-08-10 12:57:31 -05:00
tristan ac5711c0df Update .claude/settings.json with project permission allowlist
Allows crystal build/spec/run, shards, git read/write, and ls
without per-call prompts — consistent across machines.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ATnpoEGXj4RyuMoBLGWcjs
2026-08-10 08:02:58 -05:00
tristan 519c8dcd44 Remove test binary and test.cr
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ATnpoEGXj4RyuMoBLGWcjs
2026-08-10 07:59:02 -05:00
tristan bc0f56fda9 Add .claude/, .gitignore, and update README
- .claude/settings.json: project-level Claude Code config
- .gitignore: ignores test binary, build artifacts, shards cache, tags
- README.md: expanded with usage example, dev commands, and AI assistance
  disclosure (Claude used for review/bug-checking, not code generation)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ATnpoEGXj4RyuMoBLGWcjs
2026-08-10 07:58:15 -05:00
tristan 6f31a5d27c object_rework: working MVP with runtime CommandNode tree
- BaseCommandNode (abstract) / CommandNode(T) split for heterogeneous tree
- Flag(T) with compile-time type branching, Parsable/Coercable modules
- Arg double-process invariant enforcement
- App.generate macro builds CommandNode tree from Command subclasses
- Command#initialize generated via macro finished, populates ivars from handler
- Reserved -h/--help enforcement in Flag#check!
- MatchType::Help added, SubCommand dispatch fixed
- design.adoc: added Planned Features (markdown docs, bash completion)
- Makefile: tabs, .DEFAULT_GOAL, doc_show target

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-08-09 22:49:55 -05:00
tristan f5571cde73 Committing before test 2026-08-09 15:20:06 -05:00
56 changed files with 10307 additions and 458 deletions
+20
View File
@@ -0,0 +1,20 @@
{
"permissions": {
"allow": [
"Bash(crystal build*)",
"Bash(crystal spec*)",
"Bash(crystal run*)",
"Bash(shards install*)",
"Bash(shards update*)",
"Bash(git status*)",
"Bash(git diff*)",
"Bash(git log*)",
"Bash(git add*)",
"Bash(git commit*)",
"Bash(git push*)",
"Bash(git rm*)",
"Bash(rm -f test)",
"Bash(ls*)"
]
}
}
+9
View File
@@ -0,0 +1,9 @@
root = true
[*.cr]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
+13
View File
@@ -0,0 +1,13 @@
*
!CLAUDE.md
!lib/
!lib/cligen
!src/
!src/**
!shard.yml
!README.md
!design.adoc
!docs/
!docs/**
!Makefile
!LICENSE
+76
View File
@@ -0,0 +1,76 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Commands
```bash
# Run all specs
crystal spec
# Run a single spec file
crystal spec spec/command_spec.cr
# Type-check without running
crystal build src/cligen.cr --no-codegen
# Install dependencies
shards install
```
## What This Is
`cligen` is a Crystal **shard (library)** — not a standalone application. It wraps Crystal's built-in `OptionParser` with an annotation- and macro-driven system that auto-generates CLI parsers from class definitions. Users of the shard subclass `CliGen::Command` and annotate methods; the library generates the `OptionParser` wiring at compile time via Crystal macros.
## Architecture
### Entry point: `src/cligen.cr`
Defines the `CliGen` module. The `macro finished` hook calls `define_root_parser`, which scans all `CliGen::Command` subclasses at compile time and registers each as a subcommand on the root `OptionParser`. `CliGen.parse` runs the root parser.
`ADDITIONAL_DEFAULT_FLAGS` / `add_default_flag` let users inject extra flags into every parser (root and subcommand).
### Command definition: `src/cligen/command.cr`
`CliGen::Command` is the base class. When subclassed, `macro inherited` installs a `macro finished` block that triggers four code-generation macros in order:
1. `define_actions` — collects all `@[SubCommand]`-annotated class methods into `ACTIONS : Array(String)` and `@@action : String`.
2. `define_header` — builds the `HEADER` string (banner + examples) from `@[SubCommand]` and `@[CommandSelection]` annotation metadata.
3. `define_runner` (skipped if `@[CommandInfo(def_runner: false)]`) — generates a `self.run` method that dispatches on `@@action` or a selection variable via a `case` statement.
4. `define_action_setter` — generates `self.action=` with bounds-checking against `ACTIONS`.
#### Key macros on `Command`
- **`define_argument`** — declares a class-level variable (`@@`) and an annotated setter method (`@[CommandArgument]`). Handles `String`, `Bool`, `Int32`, `Array(String|Int32)`, and `Time`. Optional `check:` proc, `logger:` method, and `def_getter:` flag.
- **`define_selection`** — like `define_argument` but validates against a fixed list of values; annotated with `@[CommandArgument]` and participates in selection-based dispatch.
### Parser generation: `src/cligen/command/parser.cr`
`CliGen::Parser` is `extend`ed by `Command`. It provides `define_parser`, which generates `self.make_parser(parent_parser)`. That method:
1. Creates a subparser `OptionParser` with the command's `HEADER` as banner.
2. Wires `@[CommandSelection]`-annotated methods as `parser.on(name, description)` that set the selection variable.
3. Wires `@[SubCommand]`-annotated methods as subcommand strings that set `@@action`.
4. Wires `@[CommandArgument]`-annotated methods as `parser.on(short, long, description)` flag handlers.
5. Calls `CliGen.define_default_flags` (adds `-h`/`--help`, error handlers).
6. Registers the whole subparser on `parent_parser` under the command's lowercase class name.
### Annotations
| Annotation | Applied to | Purpose |
|---|---|---|
| `@[CommandInfo(description:, def_runner:)]` | Command subclass | Required; provides the description shown in root help; `def_runner: false` skips auto-generating `run` |
| `@[SubCommand(description:, examples:)]` | class method on Command | Marks a method as a dispatachable subcommand |
| `@[CommandArgument(short:, long:, description:, type:)]` | class method on Command | Generated automatically by `define_argument`/`define_selection`; drives parser wiring |
| `@[CommandSelection(selector:, description:, examples:)]` | class method on Command | Alternative to `SubCommand`; dispatches via a named selector variable instead of `@@action` |
| `@[CommandPreRun]` | class method on Command | Methods run unconditionally before dispatch inside `self.run` |
| `@[DefaultFlag]` | (reserved) | Defined but not currently used in generation |
### Supporting files
- `src/cligen/format.cr` — date/datetime format strings used by `Time` argument parsing.
- `src/cligen/regex.cr` — regexes for validating date/datetime input strings.
## Spec structure
`spec/command_spec.cr` uses Crystal's macro system heavily: most `it` blocks are generated at compile time by inspecting `CommandSubclass` via `@type` introspection. The `macro finished` wrapper around the entire `describe` block is required because `make_parser` and `run` don't exist until all `macro finished` hooks have fired.
+22
View File
@@ -0,0 +1,22 @@
DOC_DIR := docs
PROJECT_NAME := CliGenerator
.DEFAULT_GOAL := spec
.PHONY: spec spec_silent doc doc_show
.SILENT: spec spec_silent doc doc_show
.DEFAULT:
@echo "BRUV "$@" isn't a valid target"
spec:
crystal spec -v
spec_silent:
crystal spec
doc:
crystal doc --project-name "$(PROJECT_NAME)" --output "$(DOC_DIR)"
echo "Done Generating docs"
doc_show:
cd "$(DOC_DIR)"; python -m http.server
+42 -3
View File
@@ -1,6 +1,10 @@
# CliGenerator # cligen
This is a crystal project to manage setting up OptionParser objects based around "Command" objects and arguments you define inside them. A Crystal shard that generates CLI parsers from class definitions using annotations and macros. Define your commands as classes; cligen builds the runtime parse tree.
## How It Works
Subclass `CliGen::Command`, annotate your instance variables with `@[CliGen::Argument]` or `@[CliGen::Selection]`, and register the command with an `CliGen::App`. At compile time, macros inspect the annotations and generate typed `Flag(T)` objects; at runtime, `CliGen::App.process` walks the `CommandNode` tree to route arguments, populate your command instance, and dispatch to the right method.
## Installation ## Installation
@@ -14,12 +18,47 @@ This is a crystal project to manage setting up OptionParser objects based around
2. Run `shards install` 2. Run `shards install`
## Usage ## Usage
```crystal ```crystal
require "cligen" require "cligen"
@[CliGen::CommandInfo(description: "Greet someone")]
class Greet < CliGen::Command
@[CliGen::Argument(short: "-n", long: "--name VALUE", description: "Name to greet")]
@name : String = "world"
def main
puts "Hello, #{@name}!"
end
end
CliGen::App.process
``` ```
```
$ myapp --name Alice
Hello, Alice!
```
Full API documentation and design notes are in [`design.adoc`](design.adoc).
## Development
```bash
# Type-check without running
crystal build src/cligen.cr --no-codegen
# Run specs
crystal spec
```
## AI Assistance Disclosure
This project uses [Claude Code](https://claude.ai/code) as a development aid — specifically for catching bugs, spotting typos, reviewing implementations, and talking through design decisions. All architecture decisions, code, and design are written by the author. Claude is used the way one might use a second pair of eyes on a diff, not as a code generator.
`CLAUDE.md` at the repo root documents the project structure for Claude's context. `.claude/` holds project-level Claude Code settings.
## Contributors ## Contributors
- [Tristan Ancelet](https://git.arcanium.tech/tristan) - creator and maintainer - [Tristan Ancelet](https://git.arcanium.tech/tristan) - creator and maintainer
+141
View File
@@ -0,0 +1,141 @@
= Crytal Cli Generator
:author: Tristan Anclelet
:email: tristanancelet@yahoo.com
:toc:
This document outlines the overall design of the CliGen shard & it's underlying classes/objects & their usecases.
== Architecture
The desire for this project is to provide a framework for generating commandline arg-parses & command dispatch built into a class/object.
The idea is to (much like `JSON::Serializable` & `YAML::Serializable`) is to use macros to help defining a Command object and abstract the command-line away from the codebase needing input from the user at init time.
=== Command Objects
The core of this codebase is the `CliGen::Command` object.
This is the object that is meant to provide you the hook into being able to utilize the codebase. It is where you are able to define all of your expecetd arguments/flags & any selectables (aka, instance variable that you want the user to choose one value for. `ex: -f|--format json|yaml|ecr`).
To make this all possible we load the base class with macros that help define your variables & inform the framework how it needs to handle arguments being presented to your command object setters.
[source,crystal]
----
require "cligen"
module MyModule
class MyCommand < CliGen::Command
argument(myvar : Int32 = 23,
long: "--myvar VAR",
short: "-m",
description: "This tells the utility how many times to do thing",
validate: ->(v : Int32) : Bool { (1..23).includes?(v) }
)
selection(output_format : String = "ecr",
long: "--format FORMAT",
short: "-f",
description: "Inform the utility what output you want the data in",
options: %w[ json yaml ecr ]
)
DO_THING_EXAMPLES = [
"myutil mycommand do_thing --myvar 5"
]
subcommand do_thing, description: "Do the THING", examples: MyModule::MyCommand::DO_THING_EXAMPLES do
output = 0
@myvar.times do |i|
puts "thing done %i times" % [ i + 1 ]
output += i
end
puts "Total : %i" % output
end
end
CliGen::App.process
end
----
The examples like above provide a "DSL-esk" way of defining:
- Instance Variables,
- Short/Long flags
- Description of the flags (used in the help output as well)
- A verification proc/lambda for doing ad-hoc checks of the value provided by the user (essentially allowing you to implement your own option: key like in selection)
- Selections (currently compile-time and will open it up to runtime collecting of options later on based on defined annotations in the class)
- define subcommands of this current command
==== How it works
Using crystal macros, you define the shape (arguments/flags, selections, work functions/subcommands, etc
== Planned Features
=== Markdown Documentation Generation
Since all command metadata is present in annotations at compile time (`@[CliGen::CommandInfo]`, `@[CliGen::SubCommand]`, `@[CliGen::Argument]`, `@[CliGen::Selection]`), the framework can walk the same structures that `generate.cr` already walks and render them into a Markdown document instead of a `CommandNode` tree.
The generation would be driven by a `macro finished` block (similar to `generate.cr`) that emits a `self.generate_docs` class method on `App`. This method walks every `Command` subclass and its annotations to produce a structured document.
Proposed output structure:
----
# <AppName>
## Commands
### mycommand
<CommandInfo description>
#### Flags
| Flag | Short | Type | Default | Description |
|------|-------|------|---------|-------------|
| --myvar VAR | -m | Int32 | 23 | ... |
#### Subcommands
- `do_thing` — <description>
- Examples: ...
----
Implementation notes:
* Driven by a `--generate-docs` global flag or a dedicated class method
* ECR templates (already pulled in) are the natural rendering mechanism
* The same annotation data powers both runtime help output and the doc generator, keeping them in sync automatically
=== Bash Autocompletion Generation
Since all command names and flag names are known at compile time, a complete bash completion script can be generated statically — no runtime `--completions` endpoint needed.
The approach is a hidden `--generate-completion bash` flag (potentially extended to `zsh`/`fish` later) that prints a ready-to-install completion script to stdout.
Proposed completion script shape:
[source,bash]
----
_myapp() {
local cur="${COMP_WORDS[COMP_CWORD]}"
local prev="${COMP_WORDS[COMP_CWORD-1]}"
case "${COMP_WORDS[1]}" in
mycommand)
COMPREPLY=($(compgen -W "--myvar -m --format -f" -- "$cur"))
;;
*)
COMPREPLY=($(compgen -W "mycommand myothercommand" -- "$cur"))
;;
esac
}
complete -F _myapp myapp
----
Implementation notes:
* Script body generated at compile time via a `macro finished` walk of `Command.subclasses`
* `@[CliGen::Selection]` options (`%w[json yaml ecr]`) can be included as valid completions for their flag
* Install path: `myapp --generate-completion bash > ~/.bash_completion.d/myapp` or printed with instructions
* Same annotation data used by the doc generator, so both stay in sync with the command definition
+177
View File
@@ -0,0 +1,177 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Crystal Docs 1.20.3">
<meta name="crystal_docs.project_version" content="object_rework-dev">
<meta name="crystal_docs.project_name" content="CliGenerator">
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/doc.js"></script>
<meta name="repository-name" content="CliGenerator">
<title>CliGenerator object_rework-dev</title>
<script type="text/javascript">
CrystalDocs.base_path = "";
</script>
</head>
<body>
<svg class="hidden">
<symbol id="octicon-link" viewBox="0 0 16 16">
<path fill="currentColor" fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path>
</symbol>
</svg>
<input type="checkbox" id="sidebar-btn">
<label for="sidebar-btn" id="sidebar-btn-label">
<svg class="open" xmlns="http://www.w3.org/2000/svg" height="2em" width="2em" viewBox="0 0 512 512"><title>Open Sidebar</title><path fill="currentColor" d="M80 96v64h352V96H80zm0 112v64h352v-64H80zm0 112v64h352v-64H80z"></path></svg>
<svg class="close" xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" viewBox="0 0 512 512"><title>Close Sidebar</title><path fill="currentColor" d="m118.6 73.4-45.2 45.2L210.7 256 73.4 393.4l45.2 45.2L256 301.3l137.4 137.3 45.2-45.2L301.3 256l137.3-137.4-45.2-45.2L256 210.7Z"></path></svg>
</label>
<div class="sidebar">
<div class="sidebar-header">
<div class="search-box">
<input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search">
</div>
<div class="project-summary">
<h1 class="project-name">
<a href="index.html">
CliGenerator
</a>
</h1>
<span class="project-version">
object_rework-dev
</span>
</div>
</div>
<div class="search-results hidden">
<ul class="search-list"></ul>
</div>
<div class="types-list">
<ul>
<li class="parent " data-id="CliGenerator/CliGen" data-name="cligen">
<a href="CliGen.html">CliGen</a>
<ul>
<li class=" " data-id="CliGenerator/CliGen/AdditionalDefaultFlag" data-name="cligen::additionaldefaultflag">
<a href="CliGen/AdditionalDefaultFlag.html">AdditionalDefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/App" data-name="cligen::app">
<a href="CliGen/App.html">App</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Arg" data-name="cligen::arg">
<a href="CliGen/Arg.html">Arg</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Argument" data-name="cligen::argument">
<a href="CliGen/Argument.html">Argument</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/BaseFlag" data-name="cligen::baseflag">
<a href="CliGen/BaseFlag.html">BaseFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Command" data-name="cligen::command">
<a href="CliGen/Command.html">Command</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandInfo" data-name="cligen::commandinfo">
<a href="CliGen/CommandInfo.html">CommandInfo</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandNode" data-name="cligen::commandnode">
<a href="CliGen/CommandNode.html">CommandNode</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/DefaultFlag" data-name="cligen::defaultflag">
<a href="CliGen/DefaultFlag.html">DefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Flag" data-name="cligen::flag(t)">
<a href="CliGen/Flag.html">Flag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Format" data-name="cligen::format">
<a href="CliGen/Format.html">Format</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/MatchType" data-name="cligen::matchtype">
<a href="CliGen/MatchType.html">MatchType</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/ProxyCommand" data-name="cligen::proxycommand">
<a href="CliGen/ProxyCommand.html">ProxyCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Regex" data-name="cligen::regex">
<a href="CliGen/Regex.html">Regex</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Selection" data-name="cligen::selection">
<a href="CliGen/Selection.html">Selection</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/SubCommand" data-name="cligen::subcommand">
<a href="CliGen/SubCommand.html">SubCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Trigger" data-name="cligen::trigger">
<a href="CliGen/Trigger.html">Trigger</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="main-content">
<h1 class="type-name">
404 Not Found
</h1>
<p>
This page is unavailable in this version of the API docs.
</p>
<p>
You can use the sidebar to search for your page, or try a different
Crystal version.
</p>
</div>
</body>
</html>
+363
View File
@@ -0,0 +1,363 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Crystal Docs 1.20.3">
<meta name="crystal_docs.project_version" content="object_rework-dev">
<meta name="crystal_docs.project_name" content="CliGenerator">
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/doc.js"></script>
<meta name="repository-name" content="CliGenerator">
<title>CliGen - CliGenerator object_rework-dev</title>
<script type="text/javascript">
CrystalDocs.base_path = "";
</script>
</head>
<body>
<svg class="hidden">
<symbol id="octicon-link" viewBox="0 0 16 16">
<path fill="currentColor" fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path>
</symbol>
</svg>
<input type="checkbox" id="sidebar-btn">
<label for="sidebar-btn" id="sidebar-btn-label">
<svg class="open" xmlns="http://www.w3.org/2000/svg" height="2em" width="2em" viewBox="0 0 512 512"><title>Open Sidebar</title><path fill="currentColor" d="M80 96v64h352V96H80zm0 112v64h352v-64H80zm0 112v64h352v-64H80z"></path></svg>
<svg class="close" xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" viewBox="0 0 512 512"><title>Close Sidebar</title><path fill="currentColor" d="m118.6 73.4-45.2 45.2L210.7 256 73.4 393.4l45.2 45.2L256 301.3l137.4 137.3 45.2-45.2L301.3 256l137.3-137.4-45.2-45.2L256 210.7Z"></path></svg>
</label>
<div class="sidebar">
<div class="sidebar-header">
<div class="search-box">
<input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search">
</div>
<div class="project-summary">
<h1 class="project-name">
<a href="index.html">
CliGenerator
</a>
</h1>
<span class="project-version">
object_rework-dev
</span>
</div>
</div>
<div class="search-results hidden">
<ul class="search-list"></ul>
</div>
<div class="types-list">
<ul>
<li class="parent open current" data-id="CliGenerator/CliGen" data-name="cligen">
<a href="CliGen.html">CliGen</a>
<ul>
<li class=" " data-id="CliGenerator/CliGen/AdditionalDefaultFlag" data-name="cligen::additionaldefaultflag">
<a href="CliGen/AdditionalDefaultFlag.html">AdditionalDefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/App" data-name="cligen::app">
<a href="CliGen/App.html">App</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Arg" data-name="cligen::arg">
<a href="CliGen/Arg.html">Arg</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Argument" data-name="cligen::argument">
<a href="CliGen/Argument.html">Argument</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/BaseFlag" data-name="cligen::baseflag">
<a href="CliGen/BaseFlag.html">BaseFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Command" data-name="cligen::command">
<a href="CliGen/Command.html">Command</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandInfo" data-name="cligen::commandinfo">
<a href="CliGen/CommandInfo.html">CommandInfo</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandNode" data-name="cligen::commandnode">
<a href="CliGen/CommandNode.html">CommandNode</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/DefaultFlag" data-name="cligen::defaultflag">
<a href="CliGen/DefaultFlag.html">DefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Flag" data-name="cligen::flag(t)">
<a href="CliGen/Flag.html">Flag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Format" data-name="cligen::format">
<a href="CliGen/Format.html">Format</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/MatchType" data-name="cligen::matchtype">
<a href="CliGen/MatchType.html">MatchType</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/ProxyCommand" data-name="cligen::proxycommand">
<a href="CliGen/ProxyCommand.html">ProxyCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Regex" data-name="cligen::regex">
<a href="CliGen/Regex.html">Regex</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Selection" data-name="cligen::selection">
<a href="CliGen/Selection.html">Selection</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/SubCommand" data-name="cligen::subcommand">
<a href="CliGen/SubCommand.html">SubCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Trigger" data-name="cligen::trigger">
<a href="CliGen/Trigger.html">Trigger</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="main-content">
<h1 class="type-name">
<span class="kind">
module
</span> CliGen
</h1>
<h2>
<a id="defined-in" class="anchor" href="#defined-in">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Defined in:
</h2>
cligen.cr
<br/>
cligen/annotations.cr
<br/>
cligen/app.cr
<br/>
cligen/arg.cr
<br/>
cligen/command.cr
<br/>
cligen/command/argument.cr
<br/>
cligen/command/selection.cr
<br/>
cligen/command/subcommand.cr
<br/>
cligen/command/trigger.cr
<br/>
cligen/command_node.cr
<br/>
cligen/flag.cr
<br/>
cligen/generate.cr
<br/>
cligen/match_type.cr
<br/>
<h2>
<a id="constant-summary" class="anchor" href="#constant-summary">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Constant Summary
</h2>
<dl>
<dt class="entry-const" id="ADDITIONAL_DEFAULT_FLAGS">
<strong>ADDITIONAL_DEFAULT_FLAGS</strong> = <code><span class="o">[]</span> <span class="k">of</span> <span class="t">AdditionalDefaultFlag</span></code>
</dt>
<dt class="entry-const" id="APPNAME">
<strong>APPNAME</strong> = <code><span class="t">File</span>.basename(<span class="t">PROGRAM_NAME</span>)</code>
</dt>
<dt class="entry-const" id="VERSION">
<strong>VERSION</strong> = <code><span class="s">&quot;0.1.0&quot;</span></code>
</dt>
</dl>
<h2>
<a id="class-method-summary" class="anchor" href="#class-method-summary">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Class Method Summary
</h2>
<ul class="list-summary">
<li class="entry-summary">
<a href="#add_default_flag%28short%3AString%3D%22%22%2Clong%3AString%3D%22%22%2Cdescription%3AString%3D%22%22%2C%26work%3AString-%3E%29-class-method" class="signature"><strong>.add_default_flag</strong>(short : String = <span class="s">&quot;&quot;</span>, long : String = <span class="s">&quot;&quot;</span>, description : String = <span class="s">&quot;&quot;</span>, &work : String -> )</a>
</li>
</ul>
<div class="methods-inherited">
</div>
<h2>
<a id="class-method-detail" class="anchor" href="#class-method-detail">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Class Method Detail
</h2>
<div class="entry-detail" id="add_default_flag(short:String=&quot;&quot;,long:String=&quot;&quot;,description:String=&quot;&quot;,&amp;work:String-&gt;)-class-method">
<div class="signature">
def self.<strong>add_default_flag</strong>(short : String = <span class="s">&quot;&quot;</span>, long : String = <span class="s">&quot;&quot;</span>, description : String = <span class="s">&quot;&quot;</span>, &work : String -> )
<a class="method-permalink" href="#add_default_flag%28short%3AString%3D%22%22%2Clong%3AString%3D%22%22%2Cdescription%3AString%3D%22%22%2C%26work%3AString-%3E%29-class-method">#</a>
</div>
<br/>
<div>
</div>
</div>
</div>
</body>
</html>
+451
View File
@@ -0,0 +1,451 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Crystal Docs 1.20.3">
<meta name="crystal_docs.project_version" content="object_rework-dev">
<meta name="crystal_docs.project_name" content="CliGenerator">
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/doc.js"></script>
<meta name="repository-name" content="CliGenerator">
<title>CliGen::AdditionalDefaultFlag - CliGenerator object_rework-dev</title>
<script type="text/javascript">
CrystalDocs.base_path = "../";
</script>
</head>
<body>
<svg class="hidden">
<symbol id="octicon-link" viewBox="0 0 16 16">
<path fill="currentColor" fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path>
</symbol>
</svg>
<input type="checkbox" id="sidebar-btn">
<label for="sidebar-btn" id="sidebar-btn-label">
<svg class="open" xmlns="http://www.w3.org/2000/svg" height="2em" width="2em" viewBox="0 0 512 512"><title>Open Sidebar</title><path fill="currentColor" d="M80 96v64h352V96H80zm0 112v64h352v-64H80zm0 112v64h352v-64H80z"></path></svg>
<svg class="close" xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" viewBox="0 0 512 512"><title>Close Sidebar</title><path fill="currentColor" d="m118.6 73.4-45.2 45.2L210.7 256 73.4 393.4l45.2 45.2L256 301.3l137.4 137.3 45.2-45.2L301.3 256l137.3-137.4-45.2-45.2L256 210.7Z"></path></svg>
</label>
<div class="sidebar">
<div class="sidebar-header">
<div class="search-box">
<input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search">
</div>
<div class="project-summary">
<h1 class="project-name">
<a href="../index.html">
CliGenerator
</a>
</h1>
<span class="project-version">
object_rework-dev
</span>
</div>
</div>
<div class="search-results hidden">
<ul class="search-list"></ul>
</div>
<div class="types-list">
<ul>
<li class="parent open current" data-id="CliGenerator/CliGen" data-name="cligen">
<a href="../CliGen.html">CliGen</a>
<ul>
<li class=" current" data-id="CliGenerator/CliGen/AdditionalDefaultFlag" data-name="cligen::additionaldefaultflag">
<a href="../CliGen/AdditionalDefaultFlag.html">AdditionalDefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/App" data-name="cligen::app">
<a href="../CliGen/App.html">App</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Arg" data-name="cligen::arg">
<a href="../CliGen/Arg.html">Arg</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Argument" data-name="cligen::argument">
<a href="../CliGen/Argument.html">Argument</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/BaseFlag" data-name="cligen::baseflag">
<a href="../CliGen/BaseFlag.html">BaseFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Command" data-name="cligen::command">
<a href="../CliGen/Command.html">Command</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandInfo" data-name="cligen::commandinfo">
<a href="../CliGen/CommandInfo.html">CommandInfo</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandNode" data-name="cligen::commandnode">
<a href="../CliGen/CommandNode.html">CommandNode</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/DefaultFlag" data-name="cligen::defaultflag">
<a href="../CliGen/DefaultFlag.html">DefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Flag" data-name="cligen::flag(t)">
<a href="../CliGen/Flag.html">Flag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Format" data-name="cligen::format">
<a href="../CliGen/Format.html">Format</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/MatchType" data-name="cligen::matchtype">
<a href="../CliGen/MatchType.html">MatchType</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/ProxyCommand" data-name="cligen::proxycommand">
<a href="../CliGen/ProxyCommand.html">ProxyCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Regex" data-name="cligen::regex">
<a href="../CliGen/Regex.html">Regex</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Selection" data-name="cligen::selection">
<a href="../CliGen/Selection.html">Selection</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/SubCommand" data-name="cligen::subcommand">
<a href="../CliGen/SubCommand.html">SubCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Trigger" data-name="cligen::trigger">
<a href="../CliGen/Trigger.html">Trigger</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="main-content">
<h1 class="type-name">
<span class="kind">
struct
</span> CliGen::<wbr>AdditionalDefaultFlag
</h1>
<ul class="superclass-hierarchy"><li class="superclass"><a href="../CliGen/AdditionalDefaultFlag.html">CliGen::AdditionalDefaultFlag</a></li><li class="superclass">Struct</li><li class="superclass">Value</li><li class="superclass">Object</li></ul>
<h2>
<a id="defined-in" class="anchor" href="#defined-in">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Defined in:
</h2>
cligen.cr
<br/>
<h2>
<a id="constructors" class="anchor" href="#constructors">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Constructors
</h2>
<ul class="list-summary">
<li class="entry-summary">
<a href="#new%28short%3AString%2Clong%3AString%2Cdescription%3AString%2Cwork%3AString-%3E%29-class-method" class="signature"><strong>.new</strong>(short : String, long : String, description : String, work : String -> )</a>
</li>
</ul>
<h2>
<a id="instance-method-summary" class="anchor" href="#instance-method-summary">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Instance Method Summary
</h2>
<ul class="list-summary">
<li class="entry-summary">
<a href="#clone-instance-method" class="signature"><strong>#clone</strong></a>
</li>
<li class="entry-summary">
<a href="#copy_with%28short_short%3D%40short%2Clong_long%3D%40long%2Cdescription_description%3D%40description%2Cwork_work%3D%40work%29-instance-method" class="signature"><strong>#copy_with</strong>(short _short = @short, long _long = @long, description _description = @description, work _work = @work)</a>
</li>
<li class="entry-summary">
<a href="#description%3AString-instance-method" class="signature"><strong>#description</strong> : String</a>
</li>
<li class="entry-summary">
<a href="#long%3AString-instance-method" class="signature"><strong>#long</strong> : String</a>
</li>
<li class="entry-summary">
<a href="#short%3AString-instance-method" class="signature"><strong>#short</strong> : String</a>
</li>
<li class="entry-summary">
<a href="#work%3AString-%3E-instance-method" class="signature"><strong>#work</strong> : String -> </a>
</li>
</ul>
<div class="methods-inherited">
</div>
<h2>
<a id="constructor-detail" class="anchor" href="#constructor-detail">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Constructor Detail
</h2>
<div class="entry-detail" id="new(short:String,long:String,description:String,work:String-&gt;)-class-method">
<div class="signature">
def self.<strong>new</strong>(short : String, long : String, description : String, work : String -> )
<a class="method-permalink" href="#new%28short%3AString%2Clong%3AString%2Cdescription%3AString%2Cwork%3AString-%3E%29-class-method">#</a>
</div>
<br/>
<div>
</div>
</div>
<h2>
<a id="instance-method-detail" class="anchor" href="#instance-method-detail">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Instance Method Detail
</h2>
<div class="entry-detail" id="clone-instance-method">
<div class="signature">
def <strong>clone</strong>
<a class="method-permalink" href="#clone-instance-method">#</a>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="copy_with(short_short=@short,long_long=@long,description_description=@description,work_work=@work)-instance-method">
<div class="signature">
def <strong>copy_with</strong>(short _short = @short, long _long = @long, description _description = @description, work _work = @work)
<a class="method-permalink" href="#copy_with%28short_short%3D%40short%2Clong_long%3D%40long%2Cdescription_description%3D%40description%2Cwork_work%3D%40work%29-instance-method">#</a>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="description:String-instance-method">
<div class="signature">
def <strong>description</strong> : String
<a class="method-permalink" href="#description%3AString-instance-method">#</a>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="long:String-instance-method">
<div class="signature">
def <strong>long</strong> : String
<a class="method-permalink" href="#long%3AString-instance-method">#</a>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="short:String-instance-method">
<div class="signature">
def <strong>short</strong> : String
<a class="method-permalink" href="#short%3AString-instance-method">#</a>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="work:String-&gt;-instance-method">
<div class="signature">
def <strong>work</strong> : String ->
<a class="method-permalink" href="#work%3AString-%3E-instance-method">#</a>
</div>
<br/>
<div>
</div>
</div>
</div>
</body>
</html>
+451
View File
@@ -0,0 +1,451 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Crystal Docs 1.20.3">
<meta name="crystal_docs.project_version" content="object_rework-dev">
<meta name="crystal_docs.project_name" content="CliGenerator">
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/doc.js"></script>
<meta name="repository-name" content="CliGenerator">
<title>CliGen::App - CliGenerator object_rework-dev</title>
<script type="text/javascript">
CrystalDocs.base_path = "../";
</script>
</head>
<body>
<svg class="hidden">
<symbol id="octicon-link" viewBox="0 0 16 16">
<path fill="currentColor" fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path>
</symbol>
</svg>
<input type="checkbox" id="sidebar-btn">
<label for="sidebar-btn" id="sidebar-btn-label">
<svg class="open" xmlns="http://www.w3.org/2000/svg" height="2em" width="2em" viewBox="0 0 512 512"><title>Open Sidebar</title><path fill="currentColor" d="M80 96v64h352V96H80zm0 112v64h352v-64H80zm0 112v64h352v-64H80z"></path></svg>
<svg class="close" xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" viewBox="0 0 512 512"><title>Close Sidebar</title><path fill="currentColor" d="m118.6 73.4-45.2 45.2L210.7 256 73.4 393.4l45.2 45.2L256 301.3l137.4 137.3 45.2-45.2L301.3 256l137.3-137.4-45.2-45.2L256 210.7Z"></path></svg>
</label>
<div class="sidebar">
<div class="sidebar-header">
<div class="search-box">
<input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search">
</div>
<div class="project-summary">
<h1 class="project-name">
<a href="../index.html">
CliGenerator
</a>
</h1>
<span class="project-version">
object_rework-dev
</span>
</div>
</div>
<div class="search-results hidden">
<ul class="search-list"></ul>
</div>
<div class="types-list">
<ul>
<li class="parent open current" data-id="CliGenerator/CliGen" data-name="cligen">
<a href="../CliGen.html">CliGen</a>
<ul>
<li class=" " data-id="CliGenerator/CliGen/AdditionalDefaultFlag" data-name="cligen::additionaldefaultflag">
<a href="../CliGen/AdditionalDefaultFlag.html">AdditionalDefaultFlag</a>
</li>
<li class=" current" data-id="CliGenerator/CliGen/App" data-name="cligen::app">
<a href="../CliGen/App.html">App</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Arg" data-name="cligen::arg">
<a href="../CliGen/Arg.html">Arg</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Argument" data-name="cligen::argument">
<a href="../CliGen/Argument.html">Argument</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/BaseFlag" data-name="cligen::baseflag">
<a href="../CliGen/BaseFlag.html">BaseFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Command" data-name="cligen::command">
<a href="../CliGen/Command.html">Command</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandInfo" data-name="cligen::commandinfo">
<a href="../CliGen/CommandInfo.html">CommandInfo</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandNode" data-name="cligen::commandnode">
<a href="../CliGen/CommandNode.html">CommandNode</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/DefaultFlag" data-name="cligen::defaultflag">
<a href="../CliGen/DefaultFlag.html">DefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Flag" data-name="cligen::flag(t)">
<a href="../CliGen/Flag.html">Flag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Format" data-name="cligen::format">
<a href="../CliGen/Format.html">Format</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/MatchType" data-name="cligen::matchtype">
<a href="../CliGen/MatchType.html">MatchType</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/ProxyCommand" data-name="cligen::proxycommand">
<a href="../CliGen/ProxyCommand.html">ProxyCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Regex" data-name="cligen::regex">
<a href="../CliGen/Regex.html">Regex</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Selection" data-name="cligen::selection">
<a href="../CliGen/Selection.html">Selection</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/SubCommand" data-name="cligen::subcommand">
<a href="../CliGen/SubCommand.html">SubCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Trigger" data-name="cligen::trigger">
<a href="../CliGen/Trigger.html">Trigger</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="main-content">
<h1 class="type-name">
<span class="kind">
class
</span> CliGen::<wbr>App
</h1>
<ul class="superclass-hierarchy"><li class="superclass"><a href="../CliGen/App.html">CliGen::App</a></li><li class="superclass"><a href="../CliGen/CommandNode.html">CliGen::CommandNode</a></li><li class="superclass">Reference</li><li class="superclass">Object</li></ul>
<h2>
<a id="overview" class="anchor" href="#overview">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Overview
</h2>
<p>This serves as the default App object, that holds a copy of all flags &amp;
handles flag processing until it hands off to the user defined commands</p>
<h2>
<a id="defined-in" class="anchor" href="#defined-in">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Defined in:
</h2>
cligen/app.cr
<br/>
<h2>
<a id="constructors" class="anchor" href="#constructors">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Constructors
</h2>
<ul class="list-summary">
<li class="entry-summary">
<a href="#new%28name%2Cflags%2Ccommands%2Cpre_run_commands%2Cpost_run_commands%29-class-method" class="signature"><strong>.new</strong>(name, flags, commands, pre_run_commands, post_run_commands)</a>
</li>
</ul>
<h2>
<a id="class-method-summary" class="anchor" href="#class-method-summary">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Class Method Summary
</h2>
<ul class="list-summary">
<li class="entry-summary">
<a href="#process%28args%3AArray%28String%29%3DARGV%29-class-method" class="signature"><strong>.process</strong>(args : Array(String) = <span class="t">ARGV</span>)</a>
<div class="summary"><p>Serves as a convinence method for the user to call to begin processing an argument array provided by the user.</p></div>
</li>
</ul>
<h2>
<a id="instance-method-summary" class="anchor" href="#instance-method-summary">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Instance Method Summary
</h2>
<ul class="list-summary">
<li class="entry-summary">
<a href="#check%21-instance-method" class="signature"><strong>#check!</strong></a>
</li>
</ul>
<div class="methods-inherited">
<h3>Instance methods inherited from class <code><a href="../CliGen/CommandNode.html">CliGen::CommandNode</a></code></h3>
<a href="../CliGen/CommandNode.html#check%21-instance-method" class="tooltip">
<span>check!</span>
check!</a>,
<a href="../CliGen/CommandNode.html#check_for_duplicates%21%28flags%3AArray%28BaseFlag%29%29-instance-method" class="tooltip">
<span>check_for_duplicates!(flags : Array(BaseFlag))</span>
check_for_duplicates!</a>,
<a href="../CliGen/CommandNode.html#find_match%28arg%3AString%29-instance-method" class="tooltip">
<span>find_match(arg : String)</span>
find_match</a>,
<a href="../CliGen/CommandNode.html#process%28args%3AArray%28String%29%29-instance-method" class="tooltip">
<span>process(args : Array(String))<br/>process(args : Array(Arg)) : Nil</span>
process</a>
<h3>Constructor methods inherited from class <code><a href="../CliGen/CommandNode.html">CliGen::CommandNode</a></code></h3>
<a href="../CliGen/CommandNode.html#new%28name%3AString%2Cflags%3AArray%28CliGen%3A%3ABaseFlag%29%2Ccommands%3AArray%28CliGen%3A%3ACommandNode%29%2Cpre_run_commands%3AArray%28_%29%2Cpost_run_commands%3AArray%28_%29%29-class-method" class="tooltip">
<span>new(name : String, flags : Array(CliGen::BaseFlag), commands : Array(CliGen::CommandNode), pre_run_commands : Array(_), post_run_commands : Array(_))</span>
new</a>
</div>
<h2>
<a id="constructor-detail" class="anchor" href="#constructor-detail">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Constructor Detail
</h2>
<div class="entry-detail" id="new(name,flags,commands,pre_run_commands,post_run_commands)-class-method">
<div class="signature">
def self.<strong>new</strong>(name, flags, commands, pre_run_commands, post_run_commands)
<a class="method-permalink" href="#new%28name%2Cflags%2Ccommands%2Cpre_run_commands%2Cpost_run_commands%29-class-method">#</a>
</div>
<br/>
<div>
</div>
</div>
<h2>
<a id="class-method-detail" class="anchor" href="#class-method-detail">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Class Method Detail
</h2>
<div class="entry-detail" id="process(args:Array(String)=ARGV)-class-method">
<div class="signature">
def self.<strong>process</strong>(args : Array(String) = <span class="t">ARGV</span>)
<a class="method-permalink" href="#process%28args%3AArray%28String%29%3DARGV%29-class-method">#</a>
</div>
<div class="doc">
<p>Serves as a convinence method for the user to call to begin processing an
argument array provided by the user.</p>
<p>This defaults to ARGV for convinence if no arguments are passed through</p>
</div>
<br/>
<div>
</div>
</div>
<h2>
<a id="instance-method-detail" class="anchor" href="#instance-method-detail">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Instance Method Detail
</h2>
<div class="entry-detail" id="check!-instance-method">
<div class="signature">
def <strong>check!</strong>
<a class="method-permalink" href="#check%21-instance-method">#</a>
</div>
<br/>
<div>
</div>
</div>
</div>
</body>
</html>
+450
View File
@@ -0,0 +1,450 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Crystal Docs 1.20.3">
<meta name="crystal_docs.project_version" content="object_rework-dev">
<meta name="crystal_docs.project_name" content="CliGenerator">
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/doc.js"></script>
<meta name="repository-name" content="CliGenerator">
<title>CliGen::Arg - CliGenerator object_rework-dev</title>
<script type="text/javascript">
CrystalDocs.base_path = "../";
</script>
</head>
<body>
<svg class="hidden">
<symbol id="octicon-link" viewBox="0 0 16 16">
<path fill="currentColor" fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path>
</symbol>
</svg>
<input type="checkbox" id="sidebar-btn">
<label for="sidebar-btn" id="sidebar-btn-label">
<svg class="open" xmlns="http://www.w3.org/2000/svg" height="2em" width="2em" viewBox="0 0 512 512"><title>Open Sidebar</title><path fill="currentColor" d="M80 96v64h352V96H80zm0 112v64h352v-64H80zm0 112v64h352v-64H80z"></path></svg>
<svg class="close" xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" viewBox="0 0 512 512"><title>Close Sidebar</title><path fill="currentColor" d="m118.6 73.4-45.2 45.2L210.7 256 73.4 393.4l45.2 45.2L256 301.3l137.4 137.3 45.2-45.2L301.3 256l137.3-137.4-45.2-45.2L256 210.7Z"></path></svg>
</label>
<div class="sidebar">
<div class="sidebar-header">
<div class="search-box">
<input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search">
</div>
<div class="project-summary">
<h1 class="project-name">
<a href="../index.html">
CliGenerator
</a>
</h1>
<span class="project-version">
object_rework-dev
</span>
</div>
</div>
<div class="search-results hidden">
<ul class="search-list"></ul>
</div>
<div class="types-list">
<ul>
<li class="parent open current" data-id="CliGenerator/CliGen" data-name="cligen">
<a href="../CliGen.html">CliGen</a>
<ul>
<li class=" " data-id="CliGenerator/CliGen/AdditionalDefaultFlag" data-name="cligen::additionaldefaultflag">
<a href="../CliGen/AdditionalDefaultFlag.html">AdditionalDefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/App" data-name="cligen::app">
<a href="../CliGen/App.html">App</a>
</li>
<li class=" current" data-id="CliGenerator/CliGen/Arg" data-name="cligen::arg">
<a href="../CliGen/Arg.html">Arg</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Argument" data-name="cligen::argument">
<a href="../CliGen/Argument.html">Argument</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/BaseFlag" data-name="cligen::baseflag">
<a href="../CliGen/BaseFlag.html">BaseFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Command" data-name="cligen::command">
<a href="../CliGen/Command.html">Command</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandInfo" data-name="cligen::commandinfo">
<a href="../CliGen/CommandInfo.html">CommandInfo</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandNode" data-name="cligen::commandnode">
<a href="../CliGen/CommandNode.html">CommandNode</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/DefaultFlag" data-name="cligen::defaultflag">
<a href="../CliGen/DefaultFlag.html">DefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Flag" data-name="cligen::flag(t)">
<a href="../CliGen/Flag.html">Flag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Format" data-name="cligen::format">
<a href="../CliGen/Format.html">Format</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/MatchType" data-name="cligen::matchtype">
<a href="../CliGen/MatchType.html">MatchType</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/ProxyCommand" data-name="cligen::proxycommand">
<a href="../CliGen/ProxyCommand.html">ProxyCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Regex" data-name="cligen::regex">
<a href="../CliGen/Regex.html">Regex</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Selection" data-name="cligen::selection">
<a href="../CliGen/Selection.html">Selection</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/SubCommand" data-name="cligen::subcommand">
<a href="../CliGen/SubCommand.html">SubCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Trigger" data-name="cligen::trigger">
<a href="../CliGen/Trigger.html">Trigger</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="main-content">
<h1 class="type-name">
<span class="kind">
class
</span> CliGen::<wbr>Arg
</h1>
<ul class="superclass-hierarchy"><li class="superclass"><a href="../CliGen/Arg.html">CliGen::Arg</a></li><li class="superclass">Reference</li><li class="superclass">Object</li></ul>
<h2>
<a id="overview" class="anchor" href="#overview">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Overview
</h2>
<p>This class serves as a &quot;argument wrapper&quot; to force a fail-fast approach to
arg-parsing.</p>
<p>It wraps around the argument + index of the argument to do state tracking
and ensure that each argument is only processed once (plus allows for
easier filtering of processed arguments to avoid having to do index math)</p>
<pre><code class="language-crystal">args.reject(<span class="o">&amp;</span>.processed?) <span class="c"># returns the args that haven&#39;t been processed yet</span></code></pre>
<p>It expects each argument to only be processed once and will force a raise
if the argument has Arg#processed called a second time. This is to force
the developer (me) to fix any processing issues during the development of
this framework.</p>
<h2>
<a id="defined-in" class="anchor" href="#defined-in">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Defined in:
</h2>
cligen/arg.cr
<br/>
<h2>
<a id="constructors" class="anchor" href="#constructors">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Constructors
</h2>
<ul class="list-summary">
<li class="entry-summary">
<a href="#new%28value%3AString%2Cindex%3AInt32%29-class-method" class="signature"><strong>.new</strong>(value : String, index : Int32)</a>
</li>
</ul>
<h2>
<a id="instance-method-summary" class="anchor" href="#instance-method-summary">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Instance Method Summary
</h2>
<ul class="list-summary">
<li class="entry-summary">
<a href="#index%3AInt32-instance-method" class="signature"><strong>#index</strong> : Int32</a>
<div class="summary"><p>The index of the argument in the array it was in</p></div>
</li>
<li class="entry-summary">
<a href="#processed-instance-method" class="signature"><strong>#processed</strong></a>
<div class="summary"><p>This serves as a trigger that tells the object that it has been processed</p></div>
</li>
<li class="entry-summary">
<a href="#processed%3F%3ABool-instance-method" class="signature"><strong>#processed?</strong> : Bool</a>
<div class="summary"><p>The &quot;flag&quot;/variable that tracks is the Arg has been processed yet</p></div>
</li>
<li class="entry-summary">
<a href="#value%3AString-instance-method" class="signature"><strong>#value</strong> : String</a>
<div class="summary"><p>The raw string argument provided from the user</p></div>
</li>
</ul>
<div class="methods-inherited">
</div>
<h2>
<a id="constructor-detail" class="anchor" href="#constructor-detail">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Constructor Detail
</h2>
<div class="entry-detail" id="new(value:String,index:Int32)-class-method">
<div class="signature">
def self.<strong>new</strong>(value : String, index : Int32)
<a class="method-permalink" href="#new%28value%3AString%2Cindex%3AInt32%29-class-method">#</a>
</div>
<br/>
<div>
</div>
</div>
<h2>
<a id="instance-method-detail" class="anchor" href="#instance-method-detail">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Instance Method Detail
</h2>
<div class="entry-detail" id="index:Int32-instance-method">
<div class="signature">
def <strong>index</strong> : Int32
<a class="method-permalink" href="#index%3AInt32-instance-method">#</a>
</div>
<div class="doc">
<p>The index of the argument in the array it was in</p>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="processed-instance-method">
<div class="signature">
def <strong>processed</strong>
<a class="method-permalink" href="#processed-instance-method">#</a>
</div>
<div class="doc">
<p>This serves as a trigger that tells the object that it has been processed</p>
<p>This will raise an exception if it is re-called after already having been
processed.</p>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="processed?:Bool-instance-method">
<div class="signature">
def <strong>processed?</strong> : Bool
<a class="method-permalink" href="#processed%3F%3ABool-instance-method">#</a>
</div>
<div class="doc">
<p>The &quot;flag&quot;/variable that tracks is the Arg has been processed yet</p>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="value:String-instance-method">
<div class="signature">
def <strong>value</strong> : String
<a class="method-permalink" href="#value%3AString-instance-method">#</a>
</div>
<div class="doc">
<p>The raw string argument provided from the user</p>
</div>
<br/>
<div>
</div>
</div>
</div>
</body>
</html>
+233
View File
@@ -0,0 +1,233 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Crystal Docs 1.20.3">
<meta name="crystal_docs.project_version" content="object_rework-dev">
<meta name="crystal_docs.project_name" content="CliGenerator">
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/doc.js"></script>
<meta name="repository-name" content="CliGenerator">
<title>CliGen::Argument - CliGenerator object_rework-dev</title>
<script type="text/javascript">
CrystalDocs.base_path = "../";
</script>
</head>
<body>
<svg class="hidden">
<symbol id="octicon-link" viewBox="0 0 16 16">
<path fill="currentColor" fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path>
</symbol>
</svg>
<input type="checkbox" id="sidebar-btn">
<label for="sidebar-btn" id="sidebar-btn-label">
<svg class="open" xmlns="http://www.w3.org/2000/svg" height="2em" width="2em" viewBox="0 0 512 512"><title>Open Sidebar</title><path fill="currentColor" d="M80 96v64h352V96H80zm0 112v64h352v-64H80zm0 112v64h352v-64H80z"></path></svg>
<svg class="close" xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" viewBox="0 0 512 512"><title>Close Sidebar</title><path fill="currentColor" d="m118.6 73.4-45.2 45.2L210.7 256 73.4 393.4l45.2 45.2L256 301.3l137.4 137.3 45.2-45.2L301.3 256l137.3-137.4-45.2-45.2L256 210.7Z"></path></svg>
</label>
<div class="sidebar">
<div class="sidebar-header">
<div class="search-box">
<input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search">
</div>
<div class="project-summary">
<h1 class="project-name">
<a href="../index.html">
CliGenerator
</a>
</h1>
<span class="project-version">
object_rework-dev
</span>
</div>
</div>
<div class="search-results hidden">
<ul class="search-list"></ul>
</div>
<div class="types-list">
<ul>
<li class="parent open current" data-id="CliGenerator/CliGen" data-name="cligen">
<a href="../CliGen.html">CliGen</a>
<ul>
<li class=" " data-id="CliGenerator/CliGen/AdditionalDefaultFlag" data-name="cligen::additionaldefaultflag">
<a href="../CliGen/AdditionalDefaultFlag.html">AdditionalDefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/App" data-name="cligen::app">
<a href="../CliGen/App.html">App</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Arg" data-name="cligen::arg">
<a href="../CliGen/Arg.html">Arg</a>
</li>
<li class=" current" data-id="CliGenerator/CliGen/Argument" data-name="cligen::argument">
<a href="../CliGen/Argument.html">Argument</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/BaseFlag" data-name="cligen::baseflag">
<a href="../CliGen/BaseFlag.html">BaseFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Command" data-name="cligen::command">
<a href="../CliGen/Command.html">Command</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandInfo" data-name="cligen::commandinfo">
<a href="../CliGen/CommandInfo.html">CommandInfo</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandNode" data-name="cligen::commandnode">
<a href="../CliGen/CommandNode.html">CommandNode</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/DefaultFlag" data-name="cligen::defaultflag">
<a href="../CliGen/DefaultFlag.html">DefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Flag" data-name="cligen::flag(t)">
<a href="../CliGen/Flag.html">Flag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Format" data-name="cligen::format">
<a href="../CliGen/Format.html">Format</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/MatchType" data-name="cligen::matchtype">
<a href="../CliGen/MatchType.html">MatchType</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/ProxyCommand" data-name="cligen::proxycommand">
<a href="../CliGen/ProxyCommand.html">ProxyCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Regex" data-name="cligen::regex">
<a href="../CliGen/Regex.html">Regex</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Selection" data-name="cligen::selection">
<a href="../CliGen/Selection.html">Selection</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/SubCommand" data-name="cligen::subcommand">
<a href="../CliGen/SubCommand.html">SubCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Trigger" data-name="cligen::trigger">
<a href="../CliGen/Trigger.html">Trigger</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="main-content">
<h1 class="type-name">
<span class="kind">
annotation
</span> CliGen::<wbr>Argument
</h1>
<h2>
<a id="defined-in" class="anchor" href="#defined-in">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Defined in:
</h2>
cligen/annotations.cr
<br/>
<div class="methods-inherited">
</div>
</div>
</body>
</html>
+528
View File
@@ -0,0 +1,528 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Crystal Docs 1.20.3">
<meta name="crystal_docs.project_version" content="object_rework-dev">
<meta name="crystal_docs.project_name" content="CliGenerator">
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/doc.js"></script>
<meta name="repository-name" content="CliGenerator">
<title>CliGen::BaseFlag - CliGenerator object_rework-dev</title>
<script type="text/javascript">
CrystalDocs.base_path = "../";
</script>
</head>
<body>
<svg class="hidden">
<symbol id="octicon-link" viewBox="0 0 16 16">
<path fill="currentColor" fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path>
</symbol>
</svg>
<input type="checkbox" id="sidebar-btn">
<label for="sidebar-btn" id="sidebar-btn-label">
<svg class="open" xmlns="http://www.w3.org/2000/svg" height="2em" width="2em" viewBox="0 0 512 512"><title>Open Sidebar</title><path fill="currentColor" d="M80 96v64h352V96H80zm0 112v64h352v-64H80zm0 112v64h352v-64H80z"></path></svg>
<svg class="close" xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" viewBox="0 0 512 512"><title>Close Sidebar</title><path fill="currentColor" d="m118.6 73.4-45.2 45.2L210.7 256 73.4 393.4l45.2 45.2L256 301.3l137.4 137.3 45.2-45.2L301.3 256l137.3-137.4-45.2-45.2L256 210.7Z"></path></svg>
</label>
<div class="sidebar">
<div class="sidebar-header">
<div class="search-box">
<input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search">
</div>
<div class="project-summary">
<h1 class="project-name">
<a href="../index.html">
CliGenerator
</a>
</h1>
<span class="project-version">
object_rework-dev
</span>
</div>
</div>
<div class="search-results hidden">
<ul class="search-list"></ul>
</div>
<div class="types-list">
<ul>
<li class="parent open current" data-id="CliGenerator/CliGen" data-name="cligen">
<a href="../CliGen.html">CliGen</a>
<ul>
<li class=" " data-id="CliGenerator/CliGen/AdditionalDefaultFlag" data-name="cligen::additionaldefaultflag">
<a href="../CliGen/AdditionalDefaultFlag.html">AdditionalDefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/App" data-name="cligen::app">
<a href="../CliGen/App.html">App</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Arg" data-name="cligen::arg">
<a href="../CliGen/Arg.html">Arg</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Argument" data-name="cligen::argument">
<a href="../CliGen/Argument.html">Argument</a>
</li>
<li class=" current" data-id="CliGenerator/CliGen/BaseFlag" data-name="cligen::baseflag">
<a href="../CliGen/BaseFlag.html">BaseFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Command" data-name="cligen::command">
<a href="../CliGen/Command.html">Command</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandInfo" data-name="cligen::commandinfo">
<a href="../CliGen/CommandInfo.html">CommandInfo</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandNode" data-name="cligen::commandnode">
<a href="../CliGen/CommandNode.html">CommandNode</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/DefaultFlag" data-name="cligen::defaultflag">
<a href="../CliGen/DefaultFlag.html">DefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Flag" data-name="cligen::flag(t)">
<a href="../CliGen/Flag.html">Flag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Format" data-name="cligen::format">
<a href="../CliGen/Format.html">Format</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/MatchType" data-name="cligen::matchtype">
<a href="../CliGen/MatchType.html">MatchType</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/ProxyCommand" data-name="cligen::proxycommand">
<a href="../CliGen/ProxyCommand.html">ProxyCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Regex" data-name="cligen::regex">
<a href="../CliGen/Regex.html">Regex</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Selection" data-name="cligen::selection">
<a href="../CliGen/Selection.html">Selection</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/SubCommand" data-name="cligen::subcommand">
<a href="../CliGen/SubCommand.html">SubCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Trigger" data-name="cligen::trigger">
<a href="../CliGen/Trigger.html">Trigger</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="main-content">
<h1 class="type-name">
<span class="kind">
abstract class
</span> CliGen::<wbr>BaseFlag
</h1>
<ul class="superclass-hierarchy"><li class="superclass"><a href="../CliGen/BaseFlag.html">CliGen::BaseFlag</a></li><li class="superclass">Reference</li><li class="superclass">Object</li></ul>
<h2>
<a id="direct-known-subclasses" class="anchor" href="#direct-known-subclasses">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Direct Known Subclasses
</h2>
<ul class="other-types-list">
<li class="other-type"><a href="../CliGen/Flag.html">CliGen::Flag(T)</a></li>
</ul>
<h2>
<a id="defined-in" class="anchor" href="#defined-in">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Defined in:
</h2>
cligen/flag.cr
<br/>
<h2>
<a id="constructors" class="anchor" href="#constructors">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Constructors
</h2>
<ul class="list-summary">
<li class="entry-summary">
<a href="#new%28var%3AString%2Cshort%3AString%7CNil%2Clong%3AString%7CNil%2Cenv_var%3AString%7CNil%2Cdescription%3AString%29-class-method" class="signature"><strong>.new</strong>(var : String, short : String | Nil, long : String | Nil, env_var : String | Nil, description : String)</a>
</li>
</ul>
<h2>
<a id="instance-method-summary" class="anchor" href="#instance-method-summary">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Instance Method Summary
</h2>
<ul class="list-summary">
<li class="entry-summary">
<a href="#description%3AString-instance-method" class="signature"><strong>#description</strong> : String</a>
</li>
<li class="entry-summary">
<a href="#env_var%3AString%7CNil-instance-method" class="signature"><strong>#env_var</strong> : String | Nil</a>
</li>
<li class="entry-summary">
<a href="#long%3AString%7CNil-instance-method" class="signature"><strong>#long</strong> : String | Nil</a>
</li>
<li class="entry-summary">
<a href="#long_key%3AString-instance-method" class="signature"><strong>#long_key</strong> : String</a>
</li>
<li class="entry-summary">
<a href="#matches%3F%28token%3AString%29%3ABool-instance-method" class="signature"><strong>#matches?</strong>(token : String) : Bool</a>
</li>
<li class="entry-summary">
<a href="#raw_value%3AString%7CNil-instance-method" class="signature"><strong>#raw_value</strong> : String | Nil</a>
</li>
<li class="entry-summary">
<a href="#satisfied%3F%3ABool-instance-method" class="signature"><strong>#satisfied?</strong> : Bool</a>
</li>
<li class="entry-summary">
<a href="#short%3AString%7CNil-instance-method" class="signature"><strong>#short</strong> : String | Nil</a>
</li>
<li class="entry-summary">
<a href="#validate%21%3ANil-instance-method" class="signature"><strong>#validate!</strong> : Nil</a>
</li>
<li class="entry-summary">
<a href="#var%3AString-instance-method" class="signature"><strong>#var</strong> : String</a>
</li>
</ul>
<div class="methods-inherited">
</div>
<h2>
<a id="constructor-detail" class="anchor" href="#constructor-detail">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Constructor Detail
</h2>
<div class="entry-detail" id="new(var:String,short:String|Nil,long:String|Nil,env_var:String|Nil,description:String)-class-method">
<div class="signature">
def self.<strong>new</strong>(var : String, short : String | Nil, long : String | Nil, env_var : String | Nil, description : String)
<a class="method-permalink" href="#new%28var%3AString%2Cshort%3AString%7CNil%2Clong%3AString%7CNil%2Cenv_var%3AString%7CNil%2Cdescription%3AString%29-class-method">#</a>
</div>
<br/>
<div>
</div>
</div>
<h2>
<a id="instance-method-detail" class="anchor" href="#instance-method-detail">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Instance Method Detail
</h2>
<div class="entry-detail" id="description:String-instance-method">
<div class="signature">
def <strong>description</strong> : String
<a class="method-permalink" href="#description%3AString-instance-method">#</a>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="env_var:String|Nil-instance-method">
<div class="signature">
def <strong>env_var</strong> : String | Nil
<a class="method-permalink" href="#env_var%3AString%7CNil-instance-method">#</a>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="long:String|Nil-instance-method">
<div class="signature">
def <strong>long</strong> : String | Nil
<a class="method-permalink" href="#long%3AString%7CNil-instance-method">#</a>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="long_key:String-instance-method">
<div class="signature">
def <strong>long_key</strong> : String
<a class="method-permalink" href="#long_key%3AString-instance-method">#</a>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="matches?(token:String):Bool-instance-method">
<div class="signature">
def <strong>matches?</strong>(token : String) : Bool
<a class="method-permalink" href="#matches%3F%28token%3AString%29%3ABool-instance-method">#</a>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="raw_value:String|Nil-instance-method">
<div class="signature">
abstract
def <strong>raw_value</strong> : String | Nil
<a class="method-permalink" href="#raw_value%3AString%7CNil-instance-method">#</a>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="satisfied?:Bool-instance-method">
<div class="signature">
abstract
def <strong>satisfied?</strong> : Bool
<a class="method-permalink" href="#satisfied%3F%3ABool-instance-method">#</a>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="short:String|Nil-instance-method">
<div class="signature">
def <strong>short</strong> : String | Nil
<a class="method-permalink" href="#short%3AString%7CNil-instance-method">#</a>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="validate!:Nil-instance-method">
<div class="signature">
abstract
def <strong>validate!</strong> : Nil
<a class="method-permalink" href="#validate%21%3ANil-instance-method">#</a>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="var:String-instance-method">
<div class="signature">
def <strong>var</strong> : String
<a class="method-permalink" href="#var%3AString-instance-method">#</a>
</div>
<br/>
<div>
</div>
</div>
</div>
</body>
</html>
+379
View File
@@ -0,0 +1,379 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Crystal Docs 1.20.3">
<meta name="crystal_docs.project_version" content="object_rework-dev">
<meta name="crystal_docs.project_name" content="CliGenerator">
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/doc.js"></script>
<meta name="repository-name" content="CliGenerator">
<title>CliGen::Command - CliGenerator object_rework-dev</title>
<script type="text/javascript">
CrystalDocs.base_path = "../";
</script>
</head>
<body>
<svg class="hidden">
<symbol id="octicon-link" viewBox="0 0 16 16">
<path fill="currentColor" fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path>
</symbol>
</svg>
<input type="checkbox" id="sidebar-btn">
<label for="sidebar-btn" id="sidebar-btn-label">
<svg class="open" xmlns="http://www.w3.org/2000/svg" height="2em" width="2em" viewBox="0 0 512 512"><title>Open Sidebar</title><path fill="currentColor" d="M80 96v64h352V96H80zm0 112v64h352v-64H80zm0 112v64h352v-64H80z"></path></svg>
<svg class="close" xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" viewBox="0 0 512 512"><title>Close Sidebar</title><path fill="currentColor" d="m118.6 73.4-45.2 45.2L210.7 256 73.4 393.4l45.2 45.2L256 301.3l137.4 137.3 45.2-45.2L301.3 256l137.3-137.4-45.2-45.2L256 210.7Z"></path></svg>
</label>
<div class="sidebar">
<div class="sidebar-header">
<div class="search-box">
<input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search">
</div>
<div class="project-summary">
<h1 class="project-name">
<a href="../index.html">
CliGenerator
</a>
</h1>
<span class="project-version">
object_rework-dev
</span>
</div>
</div>
<div class="search-results hidden">
<ul class="search-list"></ul>
</div>
<div class="types-list">
<ul>
<li class="parent open current" data-id="CliGenerator/CliGen" data-name="cligen">
<a href="../CliGen.html">CliGen</a>
<ul>
<li class=" " data-id="CliGenerator/CliGen/AdditionalDefaultFlag" data-name="cligen::additionaldefaultflag">
<a href="../CliGen/AdditionalDefaultFlag.html">AdditionalDefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/App" data-name="cligen::app">
<a href="../CliGen/App.html">App</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Arg" data-name="cligen::arg">
<a href="../CliGen/Arg.html">Arg</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Argument" data-name="cligen::argument">
<a href="../CliGen/Argument.html">Argument</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/BaseFlag" data-name="cligen::baseflag">
<a href="../CliGen/BaseFlag.html">BaseFlag</a>
</li>
<li class=" current" data-id="CliGenerator/CliGen/Command" data-name="cligen::command">
<a href="../CliGen/Command.html">Command</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandInfo" data-name="cligen::commandinfo">
<a href="../CliGen/CommandInfo.html">CommandInfo</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandNode" data-name="cligen::commandnode">
<a href="../CliGen/CommandNode.html">CommandNode</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/DefaultFlag" data-name="cligen::defaultflag">
<a href="../CliGen/DefaultFlag.html">DefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Flag" data-name="cligen::flag(t)">
<a href="../CliGen/Flag.html">Flag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Format" data-name="cligen::format">
<a href="../CliGen/Format.html">Format</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/MatchType" data-name="cligen::matchtype">
<a href="../CliGen/MatchType.html">MatchType</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/ProxyCommand" data-name="cligen::proxycommand">
<a href="../CliGen/ProxyCommand.html">ProxyCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Regex" data-name="cligen::regex">
<a href="../CliGen/Regex.html">Regex</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Selection" data-name="cligen::selection">
<a href="../CliGen/Selection.html">Selection</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/SubCommand" data-name="cligen::subcommand">
<a href="../CliGen/SubCommand.html">SubCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Trigger" data-name="cligen::trigger">
<a href="../CliGen/Trigger.html">Trigger</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="main-content">
<h1 class="type-name">
<span class="kind">
class
</span> CliGen::<wbr>Command
</h1>
<ul class="superclass-hierarchy"><li class="superclass"><a href="../CliGen/Command.html">CliGen::Command</a></li><li class="superclass">Reference</li><li class="superclass">Object</li></ul>
<h2>
<a id="defined-in" class="anchor" href="#defined-in">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Defined in:
</h2>
cligen/command.cr
<br/>
cligen/command/argument.cr
<br/>
cligen/command/selection.cr
<br/>
cligen/command/subcommand.cr
<br/>
cligen/command/trigger.cr
<br/>
<h2>
<a id="macro-summary" class="anchor" href="#macro-summary">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Macro Summary
</h2>
<ul class="list-summary">
<li class="entry-summary">
<a href="#argument%28variable%2Cshort%2Clong%2Cdescription%2Cvalidation%3Dnil%29-macro" class="signature"><strong>argument</strong>(variable, short, long, description, validation = <span class="n">nil</span>)</a>
</li>
<li class="entry-summary">
<a href="#selection%28variable%2Cshort%2Clong%2Cdescription%2Coptions%29-macro" class="signature"><strong>selection</strong>(variable, short, long, description, options)</a>
</li>
<li class="entry-summary">
<a href="#subcommand%28func%2Cdescription%2Cexamples%3Dnil%2C%26block%29-macro" class="signature"><strong>subcommand</strong>(func, description, examples = <span class="n">nil</span>, &block)</a>
</li>
<li class="entry-summary">
<a href="#trigger%28short%2Clong%2Cargument%3Dnil%2C%26on_match%29-macro" class="signature"><strong>trigger</strong>(short, long, argument = <span class="n">nil</span>, &on_match)</a>
</li>
</ul>
<div class="methods-inherited">
</div>
<h2>
<a id="macro-detail" class="anchor" href="#macro-detail">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Macro Detail
</h2>
<div class="entry-detail" id="argument(variable,short,long,description,validation=nil)-macro">
<div class="signature">
macro <strong>argument</strong>(variable, short, long, description, validation = <span class="n">nil</span>)
<a class="method-permalink" href="#argument%28variable%2Cshort%2Clong%2Cdescription%2Cvalidation%3Dnil%29-macro">#</a>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="selection(variable,short,long,description,options)-macro">
<div class="signature">
macro <strong>selection</strong>(variable, short, long, description, options)
<a class="method-permalink" href="#selection%28variable%2Cshort%2Clong%2Cdescription%2Coptions%29-macro">#</a>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="subcommand(func,description,examples=nil,&amp;block)-macro">
<div class="signature">
macro <strong>subcommand</strong>(func, description, examples = <span class="n">nil</span>, &block)
<a class="method-permalink" href="#subcommand%28func%2Cdescription%2Cexamples%3Dnil%2C%26block%29-macro">#</a>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="trigger(short,long,argument=nil,&amp;on_match)-macro">
<div class="signature">
macro <strong>trigger</strong>(short, long, argument = <span class="n">nil</span>, &on_match)
<a class="method-permalink" href="#trigger%28short%2Clong%2Cargument%3Dnil%2C%26on_match%29-macro">#</a>
</div>
<br/>
<div>
</div>
</div>
</div>
</body>
</html>
+233
View File
@@ -0,0 +1,233 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Crystal Docs 1.20.3">
<meta name="crystal_docs.project_version" content="object_rework-dev">
<meta name="crystal_docs.project_name" content="CliGenerator">
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/doc.js"></script>
<meta name="repository-name" content="CliGenerator">
<title>CliGen::CommandInfo - CliGenerator object_rework-dev</title>
<script type="text/javascript">
CrystalDocs.base_path = "../";
</script>
</head>
<body>
<svg class="hidden">
<symbol id="octicon-link" viewBox="0 0 16 16">
<path fill="currentColor" fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path>
</symbol>
</svg>
<input type="checkbox" id="sidebar-btn">
<label for="sidebar-btn" id="sidebar-btn-label">
<svg class="open" xmlns="http://www.w3.org/2000/svg" height="2em" width="2em" viewBox="0 0 512 512"><title>Open Sidebar</title><path fill="currentColor" d="M80 96v64h352V96H80zm0 112v64h352v-64H80zm0 112v64h352v-64H80z"></path></svg>
<svg class="close" xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" viewBox="0 0 512 512"><title>Close Sidebar</title><path fill="currentColor" d="m118.6 73.4-45.2 45.2L210.7 256 73.4 393.4l45.2 45.2L256 301.3l137.4 137.3 45.2-45.2L301.3 256l137.3-137.4-45.2-45.2L256 210.7Z"></path></svg>
</label>
<div class="sidebar">
<div class="sidebar-header">
<div class="search-box">
<input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search">
</div>
<div class="project-summary">
<h1 class="project-name">
<a href="../index.html">
CliGenerator
</a>
</h1>
<span class="project-version">
object_rework-dev
</span>
</div>
</div>
<div class="search-results hidden">
<ul class="search-list"></ul>
</div>
<div class="types-list">
<ul>
<li class="parent open current" data-id="CliGenerator/CliGen" data-name="cligen">
<a href="../CliGen.html">CliGen</a>
<ul>
<li class=" " data-id="CliGenerator/CliGen/AdditionalDefaultFlag" data-name="cligen::additionaldefaultflag">
<a href="../CliGen/AdditionalDefaultFlag.html">AdditionalDefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/App" data-name="cligen::app">
<a href="../CliGen/App.html">App</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Arg" data-name="cligen::arg">
<a href="../CliGen/Arg.html">Arg</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Argument" data-name="cligen::argument">
<a href="../CliGen/Argument.html">Argument</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/BaseFlag" data-name="cligen::baseflag">
<a href="../CliGen/BaseFlag.html">BaseFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Command" data-name="cligen::command">
<a href="../CliGen/Command.html">Command</a>
</li>
<li class=" current" data-id="CliGenerator/CliGen/CommandInfo" data-name="cligen::commandinfo">
<a href="../CliGen/CommandInfo.html">CommandInfo</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandNode" data-name="cligen::commandnode">
<a href="../CliGen/CommandNode.html">CommandNode</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/DefaultFlag" data-name="cligen::defaultflag">
<a href="../CliGen/DefaultFlag.html">DefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Flag" data-name="cligen::flag(t)">
<a href="../CliGen/Flag.html">Flag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Format" data-name="cligen::format">
<a href="../CliGen/Format.html">Format</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/MatchType" data-name="cligen::matchtype">
<a href="../CliGen/MatchType.html">MatchType</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/ProxyCommand" data-name="cligen::proxycommand">
<a href="../CliGen/ProxyCommand.html">ProxyCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Regex" data-name="cligen::regex">
<a href="../CliGen/Regex.html">Regex</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Selection" data-name="cligen::selection">
<a href="../CliGen/Selection.html">Selection</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/SubCommand" data-name="cligen::subcommand">
<a href="../CliGen/SubCommand.html">SubCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Trigger" data-name="cligen::trigger">
<a href="../CliGen/Trigger.html">Trigger</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="main-content">
<h1 class="type-name">
<span class="kind">
annotation
</span> CliGen::<wbr>CommandInfo
</h1>
<h2>
<a id="defined-in" class="anchor" href="#defined-in">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Defined in:
</h2>
cligen/annotations.cr
<br/>
<div class="methods-inherited">
</div>
</div>
</body>
</html>
+441
View File
@@ -0,0 +1,441 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Crystal Docs 1.20.3">
<meta name="crystal_docs.project_version" content="object_rework-dev">
<meta name="crystal_docs.project_name" content="CliGenerator">
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/doc.js"></script>
<meta name="repository-name" content="CliGenerator">
<title>CliGen::CommandNode - CliGenerator object_rework-dev</title>
<script type="text/javascript">
CrystalDocs.base_path = "../";
</script>
</head>
<body>
<svg class="hidden">
<symbol id="octicon-link" viewBox="0 0 16 16">
<path fill="currentColor" fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path>
</symbol>
</svg>
<input type="checkbox" id="sidebar-btn">
<label for="sidebar-btn" id="sidebar-btn-label">
<svg class="open" xmlns="http://www.w3.org/2000/svg" height="2em" width="2em" viewBox="0 0 512 512"><title>Open Sidebar</title><path fill="currentColor" d="M80 96v64h352V96H80zm0 112v64h352v-64H80zm0 112v64h352v-64H80z"></path></svg>
<svg class="close" xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" viewBox="0 0 512 512"><title>Close Sidebar</title><path fill="currentColor" d="m118.6 73.4-45.2 45.2L210.7 256 73.4 393.4l45.2 45.2L256 301.3l137.4 137.3 45.2-45.2L301.3 256l137.3-137.4-45.2-45.2L256 210.7Z"></path></svg>
</label>
<div class="sidebar">
<div class="sidebar-header">
<div class="search-box">
<input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search">
</div>
<div class="project-summary">
<h1 class="project-name">
<a href="../index.html">
CliGenerator
</a>
</h1>
<span class="project-version">
object_rework-dev
</span>
</div>
</div>
<div class="search-results hidden">
<ul class="search-list"></ul>
</div>
<div class="types-list">
<ul>
<li class="parent open current" data-id="CliGenerator/CliGen" data-name="cligen">
<a href="../CliGen.html">CliGen</a>
<ul>
<li class=" " data-id="CliGenerator/CliGen/AdditionalDefaultFlag" data-name="cligen::additionaldefaultflag">
<a href="../CliGen/AdditionalDefaultFlag.html">AdditionalDefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/App" data-name="cligen::app">
<a href="../CliGen/App.html">App</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Arg" data-name="cligen::arg">
<a href="../CliGen/Arg.html">Arg</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Argument" data-name="cligen::argument">
<a href="../CliGen/Argument.html">Argument</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/BaseFlag" data-name="cligen::baseflag">
<a href="../CliGen/BaseFlag.html">BaseFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Command" data-name="cligen::command">
<a href="../CliGen/Command.html">Command</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandInfo" data-name="cligen::commandinfo">
<a href="../CliGen/CommandInfo.html">CommandInfo</a>
</li>
<li class=" current" data-id="CliGenerator/CliGen/CommandNode" data-name="cligen::commandnode">
<a href="../CliGen/CommandNode.html">CommandNode</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/DefaultFlag" data-name="cligen::defaultflag">
<a href="../CliGen/DefaultFlag.html">DefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Flag" data-name="cligen::flag(t)">
<a href="../CliGen/Flag.html">Flag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Format" data-name="cligen::format">
<a href="../CliGen/Format.html">Format</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/MatchType" data-name="cligen::matchtype">
<a href="../CliGen/MatchType.html">MatchType</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/ProxyCommand" data-name="cligen::proxycommand">
<a href="../CliGen/ProxyCommand.html">ProxyCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Regex" data-name="cligen::regex">
<a href="../CliGen/Regex.html">Regex</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Selection" data-name="cligen::selection">
<a href="../CliGen/Selection.html">Selection</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/SubCommand" data-name="cligen::subcommand">
<a href="../CliGen/SubCommand.html">SubCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Trigger" data-name="cligen::trigger">
<a href="../CliGen/Trigger.html">Trigger</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="main-content">
<h1 class="type-name">
<span class="kind">
class
</span> CliGen::<wbr>CommandNode
</h1>
<ul class="superclass-hierarchy"><li class="superclass"><a href="../CliGen/CommandNode.html">CliGen::CommandNode</a></li><li class="superclass">Reference</li><li class="superclass">Object</li></ul>
<h2>
<a id="direct-known-subclasses" class="anchor" href="#direct-known-subclasses">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Direct Known Subclasses
</h2>
<ul class="other-types-list">
<li class="other-type"><a href="../CliGen/App.html">CliGen::App</a></li>
</ul>
<h2>
<a id="defined-in" class="anchor" href="#defined-in">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Defined in:
</h2>
cligen/command_node.cr
<br/>
<h2>
<a id="constructors" class="anchor" href="#constructors">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Constructors
</h2>
<ul class="list-summary">
<li class="entry-summary">
<a href="#new%28name%3AString%2Cflags%3AArray%28CliGen%3A%3ABaseFlag%29%2Ccommands%3AArray%28CliGen%3A%3ACommandNode%29%2Cpre_run_commands%3AArray%28_%29%2Cpost_run_commands%3AArray%28_%29%29-class-method" class="signature"><strong>.new</strong>(name : String, flags : Array(CliGen::BaseFlag), commands : Array(CliGen::CommandNode), pre_run_commands : Array(_), post_run_commands : Array(_))</a>
</li>
</ul>
<h2>
<a id="instance-method-summary" class="anchor" href="#instance-method-summary">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Instance Method Summary
</h2>
<ul class="list-summary">
<li class="entry-summary">
<a href="#check%21-instance-method" class="signature"><strong>#check!</strong></a>
</li>
<li class="entry-summary">
<a href="#check_for_duplicates%21%28flags%3AArray%28BaseFlag%29%29-instance-method" class="signature"><strong>#check_for_duplicates!</strong>(flags : Array(BaseFlag))</a>
</li>
<li class="entry-summary">
<a href="#find_match%28arg%3AString%29-instance-method" class="signature"><strong>#find_match</strong>(arg : String)</a>
</li>
<li class="entry-summary">
<a href="#process%28args%3AArray%28String%29%29-instance-method" class="signature"><strong>#process</strong>(args : Array(String))</a>
<div class="summary"><p>This serves to just convert the arguments into a usable Array(Arg) format and pass it to the ACTUAL CommandNode#process method</p></div>
</li>
<li class="entry-summary">
<a href="#process%28args%3AArray%28Arg%29%29%3ANil-instance-method" class="signature"><strong>#process</strong>(args : Array(Arg)) : Nil</a>
</li>
</ul>
<div class="methods-inherited">
</div>
<h2>
<a id="constructor-detail" class="anchor" href="#constructor-detail">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Constructor Detail
</h2>
<div class="entry-detail" id="new(name:String,flags:Array(CliGen::BaseFlag),commands:Array(CliGen::CommandNode),pre_run_commands:Array(_),post_run_commands:Array(_))-class-method">
<div class="signature">
def self.<strong>new</strong>(name : String, flags : Array(<a href="../CliGen/BaseFlag.html">CliGen::BaseFlag</a>), commands : Array(<a href="../CliGen/CommandNode.html">CliGen::CommandNode</a>), pre_run_commands : Array(_), post_run_commands : Array(_))
<a class="method-permalink" href="#new%28name%3AString%2Cflags%3AArray%28CliGen%3A%3ABaseFlag%29%2Ccommands%3AArray%28CliGen%3A%3ACommandNode%29%2Cpre_run_commands%3AArray%28_%29%2Cpost_run_commands%3AArray%28_%29%29-class-method">#</a>
</div>
<br/>
<div>
</div>
</div>
<h2>
<a id="instance-method-detail" class="anchor" href="#instance-method-detail">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Instance Method Detail
</h2>
<div class="entry-detail" id="check!-instance-method">
<div class="signature">
def <strong>check!</strong>
<a class="method-permalink" href="#check%21-instance-method">#</a>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="check_for_duplicates!(flags:Array(BaseFlag))-instance-method">
<div class="signature">
def <strong>check_for_duplicates!</strong>(flags : Array(<a href="../CliGen/BaseFlag.html">BaseFlag</a>))
<a class="method-permalink" href="#check_for_duplicates%21%28flags%3AArray%28BaseFlag%29%29-instance-method">#</a>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="find_match(arg:String)-instance-method">
<div class="signature">
def <strong>find_match</strong>(arg : String)
<a class="method-permalink" href="#find_match%28arg%3AString%29-instance-method">#</a>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="process(args:Array(String))-instance-method">
<div class="signature">
def <strong>process</strong>(args : Array(String))
<a class="method-permalink" href="#process%28args%3AArray%28String%29%29-instance-method">#</a>
</div>
<div class="doc">
<p>This serves to just convert the arguments into a usable Array(Arg) format
and pass it to the ACTUAL CommandNode#process method</p>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="process(args:Array(Arg)):Nil-instance-method">
<div class="signature">
def <strong>process</strong>(args : Array(<a href="../CliGen/Arg.html">Arg</a>)) : Nil
<a class="method-permalink" href="#process%28args%3AArray%28Arg%29%29%3ANil-instance-method">#</a>
</div>
<br/>
<div>
</div>
</div>
</div>
</body>
</html>
+233
View File
@@ -0,0 +1,233 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Crystal Docs 1.20.3">
<meta name="crystal_docs.project_version" content="object_rework-dev">
<meta name="crystal_docs.project_name" content="CliGenerator">
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/doc.js"></script>
<meta name="repository-name" content="CliGenerator">
<title>CliGen::DefaultFlag - CliGenerator object_rework-dev</title>
<script type="text/javascript">
CrystalDocs.base_path = "../";
</script>
</head>
<body>
<svg class="hidden">
<symbol id="octicon-link" viewBox="0 0 16 16">
<path fill="currentColor" fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path>
</symbol>
</svg>
<input type="checkbox" id="sidebar-btn">
<label for="sidebar-btn" id="sidebar-btn-label">
<svg class="open" xmlns="http://www.w3.org/2000/svg" height="2em" width="2em" viewBox="0 0 512 512"><title>Open Sidebar</title><path fill="currentColor" d="M80 96v64h352V96H80zm0 112v64h352v-64H80zm0 112v64h352v-64H80z"></path></svg>
<svg class="close" xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" viewBox="0 0 512 512"><title>Close Sidebar</title><path fill="currentColor" d="m118.6 73.4-45.2 45.2L210.7 256 73.4 393.4l45.2 45.2L256 301.3l137.4 137.3 45.2-45.2L301.3 256l137.3-137.4-45.2-45.2L256 210.7Z"></path></svg>
</label>
<div class="sidebar">
<div class="sidebar-header">
<div class="search-box">
<input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search">
</div>
<div class="project-summary">
<h1 class="project-name">
<a href="../index.html">
CliGenerator
</a>
</h1>
<span class="project-version">
object_rework-dev
</span>
</div>
</div>
<div class="search-results hidden">
<ul class="search-list"></ul>
</div>
<div class="types-list">
<ul>
<li class="parent open current" data-id="CliGenerator/CliGen" data-name="cligen">
<a href="../CliGen.html">CliGen</a>
<ul>
<li class=" " data-id="CliGenerator/CliGen/AdditionalDefaultFlag" data-name="cligen::additionaldefaultflag">
<a href="../CliGen/AdditionalDefaultFlag.html">AdditionalDefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/App" data-name="cligen::app">
<a href="../CliGen/App.html">App</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Arg" data-name="cligen::arg">
<a href="../CliGen/Arg.html">Arg</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Argument" data-name="cligen::argument">
<a href="../CliGen/Argument.html">Argument</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/BaseFlag" data-name="cligen::baseflag">
<a href="../CliGen/BaseFlag.html">BaseFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Command" data-name="cligen::command">
<a href="../CliGen/Command.html">Command</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandInfo" data-name="cligen::commandinfo">
<a href="../CliGen/CommandInfo.html">CommandInfo</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandNode" data-name="cligen::commandnode">
<a href="../CliGen/CommandNode.html">CommandNode</a>
</li>
<li class=" current" data-id="CliGenerator/CliGen/DefaultFlag" data-name="cligen::defaultflag">
<a href="../CliGen/DefaultFlag.html">DefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Flag" data-name="cligen::flag(t)">
<a href="../CliGen/Flag.html">Flag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Format" data-name="cligen::format">
<a href="../CliGen/Format.html">Format</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/MatchType" data-name="cligen::matchtype">
<a href="../CliGen/MatchType.html">MatchType</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/ProxyCommand" data-name="cligen::proxycommand">
<a href="../CliGen/ProxyCommand.html">ProxyCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Regex" data-name="cligen::regex">
<a href="../CliGen/Regex.html">Regex</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Selection" data-name="cligen::selection">
<a href="../CliGen/Selection.html">Selection</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/SubCommand" data-name="cligen::subcommand">
<a href="../CliGen/SubCommand.html">SubCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Trigger" data-name="cligen::trigger">
<a href="../CliGen/Trigger.html">Trigger</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="main-content">
<h1 class="type-name">
<span class="kind">
annotation
</span> CliGen::<wbr>DefaultFlag
</h1>
<h2>
<a id="defined-in" class="anchor" href="#defined-in">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Defined in:
</h2>
cligen.cr
<br/>
<div class="methods-inherited">
</div>
</div>
</body>
</html>
+514
View File
@@ -0,0 +1,514 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Crystal Docs 1.20.3">
<meta name="crystal_docs.project_version" content="object_rework-dev">
<meta name="crystal_docs.project_name" content="CliGenerator">
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/doc.js"></script>
<meta name="repository-name" content="CliGenerator">
<title>CliGen::Flag(T) - CliGenerator object_rework-dev</title>
<script type="text/javascript">
CrystalDocs.base_path = "../";
</script>
</head>
<body>
<svg class="hidden">
<symbol id="octicon-link" viewBox="0 0 16 16">
<path fill="currentColor" fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path>
</symbol>
</svg>
<input type="checkbox" id="sidebar-btn">
<label for="sidebar-btn" id="sidebar-btn-label">
<svg class="open" xmlns="http://www.w3.org/2000/svg" height="2em" width="2em" viewBox="0 0 512 512"><title>Open Sidebar</title><path fill="currentColor" d="M80 96v64h352V96H80zm0 112v64h352v-64H80zm0 112v64h352v-64H80z"></path></svg>
<svg class="close" xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" viewBox="0 0 512 512"><title>Close Sidebar</title><path fill="currentColor" d="m118.6 73.4-45.2 45.2L210.7 256 73.4 393.4l45.2 45.2L256 301.3l137.4 137.3 45.2-45.2L301.3 256l137.3-137.4-45.2-45.2L256 210.7Z"></path></svg>
</label>
<div class="sidebar">
<div class="sidebar-header">
<div class="search-box">
<input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search">
</div>
<div class="project-summary">
<h1 class="project-name">
<a href="../index.html">
CliGenerator
</a>
</h1>
<span class="project-version">
object_rework-dev
</span>
</div>
</div>
<div class="search-results hidden">
<ul class="search-list"></ul>
</div>
<div class="types-list">
<ul>
<li class="parent open current" data-id="CliGenerator/CliGen" data-name="cligen">
<a href="../CliGen.html">CliGen</a>
<ul>
<li class=" " data-id="CliGenerator/CliGen/AdditionalDefaultFlag" data-name="cligen::additionaldefaultflag">
<a href="../CliGen/AdditionalDefaultFlag.html">AdditionalDefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/App" data-name="cligen::app">
<a href="../CliGen/App.html">App</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Arg" data-name="cligen::arg">
<a href="../CliGen/Arg.html">Arg</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Argument" data-name="cligen::argument">
<a href="../CliGen/Argument.html">Argument</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/BaseFlag" data-name="cligen::baseflag">
<a href="../CliGen/BaseFlag.html">BaseFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Command" data-name="cligen::command">
<a href="../CliGen/Command.html">Command</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandInfo" data-name="cligen::commandinfo">
<a href="../CliGen/CommandInfo.html">CommandInfo</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandNode" data-name="cligen::commandnode">
<a href="../CliGen/CommandNode.html">CommandNode</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/DefaultFlag" data-name="cligen::defaultflag">
<a href="../CliGen/DefaultFlag.html">DefaultFlag</a>
</li>
<li class=" current" data-id="CliGenerator/CliGen/Flag" data-name="cligen::flag(t)">
<a href="../CliGen/Flag.html">Flag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Format" data-name="cligen::format">
<a href="../CliGen/Format.html">Format</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/MatchType" data-name="cligen::matchtype">
<a href="../CliGen/MatchType.html">MatchType</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/ProxyCommand" data-name="cligen::proxycommand">
<a href="../CliGen/ProxyCommand.html">ProxyCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Regex" data-name="cligen::regex">
<a href="../CliGen/Regex.html">Regex</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Selection" data-name="cligen::selection">
<a href="../CliGen/Selection.html">Selection</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/SubCommand" data-name="cligen::subcommand">
<a href="../CliGen/SubCommand.html">SubCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Trigger" data-name="cligen::trigger">
<a href="../CliGen/Trigger.html">Trigger</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="main-content">
<h1 class="type-name">
<span class="kind">
class
</span> CliGen::<wbr>Flag(T)
</h1>
<ul class="superclass-hierarchy"><li class="superclass"><a href="../CliGen/Flag.html">CliGen::Flag(T)</a></li><li class="superclass"><a href="../CliGen/BaseFlag.html">CliGen::BaseFlag</a></li><li class="superclass">Reference</li><li class="superclass">Object</li></ul>
<h2>
<a id="defined-in" class="anchor" href="#defined-in">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Defined in:
</h2>
cligen/flag.cr
<br/>
<h2>
<a id="constructors" class="anchor" href="#constructors">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Constructors
</h2>
<ul class="list-summary">
<li class="entry-summary">
<a href="#new%28var%3AString%2Cshort%3AString%7CNil%2Clong%3AString%7CNil%2Cenv_var%3AString%7CNil%2Cdescription%3AString%2Cdefault%3AT%7CNil%3Dnil%2Coptions%3AArray%28String%29%7CNil%3Dnil%2Cvalidate%3AT-%3EBool%7CNil%3Dnil%2Con_match%3AProc%28Nil%29%7CNil%3Dnil%29-class-method" class="signature"><strong>.new</strong>(var : String, short : String | Nil, long : String | Nil, env_var : String | Nil, description : String, default : T | Nil = <span class="n">nil</span>, options : Array(String) | Nil = <span class="n">nil</span>, validate : T -> Bool | Nil = <span class="n">nil</span>, on_match : Proc(Nil) | Nil = <span class="n">nil</span>)</a>
</li>
</ul>
<h2>
<a id="instance-method-summary" class="anchor" href="#instance-method-summary">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Instance Method Summary
</h2>
<ul class="list-summary">
<li class="entry-summary">
<a href="#process%28argv%3AArray%28Arg%29%3D%5B%5DofArray%28Arg%29%29%3ANil-instance-method" class="signature"><strong>#process</strong>(argv : Array(Arg) = <span class="o">[]</span> <span class="k">of</span> <span class="t">Array</span>(<span class="t">Arg</span>)) : Nil</a>
</li>
<li class="entry-summary">
<a href="#raw_value%3AString%7CNil-instance-method" class="signature"><strong>#raw_value</strong> : String | Nil</a>
</li>
<li class="entry-summary">
<a href="#requires_arg%3F%3ABool-instance-method" class="signature"><strong>#requires_arg?</strong> : Bool</a>
</li>
<li class="entry-summary">
<a href="#satisfied%3F%3ABool-instance-method" class="signature"><strong>#satisfied?</strong> : Bool</a>
</li>
<li class="entry-summary">
<a href="#validate%21%3ANil-instance-method" class="signature"><strong>#validate!</strong> : Nil</a>
</li>
<li class="entry-summary">
<a href="#value%21%3AT-instance-method" class="signature"><strong>#value!</strong> : T</a>
</li>
</ul>
<div class="methods-inherited">
<h3>Instance methods inherited from class <code><a href="../CliGen/BaseFlag.html">CliGen::BaseFlag</a></code></h3>
<a href="../CliGen/BaseFlag.html#description%3AString-instance-method" class="tooltip">
<span>description : String</span>
description</a>,
<a href="../CliGen/BaseFlag.html#env_var%3AString%7CNil-instance-method" class="tooltip">
<span>env_var : String | Nil</span>
env_var</a>,
<a href="../CliGen/BaseFlag.html#long%3AString%7CNil-instance-method" class="tooltip">
<span>long : String | Nil</span>
long</a>,
<a href="../CliGen/BaseFlag.html#long_key%3AString-instance-method" class="tooltip">
<span>long_key : String</span>
long_key</a>,
<a href="../CliGen/BaseFlag.html#matches%3F%28token%3AString%29%3ABool-instance-method" class="tooltip">
<span>matches?(token : String) : Bool</span>
matches?</a>,
<a href="../CliGen/BaseFlag.html#raw_value%3AString%7CNil-instance-method" class="tooltip">
<span>raw_value : String | Nil</span>
raw_value</a>,
<a href="../CliGen/BaseFlag.html#satisfied%3F%3ABool-instance-method" class="tooltip">
<span>satisfied? : Bool</span>
satisfied?</a>,
<a href="../CliGen/BaseFlag.html#short%3AString%7CNil-instance-method" class="tooltip">
<span>short : String | Nil</span>
short</a>,
<a href="../CliGen/BaseFlag.html#validate%21%3ANil-instance-method" class="tooltip">
<span>validate! : Nil</span>
validate!</a>,
<a href="../CliGen/BaseFlag.html#var%3AString-instance-method" class="tooltip">
<span>var : String</span>
var</a>
<h3>Constructor methods inherited from class <code><a href="../CliGen/BaseFlag.html">CliGen::BaseFlag</a></code></h3>
<a href="../CliGen/BaseFlag.html#new%28var%3AString%2Cshort%3AString%7CNil%2Clong%3AString%7CNil%2Cenv_var%3AString%7CNil%2Cdescription%3AString%29-class-method" class="tooltip">
<span>new(var : String, short : String | Nil, long : String | Nil, env_var : String | Nil, description : String)</span>
new</a>
</div>
<h2>
<a id="constructor-detail" class="anchor" href="#constructor-detail">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Constructor Detail
</h2>
<div class="entry-detail" id="new(var:String,short:String|Nil,long:String|Nil,env_var:String|Nil,description:String,default:T|Nil=nil,options:Array(String)|Nil=nil,validate:T-&gt;Bool|Nil=nil,on_match:Proc(Nil)|Nil=nil)-class-method">
<div class="signature">
def self.<strong>new</strong>(var : String, short : String | Nil, long : String | Nil, env_var : String | Nil, description : String, default : T | Nil = <span class="n">nil</span>, options : Array(String) | Nil = <span class="n">nil</span>, validate : T -> Bool | Nil = <span class="n">nil</span>, on_match : Proc(Nil) | Nil = <span class="n">nil</span>)
<a class="method-permalink" href="#new%28var%3AString%2Cshort%3AString%7CNil%2Clong%3AString%7CNil%2Cenv_var%3AString%7CNil%2Cdescription%3AString%2Cdefault%3AT%7CNil%3Dnil%2Coptions%3AArray%28String%29%7CNil%3Dnil%2Cvalidate%3AT-%3EBool%7CNil%3Dnil%2Con_match%3AProc%28Nil%29%7CNil%3Dnil%29-class-method">#</a>
</div>
<br/>
<div>
</div>
</div>
<h2>
<a id="instance-method-detail" class="anchor" href="#instance-method-detail">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Instance Method Detail
</h2>
<div class="entry-detail" id="process(argv:Array(Arg)=[]ofArray(Arg)):Nil-instance-method">
<div class="signature">
def <strong>process</strong>(argv : Array(<a href="../CliGen/Arg.html">Arg</a>) = <span class="o">[]</span> <span class="k">of</span> <span class="t">Array</span>(<span class="t">Arg</span>)) : Nil
<a class="method-permalink" href="#process%28argv%3AArray%28Arg%29%3D%5B%5DofArray%28Arg%29%29%3ANil-instance-method">#</a>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="raw_value:String|Nil-instance-method">
<div class="signature">
def <strong>raw_value</strong> : String | Nil
<a class="method-permalink" href="#raw_value%3AString%7CNil-instance-method">#</a>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="requires_arg?:Bool-instance-method">
<div class="signature">
def <strong>requires_arg?</strong> : Bool
<a class="method-permalink" href="#requires_arg%3F%3ABool-instance-method">#</a>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="satisfied?:Bool-instance-method">
<div class="signature">
def <strong>satisfied?</strong> : Bool
<a class="method-permalink" href="#satisfied%3F%3ABool-instance-method">#</a>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="validate!:Nil-instance-method">
<div class="signature">
def <strong>validate!</strong> : Nil
<a class="method-permalink" href="#validate%21%3ANil-instance-method">#</a>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="value!:T-instance-method">
<div class="signature">
def <strong>value!</strong> : T
<a class="method-permalink" href="#value%21%3AT-instance-method">#</a>
</div>
<br/>
<div>
</div>
</div>
</div>
</body>
</html>
+257
View File
@@ -0,0 +1,257 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Crystal Docs 1.20.3">
<meta name="crystal_docs.project_version" content="object_rework-dev">
<meta name="crystal_docs.project_name" content="CliGenerator">
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/doc.js"></script>
<meta name="repository-name" content="CliGenerator">
<title>CliGen::Format - CliGenerator object_rework-dev</title>
<script type="text/javascript">
CrystalDocs.base_path = "../";
</script>
</head>
<body>
<svg class="hidden">
<symbol id="octicon-link" viewBox="0 0 16 16">
<path fill="currentColor" fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path>
</symbol>
</svg>
<input type="checkbox" id="sidebar-btn">
<label for="sidebar-btn" id="sidebar-btn-label">
<svg class="open" xmlns="http://www.w3.org/2000/svg" height="2em" width="2em" viewBox="0 0 512 512"><title>Open Sidebar</title><path fill="currentColor" d="M80 96v64h352V96H80zm0 112v64h352v-64H80zm0 112v64h352v-64H80z"></path></svg>
<svg class="close" xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" viewBox="0 0 512 512"><title>Close Sidebar</title><path fill="currentColor" d="m118.6 73.4-45.2 45.2L210.7 256 73.4 393.4l45.2 45.2L256 301.3l137.4 137.3 45.2-45.2L301.3 256l137.3-137.4-45.2-45.2L256 210.7Z"></path></svg>
</label>
<div class="sidebar">
<div class="sidebar-header">
<div class="search-box">
<input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search">
</div>
<div class="project-summary">
<h1 class="project-name">
<a href="../index.html">
CliGenerator
</a>
</h1>
<span class="project-version">
object_rework-dev
</span>
</div>
</div>
<div class="search-results hidden">
<ul class="search-list"></ul>
</div>
<div class="types-list">
<ul>
<li class="parent open current" data-id="CliGenerator/CliGen" data-name="cligen">
<a href="../CliGen.html">CliGen</a>
<ul>
<li class=" " data-id="CliGenerator/CliGen/AdditionalDefaultFlag" data-name="cligen::additionaldefaultflag">
<a href="../CliGen/AdditionalDefaultFlag.html">AdditionalDefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/App" data-name="cligen::app">
<a href="../CliGen/App.html">App</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Arg" data-name="cligen::arg">
<a href="../CliGen/Arg.html">Arg</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Argument" data-name="cligen::argument">
<a href="../CliGen/Argument.html">Argument</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/BaseFlag" data-name="cligen::baseflag">
<a href="../CliGen/BaseFlag.html">BaseFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Command" data-name="cligen::command">
<a href="../CliGen/Command.html">Command</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandInfo" data-name="cligen::commandinfo">
<a href="../CliGen/CommandInfo.html">CommandInfo</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandNode" data-name="cligen::commandnode">
<a href="../CliGen/CommandNode.html">CommandNode</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/DefaultFlag" data-name="cligen::defaultflag">
<a href="../CliGen/DefaultFlag.html">DefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Flag" data-name="cligen::flag(t)">
<a href="../CliGen/Flag.html">Flag</a>
</li>
<li class=" current" data-id="CliGenerator/CliGen/Format" data-name="cligen::format">
<a href="../CliGen/Format.html">Format</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/MatchType" data-name="cligen::matchtype">
<a href="../CliGen/MatchType.html">MatchType</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/ProxyCommand" data-name="cligen::proxycommand">
<a href="../CliGen/ProxyCommand.html">ProxyCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Regex" data-name="cligen::regex">
<a href="../CliGen/Regex.html">Regex</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Selection" data-name="cligen::selection">
<a href="../CliGen/Selection.html">Selection</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/SubCommand" data-name="cligen::subcommand">
<a href="../CliGen/SubCommand.html">SubCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Trigger" data-name="cligen::trigger">
<a href="../CliGen/Trigger.html">Trigger</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="main-content">
<h1 class="type-name">
<span class="kind">
module
</span> CliGen::<wbr>Format
</h1>
<h2>
<a id="defined-in" class="anchor" href="#defined-in">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Defined in:
</h2>
cligen/format.cr
<br/>
<h2>
<a id="constant-summary" class="anchor" href="#constant-summary">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Constant Summary
</h2>
<dl>
<dt class="entry-const" id="INPUT_DATE_FORMAT">
<strong>INPUT_DATE_FORMAT</strong> = <code><span class="s">&quot;%Y-%m-%d&quot;</span></code>
</dt>
<dt class="entry-const" id="INPUT_DATETIME_FORMAT">
<strong>INPUT_DATETIME_FORMAT</strong> = <code><span class="s">&quot;%Y-%m-%d %H:%M:%S&quot;</span></code>
</dt>
</dl>
<div class="methods-inherited">
</div>
</div>
</body>
</html>
+445
View File
@@ -0,0 +1,445 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Crystal Docs 1.20.3">
<meta name="crystal_docs.project_version" content="object_rework-dev">
<meta name="crystal_docs.project_name" content="CliGenerator">
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/doc.js"></script>
<meta name="repository-name" content="CliGenerator">
<title>CliGen::MatchType - CliGenerator object_rework-dev</title>
<script type="text/javascript">
CrystalDocs.base_path = "../";
</script>
</head>
<body>
<svg class="hidden">
<symbol id="octicon-link" viewBox="0 0 16 16">
<path fill="currentColor" fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path>
</symbol>
</svg>
<input type="checkbox" id="sidebar-btn">
<label for="sidebar-btn" id="sidebar-btn-label">
<svg class="open" xmlns="http://www.w3.org/2000/svg" height="2em" width="2em" viewBox="0 0 512 512"><title>Open Sidebar</title><path fill="currentColor" d="M80 96v64h352V96H80zm0 112v64h352v-64H80zm0 112v64h352v-64H80z"></path></svg>
<svg class="close" xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" viewBox="0 0 512 512"><title>Close Sidebar</title><path fill="currentColor" d="m118.6 73.4-45.2 45.2L210.7 256 73.4 393.4l45.2 45.2L256 301.3l137.4 137.3 45.2-45.2L301.3 256l137.3-137.4-45.2-45.2L256 210.7Z"></path></svg>
</label>
<div class="sidebar">
<div class="sidebar-header">
<div class="search-box">
<input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search">
</div>
<div class="project-summary">
<h1 class="project-name">
<a href="../index.html">
CliGenerator
</a>
</h1>
<span class="project-version">
object_rework-dev
</span>
</div>
</div>
<div class="search-results hidden">
<ul class="search-list"></ul>
</div>
<div class="types-list">
<ul>
<li class="parent open current" data-id="CliGenerator/CliGen" data-name="cligen">
<a href="../CliGen.html">CliGen</a>
<ul>
<li class=" " data-id="CliGenerator/CliGen/AdditionalDefaultFlag" data-name="cligen::additionaldefaultflag">
<a href="../CliGen/AdditionalDefaultFlag.html">AdditionalDefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/App" data-name="cligen::app">
<a href="../CliGen/App.html">App</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Arg" data-name="cligen::arg">
<a href="../CliGen/Arg.html">Arg</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Argument" data-name="cligen::argument">
<a href="../CliGen/Argument.html">Argument</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/BaseFlag" data-name="cligen::baseflag">
<a href="../CliGen/BaseFlag.html">BaseFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Command" data-name="cligen::command">
<a href="../CliGen/Command.html">Command</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandInfo" data-name="cligen::commandinfo">
<a href="../CliGen/CommandInfo.html">CommandInfo</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandNode" data-name="cligen::commandnode">
<a href="../CliGen/CommandNode.html">CommandNode</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/DefaultFlag" data-name="cligen::defaultflag">
<a href="../CliGen/DefaultFlag.html">DefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Flag" data-name="cligen::flag(t)">
<a href="../CliGen/Flag.html">Flag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Format" data-name="cligen::format">
<a href="../CliGen/Format.html">Format</a>
</li>
<li class=" current" data-id="CliGenerator/CliGen/MatchType" data-name="cligen::matchtype">
<a href="../CliGen/MatchType.html">MatchType</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/ProxyCommand" data-name="cligen::proxycommand">
<a href="../CliGen/ProxyCommand.html">ProxyCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Regex" data-name="cligen::regex">
<a href="../CliGen/Regex.html">Regex</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Selection" data-name="cligen::selection">
<a href="../CliGen/Selection.html">Selection</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/SubCommand" data-name="cligen::subcommand">
<a href="../CliGen/SubCommand.html">SubCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Trigger" data-name="cligen::trigger">
<a href="../CliGen/Trigger.html">Trigger</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="main-content">
<h1 class="type-name">
<span class="kind">
enum
</span> CliGen::<wbr>MatchType
</h1>
<h2>
<a id="defined-in" class="anchor" href="#defined-in">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Defined in:
</h2>
cligen/match_type.cr
<br/>
<h2>
<a id="enum-members" class="anchor" href="#enum-members">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Enum Members
</h2>
<dl>
<dt class="entry-const" id="FlagWithArg">
<strong>FlagWithArg</strong> = <code><span class="n">0</span></code>
</dt>
<dt class="entry-const" id="FlagMultipleShort">
<strong>FlagMultipleShort</strong> = <code><span class="n">1</span></code>
</dt>
<dt class="entry-const" id="ShortWithInlineArg">
<strong>ShortWithInlineArg</strong> = <code><span class="n">2</span></code>
</dt>
<dt class="entry-const" id="NoMatch">
<strong>NoMatch</strong> = <code><span class="n">3</span></code>
</dt>
</dl>
<h2>
<a id="instance-method-summary" class="anchor" href="#instance-method-summary">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Instance Method Summary
</h2>
<ul class="list-summary">
<li class="entry-summary">
<a href="#flag_multiple_short%3F-instance-method" class="signature"><strong>#flag_multiple_short?</strong></a>
<div class="summary"><p>Returns <code>true</code> if this enum value equals <code><a href="../CliGen/MatchType.html#FlagMultipleShort">FlagMultipleShort</a></code></p></div>
</li>
<li class="entry-summary">
<a href="#flag_with_arg%3F-instance-method" class="signature"><strong>#flag_with_arg?</strong></a>
<div class="summary"><p>Returns <code>true</code> if this enum value equals <code><a href="../CliGen/MatchType.html#FlagWithArg">FlagWithArg</a></code></p></div>
</li>
<li class="entry-summary">
<a href="#no_match%3F-instance-method" class="signature"><strong>#no_match?</strong></a>
<div class="summary"><p>Returns <code>true</code> if this enum value equals <code><a href="../CliGen/MatchType.html#NoMatch">NoMatch</a></code></p></div>
</li>
<li class="entry-summary">
<a href="#short_with_inline_arg%3F-instance-method" class="signature"><strong>#short_with_inline_arg?</strong></a>
<div class="summary"><p>Returns <code>true</code> if this enum value equals <code><a href="../CliGen/MatchType.html#ShortWithInlineArg">ShortWithInlineArg</a></code></p></div>
</li>
</ul>
<div class="methods-inherited">
</div>
<h2>
<a id="instance-method-detail" class="anchor" href="#instance-method-detail">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Instance Method Detail
</h2>
<div class="entry-detail" id="flag_multiple_short?-instance-method">
<div class="signature">
def <strong>flag_multiple_short?</strong>
<a class="method-permalink" href="#flag_multiple_short%3F-instance-method">#</a>
</div>
<div class="doc">
<p>Returns <code>true</code> if this enum value equals <code><a href="../CliGen/MatchType.html#FlagMultipleShort">FlagMultipleShort</a></code></p>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="flag_with_arg?-instance-method">
<div class="signature">
def <strong>flag_with_arg?</strong>
<a class="method-permalink" href="#flag_with_arg%3F-instance-method">#</a>
</div>
<div class="doc">
<p>Returns <code>true</code> if this enum value equals <code><a href="../CliGen/MatchType.html#FlagWithArg">FlagWithArg</a></code></p>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="no_match?-instance-method">
<div class="signature">
def <strong>no_match?</strong>
<a class="method-permalink" href="#no_match%3F-instance-method">#</a>
</div>
<div class="doc">
<p>Returns <code>true</code> if this enum value equals <code><a href="../CliGen/MatchType.html#NoMatch">NoMatch</a></code></p>
</div>
<br/>
<div>
</div>
</div>
<div class="entry-detail" id="short_with_inline_arg?-instance-method">
<div class="signature">
def <strong>short_with_inline_arg?</strong>
<a class="method-permalink" href="#short_with_inline_arg%3F-instance-method">#</a>
</div>
<div class="doc">
<p>Returns <code>true</code> if this enum value equals <code><a href="../CliGen/MatchType.html#ShortWithInlineArg">ShortWithInlineArg</a></code></p>
</div>
<br/>
<div>
</div>
</div>
</div>
</body>
</html>
+233
View File
@@ -0,0 +1,233 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Crystal Docs 1.20.3">
<meta name="crystal_docs.project_version" content="object_rework-dev">
<meta name="crystal_docs.project_name" content="CliGenerator">
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/doc.js"></script>
<meta name="repository-name" content="CliGenerator">
<title>CliGen::ProxyCommand - CliGenerator object_rework-dev</title>
<script type="text/javascript">
CrystalDocs.base_path = "../";
</script>
</head>
<body>
<svg class="hidden">
<symbol id="octicon-link" viewBox="0 0 16 16">
<path fill="currentColor" fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path>
</symbol>
</svg>
<input type="checkbox" id="sidebar-btn">
<label for="sidebar-btn" id="sidebar-btn-label">
<svg class="open" xmlns="http://www.w3.org/2000/svg" height="2em" width="2em" viewBox="0 0 512 512"><title>Open Sidebar</title><path fill="currentColor" d="M80 96v64h352V96H80zm0 112v64h352v-64H80zm0 112v64h352v-64H80z"></path></svg>
<svg class="close" xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" viewBox="0 0 512 512"><title>Close Sidebar</title><path fill="currentColor" d="m118.6 73.4-45.2 45.2L210.7 256 73.4 393.4l45.2 45.2L256 301.3l137.4 137.3 45.2-45.2L301.3 256l137.3-137.4-45.2-45.2L256 210.7Z"></path></svg>
</label>
<div class="sidebar">
<div class="sidebar-header">
<div class="search-box">
<input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search">
</div>
<div class="project-summary">
<h1 class="project-name">
<a href="../index.html">
CliGenerator
</a>
</h1>
<span class="project-version">
object_rework-dev
</span>
</div>
</div>
<div class="search-results hidden">
<ul class="search-list"></ul>
</div>
<div class="types-list">
<ul>
<li class="parent open current" data-id="CliGenerator/CliGen" data-name="cligen">
<a href="../CliGen.html">CliGen</a>
<ul>
<li class=" " data-id="CliGenerator/CliGen/AdditionalDefaultFlag" data-name="cligen::additionaldefaultflag">
<a href="../CliGen/AdditionalDefaultFlag.html">AdditionalDefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/App" data-name="cligen::app">
<a href="../CliGen/App.html">App</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Arg" data-name="cligen::arg">
<a href="../CliGen/Arg.html">Arg</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Argument" data-name="cligen::argument">
<a href="../CliGen/Argument.html">Argument</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/BaseFlag" data-name="cligen::baseflag">
<a href="../CliGen/BaseFlag.html">BaseFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Command" data-name="cligen::command">
<a href="../CliGen/Command.html">Command</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandInfo" data-name="cligen::commandinfo">
<a href="../CliGen/CommandInfo.html">CommandInfo</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandNode" data-name="cligen::commandnode">
<a href="../CliGen/CommandNode.html">CommandNode</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/DefaultFlag" data-name="cligen::defaultflag">
<a href="../CliGen/DefaultFlag.html">DefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Flag" data-name="cligen::flag(t)">
<a href="../CliGen/Flag.html">Flag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Format" data-name="cligen::format">
<a href="../CliGen/Format.html">Format</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/MatchType" data-name="cligen::matchtype">
<a href="../CliGen/MatchType.html">MatchType</a>
</li>
<li class=" current" data-id="CliGenerator/CliGen/ProxyCommand" data-name="cligen::proxycommand">
<a href="../CliGen/ProxyCommand.html">ProxyCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Regex" data-name="cligen::regex">
<a href="../CliGen/Regex.html">Regex</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Selection" data-name="cligen::selection">
<a href="../CliGen/Selection.html">Selection</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/SubCommand" data-name="cligen::subcommand">
<a href="../CliGen/SubCommand.html">SubCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Trigger" data-name="cligen::trigger">
<a href="../CliGen/Trigger.html">Trigger</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="main-content">
<h1 class="type-name">
<span class="kind">
annotation
</span> CliGen::<wbr>ProxyCommand
</h1>
<h2>
<a id="defined-in" class="anchor" href="#defined-in">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Defined in:
</h2>
cligen/annotations.cr
<br/>
<div class="methods-inherited">
</div>
</div>
</body>
</html>
+277
View File
@@ -0,0 +1,277 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Crystal Docs 1.20.3">
<meta name="crystal_docs.project_version" content="object_rework-dev">
<meta name="crystal_docs.project_name" content="CliGenerator">
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/doc.js"></script>
<meta name="repository-name" content="CliGenerator">
<title>CliGen::Regex - CliGenerator object_rework-dev</title>
<script type="text/javascript">
CrystalDocs.base_path = "../";
</script>
</head>
<body>
<svg class="hidden">
<symbol id="octicon-link" viewBox="0 0 16 16">
<path fill="currentColor" fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path>
</symbol>
</svg>
<input type="checkbox" id="sidebar-btn">
<label for="sidebar-btn" id="sidebar-btn-label">
<svg class="open" xmlns="http://www.w3.org/2000/svg" height="2em" width="2em" viewBox="0 0 512 512"><title>Open Sidebar</title><path fill="currentColor" d="M80 96v64h352V96H80zm0 112v64h352v-64H80zm0 112v64h352v-64H80z"></path></svg>
<svg class="close" xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" viewBox="0 0 512 512"><title>Close Sidebar</title><path fill="currentColor" d="m118.6 73.4-45.2 45.2L210.7 256 73.4 393.4l45.2 45.2L256 301.3l137.4 137.3 45.2-45.2L301.3 256l137.3-137.4-45.2-45.2L256 210.7Z"></path></svg>
</label>
<div class="sidebar">
<div class="sidebar-header">
<div class="search-box">
<input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search">
</div>
<div class="project-summary">
<h1 class="project-name">
<a href="../index.html">
CliGenerator
</a>
</h1>
<span class="project-version">
object_rework-dev
</span>
</div>
</div>
<div class="search-results hidden">
<ul class="search-list"></ul>
</div>
<div class="types-list">
<ul>
<li class="parent open current" data-id="CliGenerator/CliGen" data-name="cligen">
<a href="../CliGen.html">CliGen</a>
<ul>
<li class=" " data-id="CliGenerator/CliGen/AdditionalDefaultFlag" data-name="cligen::additionaldefaultflag">
<a href="../CliGen/AdditionalDefaultFlag.html">AdditionalDefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/App" data-name="cligen::app">
<a href="../CliGen/App.html">App</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Arg" data-name="cligen::arg">
<a href="../CliGen/Arg.html">Arg</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Argument" data-name="cligen::argument">
<a href="../CliGen/Argument.html">Argument</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/BaseFlag" data-name="cligen::baseflag">
<a href="../CliGen/BaseFlag.html">BaseFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Command" data-name="cligen::command">
<a href="../CliGen/Command.html">Command</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandInfo" data-name="cligen::commandinfo">
<a href="../CliGen/CommandInfo.html">CommandInfo</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandNode" data-name="cligen::commandnode">
<a href="../CliGen/CommandNode.html">CommandNode</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/DefaultFlag" data-name="cligen::defaultflag">
<a href="../CliGen/DefaultFlag.html">DefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Flag" data-name="cligen::flag(t)">
<a href="../CliGen/Flag.html">Flag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Format" data-name="cligen::format">
<a href="../CliGen/Format.html">Format</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/MatchType" data-name="cligen::matchtype">
<a href="../CliGen/MatchType.html">MatchType</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/ProxyCommand" data-name="cligen::proxycommand">
<a href="../CliGen/ProxyCommand.html">ProxyCommand</a>
</li>
<li class=" current" data-id="CliGenerator/CliGen/Regex" data-name="cligen::regex">
<a href="../CliGen/Regex.html">Regex</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Selection" data-name="cligen::selection">
<a href="../CliGen/Selection.html">Selection</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/SubCommand" data-name="cligen::subcommand">
<a href="../CliGen/SubCommand.html">SubCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Trigger" data-name="cligen::trigger">
<a href="../CliGen/Trigger.html">Trigger</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="main-content">
<h1 class="type-name">
<span class="kind">
module
</span> CliGen::<wbr>Regex
</h1>
<h2>
<a id="defined-in" class="anchor" href="#defined-in">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Defined in:
</h2>
cligen/regex.cr
<br/>
<h2>
<a id="constant-summary" class="anchor" href="#constant-summary">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Constant Summary
</h2>
<dl>
<dt class="entry-const" id="FLAG_MULTIPLE_SHORT">
<strong>FLAG_MULTIPLE_SHORT</strong> = <code><span class="s">/^-[a-zA-Z]+$/</span></code>
</dt>
<dt class="entry-const" id="FLAG_REGEX">
<strong>FLAG_REGEX</strong> = <code><span class="s">/^(-[a-zA-Z]|--[a-zA-Z-_]+)$/</span></code>
</dt>
<dt class="entry-const" id="FLAG_WITH_ARG">
<strong>FLAG_WITH_ARG</strong> = <code><span class="s">/^(?&lt;flag&gt;(-[a-zA-Z]|--[a-zA-Z-_]+))=&quot;?(?&lt;arg&gt;\S+?)&quot;?$/</span></code>
</dt>
<dt class="entry-const" id="INPUT_DATE_REGEX">
<strong>INPUT_DATE_REGEX</strong> = <code><span class="s">/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/</span></code>
</dt>
<dt class="entry-const" id="INPUT_DATETIME_REGEX">
<strong>INPUT_DATETIME_REGEX</strong> = <code><span class="s">/^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$/</span></code>
</dt>
<dt class="entry-const" id="SHORT_WITH_INLINE_ARG">
<strong>SHORT_WITH_INLINE_ARG</strong> = <code><span class="s">/^-[a-zA-Z][a-zA-Z0-9]+$/</span></code>
</dt>
</dl>
<div class="methods-inherited">
</div>
</div>
</body>
</html>
+233
View File
@@ -0,0 +1,233 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Crystal Docs 1.20.3">
<meta name="crystal_docs.project_version" content="object_rework-dev">
<meta name="crystal_docs.project_name" content="CliGenerator">
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/doc.js"></script>
<meta name="repository-name" content="CliGenerator">
<title>CliGen::Selection - CliGenerator object_rework-dev</title>
<script type="text/javascript">
CrystalDocs.base_path = "../";
</script>
</head>
<body>
<svg class="hidden">
<symbol id="octicon-link" viewBox="0 0 16 16">
<path fill="currentColor" fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path>
</symbol>
</svg>
<input type="checkbox" id="sidebar-btn">
<label for="sidebar-btn" id="sidebar-btn-label">
<svg class="open" xmlns="http://www.w3.org/2000/svg" height="2em" width="2em" viewBox="0 0 512 512"><title>Open Sidebar</title><path fill="currentColor" d="M80 96v64h352V96H80zm0 112v64h352v-64H80zm0 112v64h352v-64H80z"></path></svg>
<svg class="close" xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" viewBox="0 0 512 512"><title>Close Sidebar</title><path fill="currentColor" d="m118.6 73.4-45.2 45.2L210.7 256 73.4 393.4l45.2 45.2L256 301.3l137.4 137.3 45.2-45.2L301.3 256l137.3-137.4-45.2-45.2L256 210.7Z"></path></svg>
</label>
<div class="sidebar">
<div class="sidebar-header">
<div class="search-box">
<input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search">
</div>
<div class="project-summary">
<h1 class="project-name">
<a href="../index.html">
CliGenerator
</a>
</h1>
<span class="project-version">
object_rework-dev
</span>
</div>
</div>
<div class="search-results hidden">
<ul class="search-list"></ul>
</div>
<div class="types-list">
<ul>
<li class="parent open current" data-id="CliGenerator/CliGen" data-name="cligen">
<a href="../CliGen.html">CliGen</a>
<ul>
<li class=" " data-id="CliGenerator/CliGen/AdditionalDefaultFlag" data-name="cligen::additionaldefaultflag">
<a href="../CliGen/AdditionalDefaultFlag.html">AdditionalDefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/App" data-name="cligen::app">
<a href="../CliGen/App.html">App</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Arg" data-name="cligen::arg">
<a href="../CliGen/Arg.html">Arg</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Argument" data-name="cligen::argument">
<a href="../CliGen/Argument.html">Argument</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/BaseFlag" data-name="cligen::baseflag">
<a href="../CliGen/BaseFlag.html">BaseFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Command" data-name="cligen::command">
<a href="../CliGen/Command.html">Command</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandInfo" data-name="cligen::commandinfo">
<a href="../CliGen/CommandInfo.html">CommandInfo</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandNode" data-name="cligen::commandnode">
<a href="../CliGen/CommandNode.html">CommandNode</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/DefaultFlag" data-name="cligen::defaultflag">
<a href="../CliGen/DefaultFlag.html">DefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Flag" data-name="cligen::flag(t)">
<a href="../CliGen/Flag.html">Flag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Format" data-name="cligen::format">
<a href="../CliGen/Format.html">Format</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/MatchType" data-name="cligen::matchtype">
<a href="../CliGen/MatchType.html">MatchType</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/ProxyCommand" data-name="cligen::proxycommand">
<a href="../CliGen/ProxyCommand.html">ProxyCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Regex" data-name="cligen::regex">
<a href="../CliGen/Regex.html">Regex</a>
</li>
<li class=" current" data-id="CliGenerator/CliGen/Selection" data-name="cligen::selection">
<a href="../CliGen/Selection.html">Selection</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/SubCommand" data-name="cligen::subcommand">
<a href="../CliGen/SubCommand.html">SubCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Trigger" data-name="cligen::trigger">
<a href="../CliGen/Trigger.html">Trigger</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="main-content">
<h1 class="type-name">
<span class="kind">
annotation
</span> CliGen::<wbr>Selection
</h1>
<h2>
<a id="defined-in" class="anchor" href="#defined-in">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Defined in:
</h2>
cligen/annotations.cr
<br/>
<div class="methods-inherited">
</div>
</div>
</body>
</html>
+233
View File
@@ -0,0 +1,233 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Crystal Docs 1.20.3">
<meta name="crystal_docs.project_version" content="object_rework-dev">
<meta name="crystal_docs.project_name" content="CliGenerator">
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/doc.js"></script>
<meta name="repository-name" content="CliGenerator">
<title>CliGen::SubCommand - CliGenerator object_rework-dev</title>
<script type="text/javascript">
CrystalDocs.base_path = "../";
</script>
</head>
<body>
<svg class="hidden">
<symbol id="octicon-link" viewBox="0 0 16 16">
<path fill="currentColor" fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path>
</symbol>
</svg>
<input type="checkbox" id="sidebar-btn">
<label for="sidebar-btn" id="sidebar-btn-label">
<svg class="open" xmlns="http://www.w3.org/2000/svg" height="2em" width="2em" viewBox="0 0 512 512"><title>Open Sidebar</title><path fill="currentColor" d="M80 96v64h352V96H80zm0 112v64h352v-64H80zm0 112v64h352v-64H80z"></path></svg>
<svg class="close" xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" viewBox="0 0 512 512"><title>Close Sidebar</title><path fill="currentColor" d="m118.6 73.4-45.2 45.2L210.7 256 73.4 393.4l45.2 45.2L256 301.3l137.4 137.3 45.2-45.2L301.3 256l137.3-137.4-45.2-45.2L256 210.7Z"></path></svg>
</label>
<div class="sidebar">
<div class="sidebar-header">
<div class="search-box">
<input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search">
</div>
<div class="project-summary">
<h1 class="project-name">
<a href="../index.html">
CliGenerator
</a>
</h1>
<span class="project-version">
object_rework-dev
</span>
</div>
</div>
<div class="search-results hidden">
<ul class="search-list"></ul>
</div>
<div class="types-list">
<ul>
<li class="parent open current" data-id="CliGenerator/CliGen" data-name="cligen">
<a href="../CliGen.html">CliGen</a>
<ul>
<li class=" " data-id="CliGenerator/CliGen/AdditionalDefaultFlag" data-name="cligen::additionaldefaultflag">
<a href="../CliGen/AdditionalDefaultFlag.html">AdditionalDefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/App" data-name="cligen::app">
<a href="../CliGen/App.html">App</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Arg" data-name="cligen::arg">
<a href="../CliGen/Arg.html">Arg</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Argument" data-name="cligen::argument">
<a href="../CliGen/Argument.html">Argument</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/BaseFlag" data-name="cligen::baseflag">
<a href="../CliGen/BaseFlag.html">BaseFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Command" data-name="cligen::command">
<a href="../CliGen/Command.html">Command</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandInfo" data-name="cligen::commandinfo">
<a href="../CliGen/CommandInfo.html">CommandInfo</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandNode" data-name="cligen::commandnode">
<a href="../CliGen/CommandNode.html">CommandNode</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/DefaultFlag" data-name="cligen::defaultflag">
<a href="../CliGen/DefaultFlag.html">DefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Flag" data-name="cligen::flag(t)">
<a href="../CliGen/Flag.html">Flag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Format" data-name="cligen::format">
<a href="../CliGen/Format.html">Format</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/MatchType" data-name="cligen::matchtype">
<a href="../CliGen/MatchType.html">MatchType</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/ProxyCommand" data-name="cligen::proxycommand">
<a href="../CliGen/ProxyCommand.html">ProxyCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Regex" data-name="cligen::regex">
<a href="../CliGen/Regex.html">Regex</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Selection" data-name="cligen::selection">
<a href="../CliGen/Selection.html">Selection</a>
</li>
<li class=" current" data-id="CliGenerator/CliGen/SubCommand" data-name="cligen::subcommand">
<a href="../CliGen/SubCommand.html">SubCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Trigger" data-name="cligen::trigger">
<a href="../CliGen/Trigger.html">Trigger</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="main-content">
<h1 class="type-name">
<span class="kind">
annotation
</span> CliGen::<wbr>SubCommand
</h1>
<h2>
<a id="defined-in" class="anchor" href="#defined-in">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Defined in:
</h2>
cligen/annotations.cr
<br/>
<div class="methods-inherited">
</div>
</div>
</body>
</html>
+233
View File
@@ -0,0 +1,233 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Crystal Docs 1.20.3">
<meta name="crystal_docs.project_version" content="object_rework-dev">
<meta name="crystal_docs.project_name" content="CliGenerator">
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/doc.js"></script>
<meta name="repository-name" content="CliGenerator">
<title>CliGen::Trigger - CliGenerator object_rework-dev</title>
<script type="text/javascript">
CrystalDocs.base_path = "../";
</script>
</head>
<body>
<svg class="hidden">
<symbol id="octicon-link" viewBox="0 0 16 16">
<path fill="currentColor" fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path>
</symbol>
</svg>
<input type="checkbox" id="sidebar-btn">
<label for="sidebar-btn" id="sidebar-btn-label">
<svg class="open" xmlns="http://www.w3.org/2000/svg" height="2em" width="2em" viewBox="0 0 512 512"><title>Open Sidebar</title><path fill="currentColor" d="M80 96v64h352V96H80zm0 112v64h352v-64H80zm0 112v64h352v-64H80z"></path></svg>
<svg class="close" xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" viewBox="0 0 512 512"><title>Close Sidebar</title><path fill="currentColor" d="m118.6 73.4-45.2 45.2L210.7 256 73.4 393.4l45.2 45.2L256 301.3l137.4 137.3 45.2-45.2L301.3 256l137.3-137.4-45.2-45.2L256 210.7Z"></path></svg>
</label>
<div class="sidebar">
<div class="sidebar-header">
<div class="search-box">
<input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search">
</div>
<div class="project-summary">
<h1 class="project-name">
<a href="../index.html">
CliGenerator
</a>
</h1>
<span class="project-version">
object_rework-dev
</span>
</div>
</div>
<div class="search-results hidden">
<ul class="search-list"></ul>
</div>
<div class="types-list">
<ul>
<li class="parent open current" data-id="CliGenerator/CliGen" data-name="cligen">
<a href="../CliGen.html">CliGen</a>
<ul>
<li class=" " data-id="CliGenerator/CliGen/AdditionalDefaultFlag" data-name="cligen::additionaldefaultflag">
<a href="../CliGen/AdditionalDefaultFlag.html">AdditionalDefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/App" data-name="cligen::app">
<a href="../CliGen/App.html">App</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Arg" data-name="cligen::arg">
<a href="../CliGen/Arg.html">Arg</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Argument" data-name="cligen::argument">
<a href="../CliGen/Argument.html">Argument</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/BaseFlag" data-name="cligen::baseflag">
<a href="../CliGen/BaseFlag.html">BaseFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Command" data-name="cligen::command">
<a href="../CliGen/Command.html">Command</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandInfo" data-name="cligen::commandinfo">
<a href="../CliGen/CommandInfo.html">CommandInfo</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandNode" data-name="cligen::commandnode">
<a href="../CliGen/CommandNode.html">CommandNode</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/DefaultFlag" data-name="cligen::defaultflag">
<a href="../CliGen/DefaultFlag.html">DefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Flag" data-name="cligen::flag(t)">
<a href="../CliGen/Flag.html">Flag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Format" data-name="cligen::format">
<a href="../CliGen/Format.html">Format</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/MatchType" data-name="cligen::matchtype">
<a href="../CliGen/MatchType.html">MatchType</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/ProxyCommand" data-name="cligen::proxycommand">
<a href="../CliGen/ProxyCommand.html">ProxyCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Regex" data-name="cligen::regex">
<a href="../CliGen/Regex.html">Regex</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Selection" data-name="cligen::selection">
<a href="../CliGen/Selection.html">Selection</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/SubCommand" data-name="cligen::subcommand">
<a href="../CliGen/SubCommand.html">SubCommand</a>
</li>
<li class=" current" data-id="CliGenerator/CliGen/Trigger" data-name="cligen::trigger">
<a href="../CliGen/Trigger.html">Trigger</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="main-content">
<h1 class="type-name">
<span class="kind">
annotation
</span> CliGen::<wbr>Trigger
</h1>
<h2>
<a id="defined-in" class="anchor" href="#defined-in">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>
Defined in:
</h2>
cligen/annotations.cr
<br/>
<div class="methods-inherited">
</div>
</div>
</body>
</html>
+988
View File
@@ -0,0 +1,988 @@
:root {
color-scheme: light dark;
}
html, body {
background: #FFFFFF;
position: relative;
margin: 0;
padding: 0;
width: 100%;
height: 100%;
overflow: hidden;
}
body {
font-family: "Avenir", "Tahoma", "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif;
color: #333;
line-height: 1.5;
}
a {
color: #263F6C;
}
a:visited {
color: #112750;
}
h1, h2, h3, h4, h5, h6 {
margin: 35px 0 25px;
color: #444444;
}
h1.type-name {
color: #47266E;
margin: 20px 0 30px;
background-color: #F8F8F8;
padding: 10px 12px;
border: 1px solid #EBEBEB;
border-radius: 2px;
}
h2 {
border-bottom: 1px solid #E6E6E6;
padding-bottom: 5px;
}
body {
display: flex;
}
.sidebar, .main-content {
overflow: auto;
}
p, li {
max-width: 42em;
}
.methods-inherited {
max-width: 60em;
}
.sidebar {
width: 30em;
color: #F8F4FD;
background-color: #2E1052;
padding: 0 0 30px;
box-shadow: inset -3px 0 4px rgba(0,0,0,.35);
line-height: 1.2;
z-index: 0;
}
.sidebar .search-box {
padding: 13px 9px;
}
.sidebar input {
display: block;
box-sizing: border-box;
margin: 0;
padding: 5px;
font: inherit;
font-family: inherit;
line-height: 1.2;
width: 100%;
border: 0;
outline: 0;
border-radius: 2px;
box-shadow: 0px 3px 5px rgba(0,0,0,.25);
transition: box-shadow .12s;
}
.sidebar input:focus {
box-shadow: 0px 5px 6px rgba(0,0,0,.5);
}
.sidebar input::-webkit-input-placeholder { /* Chrome/Opera/Safari */
color: #757575;
font-size: 14px;
text-indent: 2px;
}
.sidebar input::-moz-placeholder { /* Firefox 19+ */
color: #757575;
font-size: 14px;
text-indent: 2px;
}
.sidebar input:-ms-input-placeholder { /* IE 10+ */
color: #757575;
font-size: 14px;
text-indent: 2px;
}
.sidebar input:-moz-placeholder { /* Firefox 18- */
color: #757575;
font-size: 14px;
text-indent: 2px;
}
.project-summary {
padding: 9px 15px 30px 30px;
}
.project-name {
font-size: 1.4rem;
margin: 0;
color: #f4f4f4;
font-weight: 600;
}
.project-version {
margin-top: 5px;
display: inline-block;
position: relative;
}
.project-version > form::after {
position: absolute;
right: 0;
top: 0;
content: "\25BC";
font-size: .6em;
line-height: 1.2rem;
z-index: -1;
}
.project-versions-nav {
cursor: pointer;
margin: 0;
padding: 0 .9em 0 0;
border: none;
-moz-appearance: none;
-webkit-appearance: none;
appearance: none;
background-color: transparent;
color: inherit;
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
.project-versions-nav:focus {
outline: none;
}
.project-versions-nav > option {
color: initial;
}
.sidebar ul {
margin: 0;
padding: 0;
list-style: none outside;
}
.sidebar li {
display: block;
position: relative;
}
.types-list li.hide {
display: none;
}
.sidebar a {
text-decoration: none;
color: inherit;
transition: color .14s;
}
.types-list a {
display: block;
padding: 5px 15px 5px 30px;
}
.types-list {
display: block;
}
.sidebar a:focus {
outline: 1px solid #D1B7F1;
}
.types-list a {
padding: 5px 15px 5px 30px;
}
.sidebar .current > a,
.sidebar a:hover {
color: #866BA6;
}
.types-list li ul {
overflow: hidden;
height: 0;
max-height: 0;
transition: 1s ease-in-out;
}
.types-list li.parent {
padding-left: 30px;
}
.types-list li.parent::before {
box-sizing: border-box;
content: "▼";
display: block;
width: 30px;
height: 30px;
position: absolute;
top: 0;
left: 0;
text-align: center;
color: white;
font-size: 8px;
line-height: 30px;
transform: rotateZ(-90deg);
cursor: pointer;
transition: .2s linear;
}
.types-list li.parent > a {
padding-left: 0;
}
.types-list li.parent.open::before {
transform: rotateZ(0);
}
.types-list li.open > ul {
height: auto;
max-height: 1000em;
}
.main-content {
padding: 0 30px 30px 30px;
width: 100%;
}
.kind {
font-size: 60%;
color: #866BA6;
}
.superclass-hierarchy {
margin: -15px 0 30px 0;
padding: 0;
list-style: none outside;
font-size: 80%;
}
.superclass-hierarchy .superclass {
display: inline-block;
margin: 0 7px 0 0;
padding: 0;
}
.superclass-hierarchy .superclass + .superclass::before {
content: "<";
margin-right: 7px;
}
.other-types-list li {
display: inline-block;
}
.other-types-list,
.list-summary {
margin: 0 0 30px 0;
padding: 0;
list-style: none outside;
}
.entry-const {
font-family: Menlo, Monaco, Consolas, 'Courier New', Courier, monospace;
}
.entry-const code {
white-space: pre-wrap;
}
.entry-summary {
padding-bottom: 4px;
}
.superclass-hierarchy .superclass a,
.other-type a,
.entry-summary .signature {
padding: 4px 8px;
margin-bottom: 4px;
display: inline-block;
background-color: #f8f8f8;
color: #47266E;
border: 1px solid #f0f0f0;
text-decoration: none;
border-radius: 3px;
font-family: Menlo, Monaco, Consolas, 'Courier New', Courier, monospace;
transition: background .15s, border-color .15s;
}
.superclass-hierarchy .superclass a:hover,
.other-type a:hover,
.entry-summary .signature:hover {
background: #D5CAE3;
border-color: #624288;
}
.entry-summary .summary {
padding-left: 32px;
}
.entry-summary .summary p {
margin: 12px 0 16px;
}
.entry-summary a {
text-decoration: none;
}
.entry-detail {
padding: 30px 0;
}
.entry-detail .signature {
position: relative;
padding: 5px 15px;
margin-bottom: 10px;
display: block;
border-radius: 5px;
background-color: #f8f8f8;
color: #47266E;
border: 1px solid #f0f0f0;
font-family: Menlo, Monaco, Consolas, 'Courier New', Courier, monospace;
transition: .2s ease-in-out;
}
.entry-detail:target .signature {
background-color: #D5CAE3;
border: 1px solid #624288;
}
.entry-detail .signature .method-permalink {
position: absolute;
top: 0;
left: -35px;
padding: 5px 15px;
text-decoration: none;
font-weight: bold;
color: #624288;
opacity: .4;
transition: opacity .2s;
}
.entry-detail .signature .method-permalink:hover {
opacity: 1;
}
.entry-detail:target .signature .method-permalink {
opacity: 1;
}
.methods-inherited {
padding-right: 10%;
line-height: 1.5em;
}
.methods-inherited h3 {
margin-bottom: 4px;
}
.methods-inherited a {
display: inline-block;
text-decoration: none;
color: #47266E;
}
.methods-inherited a:hover {
text-decoration: underline;
color: #6C518B;
}
.methods-inherited .tooltip>span {
background: #D5CAE3;
padding: 4px 8px;
border-radius: 3px;
margin: -4px -8px;
}
.methods-inherited .tooltip * {
color: #47266E;
}
pre {
padding: 10px 20px;
margin-top: 4px;
border-radius: 3px;
line-height: 1.45;
overflow: auto;
color: #333;
background: #fdfdfd;
font-size: 14px;
border: 1px solid #eee;
}
code {
font-family: Menlo, Monaco, Consolas, 'Courier New', Courier, monospace;
}
:not(pre) > code {
background-color: rgba(40,35,30,0.05);
padding: 0.2em 0.4em;
font-size: 85%;
border-radius: 3px;
}
span.flag {
padding: 2px 4px 1px;
border-radius: 3px;
margin-right: 3px;
font-size: 11px;
border: 1px solid transparent;
}
span.flag.orange {
background-color: #EE8737;
color: #FCEBDD;
border-color: #EB7317;
}
span.flag.yellow {
background-color: #E4B91C;
color: #FCF8E8;
border-color: #B69115;
}
span.flag.green {
background-color: #469C14;
color: #E2F9D3;
border-color: #34700E;
}
span.flag.red {
background-color: #BF1919;
color: #F9ECEC;
border-color: #822C2C;
}
span.flag.purple {
background-color: #2E1052;
color: #ECE1F9;
border-color: #1F0B37;
}
span.flag.lime {
background-color: #a3ff00;
color: #222222;
border-color: #00ff1e;
}
.tooltip>span {
position: absolute;
opacity: 0;
display: none;
pointer-events: none;
}
.tooltip:hover>span {
display: inline-block;
opacity: 1;
}
.c {
color: #969896;
}
.n {
color: #0086b3;
}
.t {
color: #0086b3;
}
.s {
color: #183691;
}
.i {
color: #7f5030;
}
.k {
color: #a71d5d;
}
.o {
color: #a71d5d;
}
.m {
color: #795da3;
}
.hidden {
display: none;
}
.search-results {
font-size: 90%;
line-height: 1.3;
}
.search-results mark {
color: inherit;
background: transparent;
font-weight: bold;
}
.search-result {
padding: 5px 8px 5px 5px;
cursor: pointer;
border-left: 5px solid transparent;
transform: translateX(-3px);
transition: all .2s, background-color 0s, border .02s;
min-height: 3.2em;
}
.search-result.current {
border-left-color: #ddd;
background-color: rgba(200,200,200,0.4);
transform: translateX(0);
transition: all .2s, background-color .5s, border 0s;
}
.search-result.current:hover,
.search-result.current:focus {
border-left-color: #866BA6;
}
.search-result:not(.current):nth-child(2n) {
background-color: rgba(255,255,255,.06);
}
.search-result__title {
font-size: 105%;
word-break: break-all;
line-height: 1.1;
padding: 3px 0;
}
.search-result__title strong {
font-weight: normal;
}
.search-results .search-result__title > a {
padding: 0;
display: block;
}
.search-result__title > a > .args {
color: #dddddd;
font-weight: 300;
transition: inherit;
font-size: 88%;
line-height: 1.2;
letter-spacing: -.02em;
}
.search-result__title > a > .args * {
color: inherit;
}
.search-result a,
.search-result a:hover {
color: inherit;
}
.search-result:not(.current):hover .search-result__title > a,
.search-result:not(.current):focus .search-result__title > a,
.search-result__title > a:focus {
color: #866BA6;
}
.search-result:not(.current):hover .args,
.search-result:not(.current):focus .args {
color: #6a5a7d;
}
.search-result__type {
color: #e8e8e8;
font-weight: 300;
}
.search-result__doc {
color: #bbbbbb;
font-size: 90%;
}
.search-result__doc p {
margin: 0;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
line-height: 1.2em;
max-height: 2.4em;
}
.js-modal-visible .modal-background {
display: flex;
}
.main-content {
position: relative;
}
.modal-background {
position: absolute;
display: none;
height: 100%;
width: 100%;
background: rgba(120,120,120,.4);
z-index: 100;
align-items: center;
justify-content: center;
}
.usage-modal {
max-width: 90%;
background: #fff;
border: 2px solid #ccc;
border-radius: 9px;
padding: 5px 15px 20px;
min-width: 50%;
color: #555;
position: relative;
transform: scale(.5);
transition: transform 200ms;
}
.js-modal-visible .usage-modal {
transform: scale(1);
}
.usage-modal > .close-button {
position: absolute;
right: 15px;
top: 8px;
color: #aaa;
font-size: 27px;
cursor: pointer;
}
.usage-modal > .close-button:hover {
text-shadow: 2px 2px 2px #ccc;
color: #999;
}
.modal-title {
margin: 0;
text-align: center;
font-weight: normal;
color: #666;
border-bottom: 2px solid #ddd;
padding: 10px;
}
.usage-list {
padding: 0;
margin: 13px;
}
.usage-list > li {
padding: 5px 2px;
overflow: auto;
padding-left: 100px;
min-width: 12em;
}
.usage-modal kbd {
background: #eee;
border: 1px solid #ccc;
border-bottom-width: 2px;
border-radius: 3px;
padding: 3px 8px;
font-family: monospace;
margin-right: 2px;
display: inline-block;
}
.usage-key {
float: left;
clear: left;
margin-left: -100px;
margin-right: 12px;
}
.doc-inherited {
font-weight: bold;
}
.anchor {
float: left;
padding-right: 4px;
margin-left: -20px;
}
.main-content .anchor .octicon-link {
width: 16px;
height: 16px;
}
.main-content .anchor:focus {
outline: none
}
.main-content h1:hover .anchor,
.main-content h2:hover .anchor,
.main-content h3:hover .anchor,
.main-content h4:hover .anchor,
.main-content h5:hover .anchor,
.main-content h6:hover .anchor {
text-decoration: none
}
.main-content h1 .octicon-link,
.main-content h2 .octicon-link,
.main-content h3 .octicon-link,
.main-content h4 .octicon-link,
.main-content h5 .octicon-link,
.main-content h6 .octicon-link {
visibility: hidden
}
.main-content h1:hover .anchor .octicon-link,
.main-content h2:hover .anchor .octicon-link,
.main-content h3:hover .anchor .octicon-link,
.main-content h4:hover .anchor .octicon-link,
.main-content h5:hover .anchor .octicon-link,
.main-content h6:hover .anchor .octicon-link {
visibility: visible
}
img {
max-width: 100%;
}
table {
font-size: 14px;
display: block;
max-width: -moz-fit-content;
max-width: fit-content;
overflow-x: auto;
white-space: nowrap;
background: #fdfdfd;
text-align: center;
border: 1px solid #eee;
border-collapse: collapse;
padding: 0px 5px 0px 5px;
}
table th {
padding: 10px;
letter-spacing: 1px;
border-bottom: 1px solid #eee;
}
table td {
padding: 10px;
}
#sidebar-btn {
height: 32px;
width: 32px;
}
#sidebar-btn-label {
height: 2em;
width: 2em;
}
#sidebar-btn, #sidebar-btn-label {
display: none;
margin: .7rem;
appearance: none;
color: black;
cursor: pointer;
}
@media only screen and (max-width: 635px) {
.sidebar, .main-content {
/* svg size + vertical margin - .search-box padding-top */
padding-top: calc(2em + 2 * 0.7rem - 13px);
}
#sidebar-btn, #sidebar-btn-label {
display: block;
position: absolute;
z-index: 50;
transition-duration: 200ms;
left: 0;
}
#sidebar-btn:not(:checked) ~ #sidebar-btn-label > .close,
#sidebar-btn:checked ~ #sidebar-btn-label > .open,
#sidebar-btn:checked ~ .main-content {
display: none;
}
#sidebar-btn:checked {
left: calc(100% - 32px - (2 * 0.7rem));
}
#sidebar-btn:checked ~ #sidebar-btn-label {
color: white;
/* 100% - svg size - horizontal margin */
left: calc(100% - 2em - (2 * 0.7rem));
}
#sidebar-btn~.sidebar {
width: 0%;
}
#sidebar-btn:checked~.sidebar {
visibility: visible;
width: 100%;
}
.sidebar {
transition-duration: 200ms;
max-width: 100vw;
visibility: hidden;
}
}
@media (prefers-color-scheme: dark) {
html, body {
background: #1b1b1b;
}
body {
color: white;
}
a {
color: #8cb4ff;
}
.main-content a:visited {
color: #5f8de3;
}
h1, h2, h3, h4, h5, h6 {
color: white;
}
h1.type-name {
color: white;
background-color: #202020;
border: 1px solid #353535;
}
.project-versions-nav > option {
background-color: #222;
}
.superclass-hierarchy .superclass a,
.superclass-hierarchy .superclass a:visited,
.other-type a,
.other-type a:visited,
.entry-summary .signature,
.entry-summary a:visited {
background-color: #202020;
color: white;
border: 1px solid #353535;
}
.superclass-hierarchy .superclass a:hover,
.other-type a:hover,
.entry-summary .signature:hover {
background: #443d4d;
border-color: #b092d4;
}
.kind {
color: #b092d4;
}
.n {
color: #00ade6;
}
.t {
color: #00ade6;
}
.k {
color: #ff66ae;
}
.o {
color: #ff66ae;
}
.s {
color: #7799ff;
}
.i {
color: #b38668;
}
.m {
color: #b9a5d6;
}
.c {
color: #a1a1a1;
}
.methods-inherited a, .methods-inherited a:visited {
color: #B290D9;
}
.methods-inherited a:hover {
color: #D4B7F4;
}
.methods-inherited .tooltip>span {
background: #443d4d;
}
.methods-inherited .tooltip * {
color: white;
}
.entry-detail:target .signature {
background-color: #443d4d;
border: 1px solid #b092d4;
}
.entry-detail .signature {
background-color: #202020;
color: white;
border: 1px solid #353535;
}
.entry-detail .signature .method-permalink {
color: #b092d4;
}
:not(pre)>code {
background-color: #202020;
}
span.flag.purple {
background-color: #443d4d;
color: #ECE1F9;
border-color: #b092d4;
}
.sidebar input::-webkit-input-placeholder { /* Chrome/Opera/Safari */
color: white;
}
.sidebar input::-moz-placeholder { /* Firefox 19+ */
color: white;
}
.sidebar input:-ms-input-placeholder { /* IE 10+ */
color: white;
}
.sidebar input:-moz-placeholder { /* Firefox 18- */
color: white;
}
pre,
table {
color: white;
background: #202020;
border: 1px solid #353535;
}
table th {
border-bottom: 1px solid #353535;
}
#sidebar-btn, #sidebar-btn-label {
color: white;
}
}
+199
View File
@@ -0,0 +1,199 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Crystal Docs 1.20.3">
<meta name="crystal_docs.project_version" content="object_rework-dev">
<meta name="crystal_docs.project_name" content="CliGenerator">
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/doc.js"></script>
<meta name="repository-name" content="CliGenerator">
<title>CliGenerator object_rework-dev</title>
<script type="text/javascript">
CrystalDocs.base_path = "";
</script>
</head>
<body>
<svg class="hidden">
<symbol id="octicon-link" viewBox="0 0 16 16">
<path fill="currentColor" fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path>
</symbol>
</svg>
<input type="checkbox" id="sidebar-btn">
<label for="sidebar-btn" id="sidebar-btn-label">
<svg class="open" xmlns="http://www.w3.org/2000/svg" height="2em" width="2em" viewBox="0 0 512 512"><title>Open Sidebar</title><path fill="currentColor" d="M80 96v64h352V96H80zm0 112v64h352v-64H80zm0 112v64h352v-64H80z"></path></svg>
<svg class="close" xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" viewBox="0 0 512 512"><title>Close Sidebar</title><path fill="currentColor" d="m118.6 73.4-45.2 45.2L210.7 256 73.4 393.4l45.2 45.2L256 301.3l137.4 137.3 45.2-45.2L301.3 256l137.3-137.4-45.2-45.2L256 210.7Z"></path></svg>
</label>
<div class="sidebar">
<div class="sidebar-header">
<div class="search-box">
<input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search">
</div>
<div class="project-summary">
<h1 class="project-name">
<a href="index.html">
CliGenerator
</a>
</h1>
<span class="project-version">
object_rework-dev
</span>
</div>
</div>
<div class="search-results hidden">
<ul class="search-list"></ul>
</div>
<div class="types-list">
<ul>
<li class="parent " data-id="CliGenerator/CliGen" data-name="cligen">
<a href="CliGen.html">CliGen</a>
<ul>
<li class=" " data-id="CliGenerator/CliGen/AdditionalDefaultFlag" data-name="cligen::additionaldefaultflag">
<a href="CliGen/AdditionalDefaultFlag.html">AdditionalDefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/App" data-name="cligen::app">
<a href="CliGen/App.html">App</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Arg" data-name="cligen::arg">
<a href="CliGen/Arg.html">Arg</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Argument" data-name="cligen::argument">
<a href="CliGen/Argument.html">Argument</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/BaseFlag" data-name="cligen::baseflag">
<a href="CliGen/BaseFlag.html">BaseFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Command" data-name="cligen::command">
<a href="CliGen/Command.html">Command</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandInfo" data-name="cligen::commandinfo">
<a href="CliGen/CommandInfo.html">CommandInfo</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/CommandNode" data-name="cligen::commandnode">
<a href="CliGen/CommandNode.html">CommandNode</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/DefaultFlag" data-name="cligen::defaultflag">
<a href="CliGen/DefaultFlag.html">DefaultFlag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Flag" data-name="cligen::flag(t)">
<a href="CliGen/Flag.html">Flag</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Format" data-name="cligen::format">
<a href="CliGen/Format.html">Format</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/MatchType" data-name="cligen::matchtype">
<a href="CliGen/MatchType.html">MatchType</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/ProxyCommand" data-name="cligen::proxycommand">
<a href="CliGen/ProxyCommand.html">ProxyCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Regex" data-name="cligen::regex">
<a href="CliGen/Regex.html">Regex</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Selection" data-name="cligen::selection">
<a href="CliGen/Selection.html">Selection</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/SubCommand" data-name="cligen::subcommand">
<a href="CliGen/SubCommand.html">SubCommand</a>
</li>
<li class=" " data-id="CliGenerator/CliGen/Trigger" data-name="cligen::trigger">
<a href="CliGen/Trigger.html">Trigger</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="main-content">
<h1><a id="cli-generator" class="anchor" href="#cli-generator"> <svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>CliGenerator</h1>
<p>This is a crystal project to manage setting up OptionParser objects based around &quot;Command&quot; objects and arguments you define inside them.</p>
<h2><a id="installation" class="anchor" href="#installation">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>Installation</h2>
<ol>
<li>
<p>Add the dependency to your <code>shard.yml</code>:</p>
<pre><code class="language-yaml">dependencies:
cligen:
git: https://git.arcanium.tech/tristan/cligen</code></pre>
</li>
<li>
<p>Run <code>shards install</code></p>
</li>
</ol>
<h2><a id="usage" class="anchor" href="#usage">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>Usage</h2>
<pre><code class="language-crystal"><span class="k">require</span> <span class="s">&quot;cligen&quot;</span></code></pre>
<h2><a id="contributors" class="anchor" href="#contributors">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>Contributors</h2>
<ul>
<li><a href="https://git.arcanium.tech/tristan">Tristan Ancelet</a> - creator and maintainer</li>
</ul>
</div>
</body>
</html>
+1
View File
File diff suppressed because one or more lines are too long
+1099
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
Symlink
+1
View File
@@ -0,0 +1 @@
..
-131
View File
@@ -1,131 +0,0 @@
require "spec"
require "../src/command"
@[CliGen::CommandInfo(description: "Test")]
class CommandSubclass < CliGen::Command
define_argument(testvar,
type: Int32,
long: "--testvar TESTVAR",
description: "Does things"
)
define_argument(testvar_the_return,
type: Int32,
def_getter: true,
long: "--testvar_the_return TESTVAR",
description: "Does things"
)
end
EXAMPLES = [
"Have test"
]
@[CliGen::SubCommand(description: "test", examples: ::EXAMPLES)]
def CommandSubclass.do_thing
puts "HI"
end
@[CliGen::CommandPreRun]
def CommandSubclass.check_things
puts "I was run"
end
## Need to make sure EVERYTHING is generated before testing
macro finished
describe CliGen::Command do
describe "subclassing" do
describe "Creates the arguments" do
it "has testvar" do
{{CommandSubclass.class.has_method?(:testvar)}}.should be_true
end
it "has testvar2 getter" do
{{CommandSubclass.class.has_method?(:get_testvar_the_return)}}.should be_true
end
end
it "has Header" do
CommandSubclass::HEADER.empty?.should be_false
end
it "has examples" do
CommandSubclass::HEADER.includes?("Examples").should be_true
end
{% pre_runs = CommandSubclass.class.methods.select(&.annotation(::CliGen::CommandPreRun)) %}
{% run = CommandSubclass.class.methods.find{|m| m.name.stringify == "run"}.stringify %}
{% if pre_runs.size > 0 %}
describe "when defining pre-run methods" do
{% for pre_run in pre_runs %}
it "generates {{pre_run.name}}" do
{{run}}.includes?({{pre_run.name.stringify}}).should be_true
end
{% end %}
end
{% end %}
{% subcommands = CommandSubclass.class.methods.select(&.annotation(::CliGen::SubCommand)) %}
{% unless subcommands.empty? %}
describe "should have subcommands" do
{% for subcommand in subcommands %}
it "has {{subcommand.name}}" do
{{CommandSubclass.class.has_method?(subcommand.name.symbolize)}}.should be_true
end
{% end %}
end
{% end %}
{% arguments = CommandSubclass.class.methods.select(&.annotation(::CliGen::CommandArgument)) %}
{% unless arguments.empty? %}
describe "should have arguments" do
{% for argument in arguments %}
it "has {{argument.name}}" do
{{CommandSubclass.class.has_method?(argument.name.symbolize)}}.should be_true
end
{% end %}
end
{% end %}
{% if [arguments, subcommands].any?{|i| i.size >= 0 } %}
describe "should have generated OptionParser parser.on" do
{{ make_parser = CommandSubclass.class.methods.find{|m| m.name.stringify == "make_parser"}.stringify}}
{% unless subcommands.empty? %}
describe "for subcommands" do
{% for command in subcommands %}
it "has {{command.name}}" do
{{make_parser}}.includes?("on(" + {{command.name.stringify.stringify}}).should be_true
end
{% end %}
end
{% end %}
{% unless arguments.empty? %}
describe "for arguments" do
{% for argument in arguments %}
{% anno = argument.annotation(::CliGen::CommandArgument) %}
it "has " + {{anno[:long].stringify}} do
{{make_parser}}.includes?({{anno[:long]}}).should be_true
end
{% end %}
end
{% end %}
end
{% end %}
describe "Should have generated macro class methods" do
it "has generated run" do
{{CommandSubclass.class.has_method?(:run)}}.should be_true
end
it "has generated make_parser" do
{{CommandSubclass.class.has_method?(:make_parser)}}.should be_true
end
end
end
end
end
+15 -75
View File
@@ -1,11 +1,24 @@
require "option_parser" require "./cligen/exceptions"
require "./cligen/regex" require "./cligen/coercable"
require "./cligen/parsable"
require "./cligen/annotations"
require "./cligen/format" require "./cligen/format"
require "./cligen/regex"
require "./cligen/flag"
require "./cligen/command"
require "./cligen/command_node"
require "./cligen/app"
module CliGen module CliGen
VERSION = "0.1.0" VERSION = "0.1.0"
macro override_help_template(filepath)
{% raise "ERROR : CliGen.override_help_template : File(#{filepath}) doesn't exist" unless file_exists?(filepath) %}
CliGen::HELP_OVERRIDE_TEMPLATE = {{`readlink -f #{filepath}`.strip.stringify}}
end
APPNAME = File.basename(PROGRAM_NAME) APPNAME = File.basename(PROGRAM_NAME)
record AdditionalDefaultFlag, record AdditionalDefaultFlag,
short : String, short : String,
long : String, long : String,
@@ -26,78 +39,5 @@ module CliGen
annotation DefaultFlag annotation DefaultFlag
end end
macro define_section(section_name, parser)
{{parser}}.separator ""
{{parser}}.separator "{{section_name.id}}".colorize(:green)
{{parser}}.separator "-------------------------------------------------------------------------------".colorize(:blue)
end
alias OnType = Tuple(String, String) | Tuple(String, String, String)
macro define_default_flags(parser)
CliGen.define_section("Misc Flags", {{parser}})
{{parser}}.on("-h", "--help", "Print out this help output"){ abort {{parser}} }
{{parser}}.invalid_option{|opt|
abort "#{CliGen::APPNAME} : invalid_option : Inavlid option provided #{opt}"
}
{{parser}}.invalid_option{|opt|
case opt
when /^-+[a-z-]+/
STDERR.puts "#{CliGen::APPNAME} : ERROR : {{@type.name}} : {{parser}} : invalid_option : Inavlid option provided #{opt}"
else
abort "#{CliGen::APPNAME} : ERROR : {{@type.name}} : {{parser}} : invalid_option : Inavlid option provided #{opt}"
end
}
{{parser}}.missing_option{|opt|
abort "ERROR : {{@type.name}} : {{parser}} : missing_option : Argument was not provided to #{opt}"
}
{{parser}}.unknown_args{|opt|
unless opt.empty?
case opt.first
when /^-+[a-z-]+$/
STDERR.puts "ERROR : {{@type.name}} : {{parser}} : unknown_args : #{opt} not a configured argument"
else
abort "ERROR : {{@type.name}} : {{parser}} : unknown_args : #{opt} not a configured argument"
end
end
}
CliGen::ADDITIONAL_DEFAULT_FLAGS.each do |flag|
if [ flag.short, flag.long ].all?(&.!= "")
{{parser}}.on(flag.short, flag.long, flag.description){|var| flag.work.call(var) }
elsif flag.short != ""
{{parser}}.on(flag.short, flag.description){|var| flag.work.call(var) }
elsif flag.long != ""
{{parser}}.on(flag.long, flag.description){|var| flag.work.call(var) }
end
end
end
macro define_root_parser
ROOT_COMMAND = OptionParser.new do |parser|
parser.banner = "#{CliGen::APPNAME} [command] [flags]"
{% commands = ::CliGen::Command.subclasses %}
{% raise "ERROR : No commands defined (no subclasses of ::CliGen::Command were found)" if commands.empty? %}
CliGen.define_section("Commands", parser)
{% for command in commands %}
{{command.name}}.make_parser(parser)
{% end %}
CliGen.define_default_flags(parser)
abort parser if ARGV.empty?
end
end
macro finished
define_root_parser
end
def self.parse
ROOT_COMMAND.parse
end
end end
require "./cligen/command"
+22
View File
@@ -0,0 +1,22 @@
module CliGen
annotation ProxyCommand
end
annotation CommandInfo
end
annotation Argument
end
annotation Trigger
end
annotation Selection
end
annotation PreRunCommand
end
annotation SubCommand
end
end
+42
View File
@@ -0,0 +1,42 @@
require "./arg"
require "./command_node"
require "./flag"
require "./app/generate"
module CliGen
# Root entry point. Holds a flattened copy of all flags from every command
# for global-flag matching, then hands off to the matched child CommandNode.
class App < CliGen::CommandNode(Nil)
@@instance : self?
def initialize(@name, flags : Array(BaseFlag), commands : Array(BaseCommandNode), pre_run_commands : Array(RunCommand), post_run_commands : Array(RunCommand))
super(name: @name, flags: flags, commands: commands, pre_run_commands: pre_run_commands, post_run_commands: post_run_commands)
@@instance = self
end
def check!
super
end
def self.handle_command_raises(&) : Nil
begin
yield
rescue e : CliGen::RuntimeError
abort e.message
rescue e : CliGen::ConfigurationError
abort e.message
rescue e : CliGen::HelpRequestedError
puts e.message
exit 0
end
end
# Convenience entry point; defaults to ARGV
def self.process(args : Array(String) = ARGV.to_a) : Nil
generate if @@instance.nil?
handle_command_raises do
@@instance.not_nil!.process(args)
end
end
end
end
+64
View File
@@ -0,0 +1,64 @@
module CliGen
macro finished
class App
private def self.generate
app_flags = [] of BaseFlag
app_commands = [] of BaseCommandNode
{% verbatim do %}
{% for cmd in CliGen::Command.subclasses %}
{% cmd_info = cmd.annotation(CliGen::CommandInfo) %}
{% raise "ERROR : CliGen::App.generate : No CliGen::CommandInfo annotation made for #{cmd.name}" unless cmd_info %}
{% raise "ERROR : CliGen::App.generate : Description must be provided for #{cmd.name}" unless cmd_info[:description].is_a? StringLiteral %}
{% cmd_name = cmd.name.split("::").last.downcase %}
{% cmd_flags = cmd.instance_vars.select{|v| v.annotation(CliGen::Argument) || v.annotation(CliGen::Selection) } %}
cmd_flags = [] of BaseFlag
cmd_sub_commands = [] of BaseCommandNode
cmd_pre_run_cmds = [] of Proc(Nil)
cmd_post_run_cmds = [] of Proc(Nil)
{% for var in cmd_flags %}
{% anno = var.annotation(CliGen::Argument) || var.annotation(CliGen::Selection) %}
cmd_flags << Flag({{var.type}}).new(
var: {{ var.name.stringify }},
short: {% if anno[:short] %} {{anno[:short]}} {% else %} nil {% end %},
long: {{ anno[:long] }},
env_var: {% if anno[:env_var] %} {{anno[:env_var]}} {% else %} {{"#{cmd.name.split("::").last.upcase.id}_#{var.name.upcase}"}} {% end %},
description: {{ anno[:description] }},
default: {% unless var.default_value.nil? %} {{var.default_value}} {% else %} nil {% end %},
validate: {% if anno[:validation] %} {{anno[:validation]}} {% else %} nil {% end %},
on_match: {% if anno[:on_match] %} {{anno[:on_match]}} {% else %} nil {% end %},
options: {% if anno[:options] %} {{anno[:options]}} {% else %} nil {% end %},
delimiter: {% if anno[:delimiter] %} {{anno[:delimiter]}} {% else %} "," {% end %},
format: {% if anno[:format] %} {{anno[:format]}} {% else %} nil {% end %}
)
{% debug if env("DEBUG") %}
{% end %}
# Keep a copy of every flag on the root for global matching
app_flags += cmd_flags
app_commands << CommandNode({{cmd}}).new(
name: {{cmd_name}},
flags: cmd_flags,
commands: cmd_sub_commands,
pre_run_commands: cmd_pre_run_cmds,
post_run_commands: cmd_post_run_cmds,
description: {{cmd_info[:description]}}
)
{% debug if env("DEBUG") %}
{% end %}
{% end %}
new(
name: File.basename(::PROGRAM_NAME),
flags: app_flags,
commands: app_commands,
pre_run_commands: [] of Proc(Nil),
post_run_commands: [] of Proc(Nil)
)
end
end
end
end
+84
View File
@@ -0,0 +1,84 @@
module CliGen
# This class serves as a "argument wrapper" to force a fail-fast approach to
# arg-parsing.
#
# It wraps around the argument + index of the argument to do state tracking
# and ensure that each argument is only processed once (plus allows for
# easier filtering of processed arguments to avoid having to do index math)
#
# args.reject(&.processed?) # returns the args that haven't been processed yet
#
# It expects each argument to only be processed once and will force a raise
# if the argument has Arg#processed called a second time. This is to force
# the developer (me) to fix any processing issues during the development of
# this framework.
class Arg
# The raw string argument provided from the user
getter value : String
# The index of the argument in the array it was in
getter index : Int32
# The "flag"/variable that tracks is the Arg has been processed yet
getter? processed : Bool = false
def initialize(@value, @index)
end
def self.flag?(val : String) : Bool
if val =~ CliGen::Regex::FLAG_REGEX
true
else
false
end
end
def flag?(val : String = @value) : Bool
Arg.flag?(val)
end
def self.int?(val : String) : Bool
if val =~ CliGen::Regex::INT
true
else
false
end
end
def int?(val : String = @value) : Bool
Arg.int?(val)
end
def self.uint?(val : String) : Bool
if val =~ CliGen::Regex::UINT
true
else
false
end
end
def uint?(val : String = @value) : Bool
Arg.uint?(val)
end
def self.float?(val : String) : Bool
if val =~ CliGen::Regex::FLOAT
true
else
false
end
end
def float?(val : String = @value) : Bool
Arg.float?(val)
end
# This serves as a trigger that tells the object that it has been processed
#
# This will raise an exception if it is re-called after already having been
# processed.
def processed
raise CliGen::ArgReprocessedError.new("CliGen::Arg(index: #{@index}, value: #{@value})#processed : This arg was re-processed") if @processed
@processed = true
end
end
end
+3
View File
@@ -0,0 +1,3 @@
module CliGen::Coercable
abstract def coerce(arg : String)
end
+12 -178
View File
@@ -1,193 +1,27 @@
require "colorize" require "colorize"
require "time" require "time"
require "./command/parser" require "./annotations"
require "./command/argument"
require "./command/selection"
require "./command/help_template"
require "./command/subcommand"
require "./command/def_init"
require "./command/define_command_initializer"
module CliGen module CliGen
annotation CommandPreRun
end
annotation CommandInfo
end
annotation CommandArgument
end
annotation CommandSelection
end
annotation SubCommand
end
class Command class Command
extend CliGen::Parser
macro inherited macro inherited
{% verbatim do %} {% verbatim do %}
macro finished macro finished
define_actions {% anno = @type.annotation(CliGen::CommandInfo) %}
define_header {% raise "" unless anno %}
{% anno = @type.annotation(::CliGen::CommandInfo) %} {% if anno[:def_init] %}
{% unless anno[:def_runner] == false %} def_init
define_runner
{% end %} {% end %}
define_parser define_command_initializer
define_action_setter
end
{% end %}
end
macro define_actions
@@action : String = ""
ACTIONS = {{@type.class.methods.select(&.annotation(::CliGen::SubCommand)).map(&.name.stringify)}} of String
end
macro define_header
{% name = @type.name.split("::").last.downcase.id %}
{% info_annos = @type.class.methods.select(&.annotation(::CliGen::SubCommand)).map(&.annotation(::CliGen::SubCommand)) %}
{% info_annos += @type.class.methods.select(&.annotation(::CliGen::CommandSelection)).map(&.annotation(::CliGen::CommandSelection)) %}
{% examples = [] of StringLiteral %}
{% info_annos.select(&.[](:examples)).map(&.[](:examples).resolve).each(&.each{|example| examples << example}) %}
HEADER = [
"#{CliGen::APPNAME} {{name}} [[flags]]",
"",
{% unless examples.empty? %}
"Examples:".colorize(:green),
"-------------------------------------------------------------------------------".colorize(:blue),
{% for example in examples %}
{{example}},
{% end %}
{% end %}
].join("\n")
end
macro define_selection(selection_name, short = "", long = "", description = nil, default = "", values = [] of StringLiteral)
{% if values.is_a? Path %}
{% values = values.resolve %}
{% end %}
{% raise "ERROR : define_selection : You MUST provide a description" unless description %}
{% raise "ERROR : define_selection : You must provide a valid set of values in Array(String) format" if values.empty? %}
{% description = "#{description.id} (valid: #{values.join(", ").id})" %}
{% unless default.empty? %}
{% description = "#{description.id} (default: #{default.id})" %}
{% end %}
@@{{selection_name}} : String = {{default}}
@[::CliGen::CommandArgument(short: {{short}}, long: {{long}}, description: {{description}} )]
def self.{{selection_name}}= (selection : String)
raise "ERROR : {{selection_name}} : Invalid Selection(#{selection}) (valid: {{values.map(&.id).join(", ").id}})" unless {{values}}.includes?(selection)
@@{{selection_name}} = selection
end
end
macro define_argument(arg_name, variable = nil, type = String, short = "", long = "", description = nil, subtype = Nil, format = nil, check = nil, def_getter = false, default = nil, logger = nil, &block?)
{% raise "ERROR : define_argument : You must provide a format or set it to \"auto\" to use builtin formats when defining a Time argument" if type.id.stringify == "Time" && format == nil %}
{% raise "ERROR : define_argument : You MUST provide a description" unless description %}
{% variable = arg_name unless variable %}
{% _type = type.id.stringify %}
{% _subtype = subtype.id.stringify %}
{% if _type == "String" %}
@@{{variable}} : {{type}} = ""
{% elsif _type == "Bool" %}
@@{{variable}} : {{type}} = false
{% elsif _type == "Int32" %}
@@{{variable}} : {{type}} = 0
{% elsif _type == "Array" %}
{% raise "define_argument : subtype can only be Int32 or String" unless %w[ Int32 String ].includes?(_subtype) %}
@@{{variable}} : {{type}}({{subtype}}) = [] of {{subtype}}
{% elsif _type == "Time" %}
@@{{variable}} : {{type}} = Time.unix(seconds: 0)
{% end %}
{% if def_getter %}
def self.get_{{arg_name}} : {{type}}
@@{{variable}}
end
{% end %}
@[::CliGen::CommandArgument(type: {{type}}, short: {{short}}, long: {{long}}, description: {{description}})]
def self.{{arg_name}}(var : String) : Nil
{% if check %}
## If the check exists go ahead and call it
{{check}}(var)
{% end %}
## If a logger method has been provided by the user
{% if logger %}
{{logger.id}} "Command : subclass : argument_setter : {{arg_name}} : Entered with #{var}"
{% end %}
{% if _type == "Time" %}
formats = [
CliGen::Regex::INPUT_DATETIME_REGEX,
CliGen::Regex::INPUT_DATE_REGEX
]
abort "ERROR : Command : {{arg_name}} : Incorrect format for provided data #{var}" unless formats.any?{|f| var.match(f)}
if var =~ formats[0]
@@{{variable}} = Time.parse_local(var, CliGen::Format::INPUT_DATETIME_FORMAT)
elsif var =~ formats[1]
@@{{variable}} = Time.parse_local(var, CliGen::Format::INPUT_DATE_FORMAT)
end
{% elsif _type == "Array" %}
{% if _subtype == "Int32" %}
var : Int32 = var.to_i
{% elsif _subtype == "String" %}
{% else %}
var = {{subtype}}.new(var)
{% end %}
@@{{variable}} << var
{% elsif _type == "Bool" %}
@@{{variable}} = true
{% elsif _type == "Int32" %}
@@{{variable}} = var.to_i
{% elsif _type == "String" %}
@@{{variable}} = var
{% end %}
end
end
macro define_runner
def self.run
{% pre_run_commands = @type.class.methods.select(&.annotation(::CliGen::CommandPreRun)) %}
{% unless pre_run_commands.empty? %}
## Ensuring that all runs that are tagged with the the CommandPreRun annotation are run
{% for method in pre_run_commands %}
{{method.name}}
{% end %}
{% end %}
{% selections = @type.class.methods.select(&.annotation(::CliGen::CommandSelection)) %}
{% methods = @type.class.methods.select(&.annotation(::CliGen::SubCommand)) %}
{% raise "ERROR : No commands or selections defined for #{@type.name}" if methods.empty? && selections.empty? %}
{% raise "ERROR : Can't define both selections and commands for work in #{@type.name}" if ! methods.empty? && ! selections.empty? %}
{% var = methods.empty? ? nil : "action" %}
{% targets = methods.empty? ? selections : methods %}
{% if targets == selections %}
{% selectors = selections.map(&.annotation(::CliGen::CommandSelection)).map(&.[:selector]).uniq %}
{% raise "ERROR : Can't provide more than a single selector for runner" if selectors.size > 1 %}
{% var = selectors.first %}
{% end %}
{% begin %}
case @@{{var.id}}
{% for target in targets %}
when {{target.name.stringify}}
{{target.name}}
{% end %}
else
abort "ERROR : No action provided to command {{@type.name}}"
end end
{% end %} {% end %}
end end
end end
macro define_action_setter
def self.action=(action : String)
abort "ERROR : Action(#{action}) is not valid. Only #{ACTIONS.join(", ")} are acceptable" unless ACTIONS.includes?(action)
@@action = action
end
end
end
end end
+80
View File
@@ -0,0 +1,80 @@
module CliGen
class Command
macro argument(variable, description, long = nil, short = nil, validation = nil, on_match = nil, def_setter = false, def_getter = false, options = nil, delimiter = ",", format = nil, allow_no_verification = false)
{% raise "ERROR : CliGen::Command.argument : def_setter must be a Bool" unless def_setter.is_a? BoolLiteral %}
{% raise "ERROR : CliGen::Command.argument : First argument (#{variable}) must be a TypeDeclaration (ex: '<var> : <type> [= val]')" unless variable.is_a? TypeDeclaration %}
{% name = variable.var %}
{% type = variable.type %}
{% raise "ERROR : CliGen::Command.argument(#{name}) : Provided delimiter must be a string" unless delimiter.is_a? StringLiteral %}
{% if short %}
{% raise "ERROR : CliGen::Command.argument(#{name}) : Provided short must be a string" unless short.is_a? StringLiteral %}
{% end %}
{% if long %}
{% raise "ERROR : CliGen::Command.argument(#{name}) : Provided long must be a string" unless long.is_a? StringLiteral %}
{% raise "ERROR : CliGen::Command.argument(#{name}) : Provided long must match --[a-zA-Z0-9-_]+" unless long =~ /^--[a-zA-Z0-9-_]+/ %}
{% else %}
{% long = "--#{name.downcase}" %}
{% end %}
{% raise "ERROR : CliGen::Command.argument(#{name}) : You must provide a description" unless description %}
{% raise "ERROR : CliGen::Command.argument(#{name}) : Provided description must be a String" unless description.is_a? StringLiteral || description.is_a? StringInterpolation %}
{% unless on_match.nil? %}
{% puts "DEBUG : #{@type.name}.argument(#{name}) : OnMatch:\n\tid: #{on_match}\n\treturn_type: #{on_match.return_type}\n\tinput_vars: #{on_match.args}" if env("DEBUG")%}
{% raise "ERROR : CliGen::Command.argument(#{name}) : Provided on_match must be a Proc" unless on_match.is_a? ProcLiteral %}
{% raise "ERROR : CliGen::Command.argument(#{name}) : Provided on_match return type must be Nil" unless on_match.return_type.resolve == Nil %}
{% end %}
{% unless validation.nil? %}
{% puts "DEBUG : #{@type.name}.argument(#{name}) : Validation:\n\tid: #{validation}\n\treturn_type: #{validation.return_type}\n\tinput_vars: #{validation.args}" if env("DEBUG")%}
{% raise "ERROR : CliGen::Command.argument(#{name}) : Provided validation must be a Proc" unless validation.is_a? ProcLiteral %}
{% raise "ERROR : CliGen::Command.argument(#{name}) : Provided validation return type must be a Bool" unless validation.return_type.resolve == Bool %}
{% raise "ERROR : CliGen::Command.argument(#{name}) : Provided validation provided validation must have an input variable" if validation.args.empty? %}
{% arg = validation.args.first %}
{% unless arg.restriction == type %}
{% example = "->(#{arg.name} : #{type}) : Bool { #{validation.body} }" %}
{% raise "ERROR : CliGen::Command.argument(#{name}) : Provided validation input value must be #{type}. EX: #{example}" %}
{% end %}
{% end %}
{% if options %}
{% options = options.resolve if options.is_a? Path %}
{% if options.is_a? Call %}
{% elsif options.is_a? ArrayLiteral %}
{% else %}
{% raise "ERROR : CliGen::Command.argument(#{name}) : Provided options must be an ArrayLiteral or a runtime method call to retrieve data" %}
{% end %}
{% end %}
{% if format %}
{% format = format.resolve if format.is_a? Path %}
{% raise "ERROR : CliGen::Command.argument(#{name}) : Provided format must be a RegexLiteral" unless format.is_a? RegexLiteral %}
{% end %}
{% if type.resolve <= Array && ! allow_no_verification %}
{% elem = type.type_vars.first %}
{% unless elem == Int32 %}
{% if format.nil? && options.nil? %}
{% raise "ERROR : CliGen::Command.argument(#{name}) : When providing custom data types for Array(T) or using Array(String) you must provide a format or options for argument filtering so that parsing can be done deterministically" %}
{% end %}
{% end %}
{% end %}
{% if type.resolve < Array && ! options.nil? %}
@[CliGen::Argument(short: {{short}}, long: {{long}}, description: {{description}}, validation: {{validation}}, on_match: {{on_match}}, options: [{{options}}], delimiter: {{delimiter}}, format: {{format}})]
{% else %}
@[CliGen::Argument(short: {{short}}, long: {{long}}, description: {{description}}, validation: {{validation}}, on_match: {{on_match}}, options: {{options}}, delimiter: {{delimiter}}, format: {{format}})]
{% end %}
@{{variable}}
{% if def_getter %}
def {{variable.var}}
@{{name}}
end
{% end %}
{% if def_setter %}
def {{variable.var}}= (value : {{type}})
{% unless validation.nil? %}
raise CliGen::ValidationError.new("#{@type.name}##{@def.name} : Provided value #{value} failed validation") unless {{validation}}.call(value)
{% end %}
@{{name}} = value
end
{% end %}
end
end
end
+22
View File
@@ -0,0 +1,22 @@
module CliGen
class Command
macro def_init
def initialize
{% verbatim do %}
{% for var in @type.instance_vars %}
{% raise "ERROR : Can't define a default initializer if #{var.name} doesn't have a default" if var.default_value.nil? && !var.type.nilable? %}
@{{var.name}} = {{var.default_value}}
{% end %}
{% end %}
end
def after_initialize
@@instance = self
end
def self.get
@@instance ||= new
end
end
end
end
@@ -0,0 +1,29 @@
module CliGen
class Command
macro define_command_initializer
def initialize(*, handler : CliGen::BaseCommandNode)
{% verbatim do %}
{% for var in @type.instance_vars %}
{% anno = (var.annotation(CliGen::Argument) || var.annotation(CliGen::Selection)) %}
{% if anno %}
{% raise "ERROR : #{@type.name}#initialize : Argument '#{var.name}' cannot be a nilable type (#{var.type}) — flags always resolve to a concrete value" if var.type.union? %}
if flg = handler.flags.find{|f| f.var == {{var.name.stringify}} && f.long == {{anno[:long]}}}
flg.validate!
@{{var.id}} = flg.as(CliGen::Flag({{var.type}})).value!
else
raise CliGen::FlagNotFoundError.new("{{@type.name}}\#{{@def.name}} : No flag found for \"{{var.name}}\"")
end
{% else %}
{% raise "ERROR : #{@type.name}#{@def.name} : Instance Variable(#{var.name}) is not handled by CliGen and does not have a default value" unless var.default_value %}
@{{var.id}} = {{var.default_value}}
{% end %}
{% end %}
{% if @type.has_method? :after_initialize %}
after_initialize
{% end %}
{% end %}
end
end
end
end
+10
View File
@@ -0,0 +1,10 @@
module CliGen
class Command
macro help_template(filepath)
{% raise "ERROR : CliGen::Command.help_template : #{filepath} does not exist" unless file_exists? filepath %}
HELP_TEMPLATE = {{`readlink -f #{filepath}`.strip.stringify}}
{% puts "DEBUG : #{@type.name} : Set HELP_TEMPLATE to #{filepath}" if env("DEBUG") %}
{% debug if env("DEBUG") %}
end
end
end
-70
View File
@@ -1,70 +0,0 @@
module CliGen::Parser
macro extended
{% verbatim do %}
macro define_parser
def self.make_parser(parent_parser : OptionParser) : Nil
{% puts "#{@type.name} OptionParser is being generated" %}
{% name = @type.name.split("::").last %}
{% var = name.downcase %}
{% methods = @type.class.methods %}
{% info = @type.annotation(::CliGen::CommandInfo) %}
{% raise "ERROR : No CommandInfo annotation provided to {{@type.name}}" unless info %}
subparser = OptionParser.new do |parser|
parser.banner = {{@type.name}}::HEADER
{% selections = methods.select(&.annotation(::CliGen::CommandSelection)) %}
{% if selections.size > 0 %}
CliGen.define_section("Selections", parser)
{% for selection in selections %}
{% selection_anno = selection.annotation(::CliGen::CommandSelection) %}
parser.on({{selection.name.stringify}}, {{selection_anno[:description]}}){
{{@type.name}}.{{selection_anno[:selector]}}= {{selection.name.stringify}}
}
{% end %}
{% end %}
{% subcommands = methods.select(&.annotation(::CliGen::SubCommand)) %}
{% if subcommands.size > 0 %}
CliGen.define_section("Subcommands", parser)
{% for subcommand in subcommands %}
{% subcommand_anno = subcommand.annotation(::CliGen::SubCommand) %}
parser.on({{subcommand.name.stringify}}, {{subcommand_anno[:description]}}){
{{@type.name}}.action= {{subcommand.name.stringify}}
}
{% end %}
{% end %}
{% arguments = methods.select(&.annotation(::CliGen::CommandArgument)) %}
{% if arguments.size > 0 %}
CliGen.define_section("Provide Arguments", parser)
{% for argument in arguments %}
{% argument_anno = argument.annotation(::CliGen::CommandArgument) %}
{% if argument_anno[:short] == "" && argument_anno[:long] != "" %}
parser.on({{argument_anno[:long]}}, {{argument_anno[:description]}}){|val|
{% elsif argument_anno[:short] != "" && argument_anno[:long] == "" %}
parser.on({{argument_anno[:short]}}, {{argument_anno[:description]}}){|val|
{% else %}
parser.on({{argument_anno[:short]}}, {{argument_anno[:long]}}, {{argument_anno[:description]}}){|val|
{% end %}
{{@type.name}}.{{argument.name}}(val)
}
{% end %}
{% end %}
CliGen.define_default_flags(parser)
end
parent_parser.on({{var}}, {{info[:description]}}){
raise "ERROR : {{var.id}} not found in ARGV" unless i = ARGV.index({{var}})
## Removing all preceeding arguments so that only the actual required
## args for the next command are present
ARGV.shift(i+1)
abort subparser if ARGV.empty?
subparser.parse
{{@type.name}}.run
}
end
end
{% end %}
end
end
+21
View File
@@ -0,0 +1,21 @@
module CliGen
class Command
macro selection(variable, description, options, short = nil, long = nil, validation = nil, on_match = nil)
{% raise "ERROR : CliGen::Command.selection : First selection must be a TypeDeclaration (ex: '<var> : <type> [= val]')" unless variable.is_a? TypeDeclaration %}
{% if short %}
{% raise "ERROR : CliGen::Command.selection : Provided short must be a string" unless short.is_a? StringLiteral %}
{% end %}
{% long = "--#{variable.var}" if long.nil? %}
{% raise "ERROR : CliGen::Command.selection : Provided long must be a flag format" unless long =~ /^--[a-zA-Z0-9-_]+/ %}
{% raise "ERROR : CliGen::Command.selection : Provided long must be a string" unless long.is_a? StringLiteral %}
{% raise "ERROR : CliGen::Command.selection : You must provide a short or long" unless long || short %}
{% raise "ERROR : CliGen::Command.selection : You must provide a description" unless description %}
{% raise "ERROR : CliGen::Command.selection : Provided description must be a String" unless description.is_a? StringLiteral %}
{% options = options.resolve if options.is_a? Path %}
{% raise "ERROR : CliGen::Command.selection : Provided options must be an ArrayLiteral" unless options.is_a? ArrayLiteral %}
@[CliGen::Argument(short: {{short}}, long: {{long}}, description: {{description}}, validation: {{validation}}, on_match: {{on_match}}, options: {{options}}, delimiter: "-")]
@{{variable}}
end
end
end
+19
View File
@@ -0,0 +1,19 @@
module CliGen
class Command
macro subcommand(func, description, examples = nil, &block)
{% raise "ERROR : CliGen::Command.subcommand : First argument must be a TypeDeclaration, or Call (ex: '<var> : <type>' or <var>)" unless func.is_a? TypeDeclaration || func.is_a? Call %}
{% raise "ERROR : CliGen::Command.subcommand : You must provide a description" unless description %}
{% raise "ERROR : CliGen::Command.subcommand : Provided description must be a String" unless description.is_a? StringLiteral %}
{% unless examples.nil? %}
{% examples = examples.resolve if examples.is_a? Path %}
{% raise "ERROR : CliGen::Command.subcommand : Provided example must be an Array" unless examples.is_a? ArrayLiteral %}
{% end %}
{% raise "ERROR : CliGen::Command.subcommand : You MUST provide a function body" unless block %}
@[CliGen::SubCommand(description: {{description}}, examples: {{examples}})]
def {{func}}
{{block.body}}
end
end
end
end
+316
View File
@@ -0,0 +1,316 @@
require "./global_flag"
require "./match_type"
require "./flag"
require "./arg"
require "ecr"
module CliGen
record SubCommandInfo,
name : String,
description : String,
examples : Array(String)?
alias RunCommand = Proc(Nil)
# Non-generic base that lets the tree hold heterogeneous CommandNode(T) children.
# Everything that doesn't depend on T lives here.
abstract class BaseCommandNode
getter name : String
getter flags : Array(BaseFlag)
getter commands : Array(BaseCommandNode)
getter description : String?
@pre_run_commands : Array(RunCommand)
@post_run_commands : Array(RunCommand)
def initialize(
@name : String,
flags : Array(BaseFlag),
@commands : Array(BaseCommandNode),
@pre_run_commands : Array(RunCommand),
@post_run_commands : Array(RunCommand),
@description : String? = nil
)
@flags = (flags + CliGen::GLOBAL_FLAGS + @commands.flat_map(&.flags)).uniq
end
def check_for_duplicates!(flags : Array(BaseFlag)) : Nil
shorts = flags.compact_map(&.short)
short_duplicates = [] of String
longs = flags.compact_map { |f| f.long_key unless f.long_key.empty? }
long_duplicates = [] of String
last_short : String = ""
shorts.sort.each do |short|
short_duplicates << short if last_short == short
last_short = short
end
last_long : String = ""
longs.sort.each do |long|
long_duplicates << long if last_long == long
last_long = long
end
unless long_duplicates.empty? && short_duplicates.empty?
error_buffer = "ERROR : CommandNode(%s)#check! : Found Duplicates : %s"
message = ""
unless long_duplicates.empty?
message += "\nLong:\n%s\n" % long_duplicates.map { |f| "- #{f}" }.join("\n")
end
unless short_duplicates.empty?
message += "\nShort:\n%s" % short_duplicates.map { |f| "- #{f}" }.join("\n")
end
raise CliGen::DuplicateFlagError.new(error_buffer % [@name, message])
end
end
def get(*, long : String) : BaseFlag?
@flags.find{|f| f.long_key == long}
end
def get(*, short : String) : BaseFlag?
@flags.find{|f| f.short == short}
end
def handle_flag_raises(&) : Nil
begin
yield
rescue e : CliGen::RuntimeError
abort e.message
end
end
def find_match(arg : String)
if subcommand?(arg)
return CliGen::MatchType::SubCommand
end
case arg
when "-h", "--help"
CliGen::MatchType::Help
when CliGen::Regex::FLAG_REGEX
if flg = @flags.find(&.matches?(arg))
flg
else
CliGen::MatchType::NoMatch
end
when CliGen::Regex::FLAG_WITH_ARG
CliGen::MatchType::FlagWithArg
when CliGen::Regex::FLAG_MULTIPLE_SHORT
CliGen::MatchType::FlagMultipleShort
else
if cmd = @commands.find { |c| c.name == arg }
cmd
else
CliGen::MatchType::NoMatch
end
end
end
def subcommands? : Bool
subcommands.size > 0
end
def subcommand?(arg : String) : Bool
subcommands.any?{|f| f.name == arg}
end
def flag?(arg : String) : Bool
@flags.any?(&.matches?(arg))
end
# Converts String array to Arg array and hands off to the typed process method
def process(args : Array(String)) : Nil
new_args = args.each_with_index.map { |arg, i| CliGen::Arg.new(value: arg, index: i) }.to_a
process(new_args)
end
abstract def subcommands : Array(SubCommandInfo)
abstract def check! : Nil
abstract def process(args : Array(CliGen::Arg)) : Nil
end
class CommandNode(T) < BaseCommandNode
def subcommands : Array(SubCommandInfo)
{% begin %}
{% subcmds = T.methods.select(&.annotation(CliGen::SubCommand)) %}
{% if subcmds.empty? %}
[] of SubCommandInfo
{% else %}
[
{% for cmd in subcmds %}
{% anno = cmd.annotation(CliGen::SubCommand) %}
SubCommandInfo.new(
name: {{cmd.name.stringify}},
description: {{anno[:description]}},
examples: {% if anno[:examples] %} {{anno[:examples]}} {% else %} nil {% end %}
),
{% end %}
]
{% end %}
{% end %}
end
def verbose? : Bool
@verbose_flag ||= get(long: "--verbose").not_nil!.as(Flag(Bool))
@verbose_flag.not_nil!.value!
end
def help : String
{% begin %}
{% if T.has_constant? "HELP_TEMPLATE" %}
{% puts "#{T} was found to have HELP_TEMPLATE defined using this instead" if env("DEBUG") %}
ECR.render({{T.constant("HELP_TEMPLATE")}})
{% elsif CliGen.has_constant? "HELP_OVERRIDE_TEMPLATE" %} # If we have a global override use it
{% puts "Global override found. Using" if env("DEBUG") %}
ECR.render({{CliGen::HELP_OVERRIDE_TEMPLATE}})
{% else %}
{% puts "No type overrided help output. Using default" if env("DEBUG") %}
ECR.render("lib/cligen/src/cligen/template/cmd_help.ecr")
{% end %} # otherwise
{% debug if env("DEBUG") %}
{% end %}
end
def check! : Nil
@flags.each(&.check!)
check_for_duplicates!(@flags)
@commands.each(&.check!)
{% unless T == Nil %}
raise CliGen::MissingDispatchError.new("CommandNode({{T}})#check! : {{T}} has no subcommands and no #main defined") \
if subcommands.empty? && !{{T.has_method?(:main)}}
{% end %}
end
def process(args : Array(CliGen::Arg)) : Nil
check!
passed_execution = false
matched_subcommand : String? = nil
@pre_run_commands.each(&.call)
args.each do |arg|
next if arg.processed?
arg.processed
case match = find_match(arg.value)
when BaseCommandNode
# Hand off remainder to the child; we're done at this level
{% begin %}
case match
{% for cls in CliGen::Command.subclasses %}
when CliGen::CommandNode({{cls.name}})
match.as(CommandNode({{cls}})).process(args.reject(&.processed?))
exit 0
{% end %}
else
raise CliGen::UnknownCommandNodeError.new("CommandNode({{T}})#process : matched a BaseCommandNode that isn't a known CommandNode(T)")
end
{% end %}
passed_execution = true
when BaseFlag
# Ensuring we catch any exceptions to have them abort with the
# error message if caught
handle_flag_raises do
if match.requires_arg?
match.process(args.reject(&.processed?).take_while{|v| find_match(v.value) == CliGen::MatchType::NoMatch})
else
match.process
end
end
when MatchType::SubCommand
raise CliGen::InternalError.new("CommandNode({{T}})#process : subcommand '#{matched_subcommand}' was already matched — duplicate subcommand token") if matched_subcommand
matched_subcommand = arg.value
when MatchType::Help
raise CliGen::HelpRequestedError.new(help)
when MatchType::FlagWithArg
if regex_match = CliGen::Regex::FLAG_WITH_ARG.match(arg.value)
case flag_match = find_match(regex_match["flag"])
when BaseFlag
handle_flag_raises do
flag_match.process([CliGen::Arg.new(value: regex_match["arg"], index: arg.index)])
end
else
raise CliGen::UnknownCommandNodeError.new("CommandNode(#{@name}).process : No flag matched '#{regex_match["flag"]}'")
end
else
raise CliGen::RegexInvariantError.new("CommandNode(#{@name}).process : FLAG_WITH_ARG matched in find_match but failed on re-match — this is a framework bug")
end
when MatchType::FlagMultipleShort
val = arg.value.gsub(/^-/,"")
# If the next character in the series is a flag assume the remaining are flags as well.
if flag?("-#{val[1]}")
chars = val.chars
chars.map { |c| "-#{c}" }.each_with_index do |flag, index|
case match = find_match(flag)
when BaseFlag
# If this is the last flag in the series let it process others
handle_flag_raises do
## If this is the last flag provided in the clump do the thing
if index == chars.size - 1
if match.requires_arg?
match.process(args.reject(&.processed?).take_while{|v| find_match(v.value) == CliGen::MatchType::NoMatch})
else
match.process
end
else
raise CliGen::FlagBundleError.new("#{CliGen::APPNAME}: cannot bundle '#{flag}' — it requires an argument") if match.requires_arg?
match.process
end
end
when MatchType::NoMatch
raise CliGen::UnknownFlagError.new("#{CliGen::APPNAME}: unknown flag '#{flag}'")
end
end
else
# In this case we assume the characters following the flag is the argument
raise CliGen::FlagArgumentError.new("#{CliGen::APPNAME}: inline flag arguments are not supported — did you mean '-#{val[0]} #{val[1..]}'?")
end
when MatchType::NoMatch
raise CliGen::HelpRequestedError.new("#{CliGen::APPNAME}: unknown token '#{arg.value}'\n\n#{help}")
end
end
@post_run_commands.each(&.call)
{% unless T == Nil %}
unless passed_execution
cls = T.new(handler: self.as(CliGen::BaseCommandNode))
{% for cmd in T.methods.select(&.annotation(CliGen::PreRunCommand)) %}
cls.{{cmd.name}}
{% end %}
{% subcmds = T.methods.select(&.annotation(CliGen::SubCommand)) %}
{% begin %}
case matched_subcommand
{% for cmd in subcmds %}
when {{cmd.name.stringify}}
cls.{{cmd.name}}
{% end %}
else
{% if T.has_method?(:main) %}
cls.main
{% else %}
puts "ERROR : CommandNode({{T}})\#{{@def.name}} : No subcommand matched and no #main defined"
puts help
{% end %}
exit 0
end
{% end %}
end
{% else %}
puts help
exit 0
{% end %}
end
end
end
+77
View File
@@ -0,0 +1,77 @@
module CliGen
# Base for all CliGen exceptions
class Error < Exception; end
# -------------------------------------------------------------------------
# Internal errors — framework invariant violations, should never reach users
# -------------------------------------------------------------------------
class InternalError < Error; end
# Arg#processed was called a second time on the same Arg
class ArgReprocessedError < InternalError; end
# A token matched FLAG_WITH_ARG in find_match but the regex failed on re-match
class RegexInvariantError < InternalError; end
# A BaseCommandNode was matched but couldn't be cast to any known CommandNode(T)
class UnknownCommandNodeError < InternalError; end
# -------------------------------------------------------------------------
# Configuration errors — shard consumer wired something up incorrectly
# -------------------------------------------------------------------------
class ConfigurationError < Error; end
# -h or --help was used as a flag short/long (reserved for internal help)
class ReservedFlagError < ConfigurationError; end
# Duplicate short or long flags detected during check!
class DuplicateFlagError < ConfigurationError; end
# A CommandNode(T) has no subcommands and no #main defined
class MissingDispatchError < ConfigurationError; end
# No flag was found in the handler for a Command ivar during initialize
class FlagNotFoundError < ConfigurationError; end
# A flag that requires an argument was processed with an empty argv
class FlagMissingArgumentError < ConfigurationError; end
# A Parsable type's parse_args did not mark any args as processed
class ParseableInvariantError < ConfigurationError; end
# -------------------------------------------------------------------------
# Runtime errors — bad user input at the CLI level
# -------------------------------------------------------------------------
class RuntimeError < Error; end
# A required flag was not provided and has no env var or default to fall back on
class MissingRequiredFlagError < RuntimeError; end
# A setter's validation proc rejected the provided value
class ValidationError < RuntimeError; end
# A flag token was provided where a value argument was expected
class FlagArgumentError < RuntimeError; end
# A provided value doesn't satisfy type or format requirements (wrong type, bad format, invalid bool/date string)
class InvalidFlagValueError < RuntimeError; end
# A provided value is not in the flag's allowed options list
class InvalidOptionError < RuntimeError; end
# An unrecognised flag token was encountered during parsing
class UnknownFlagError < RuntimeError; end
# A flag that requires an argument was included in a short-flag bundle
class FlagBundleError < RuntimeError; end
# -------------------------------------------------------------------------
# Help signal — not an error; exit 0 after printing
# -------------------------------------------------------------------------
# Raised when -h/--help is matched; carries the rendered help string
class HelpRequestedError < Error; end
end
+368
View File
@@ -0,0 +1,368 @@
require "./arg"
module CliGen
# To be able to store metadata for use in the help output
record FlagMeta,
type : String,
array : Bool,
format : String?,
default : String,
options : Array(String)?
abstract class BaseFlag
getter var : String
getter short : String?
getter long : String
getter long_key : String
getter env_var : String
getter description : String
getter delimiter : String
getter meta : FlagMeta
def initialize(
@var : String,
@short : String?,
@long : String,
@env_var : String,
@description : String,
@delimiter : String,
@meta : FlagMeta
)
# if the user provides just a "--long" I want the @long_key to match it
if @long =~ /\s|=/
@long_key = @long.split(/\s|=/).first
else
@long_key = @long
end
end
def matches?(token : String) : Bool
token == @short || (!@long_key.empty? && token == @long_key)
end
abstract def satisfied? : Bool
abstract def validate! : Nil
abstract def raw_value : String?
abstract def check! : Nil
end
class Flag(T) < BaseFlag
@value : T?
@default : T?
@options : Array(T)?
@validate : (T -> Bool)?
@on_match : Proc(Nil)?
@format : ::Regex?
def initialize(
var : String,
short : String?,
long : String,
env_var : String,
description : String,
delimiter : String = ",",
@default : T? = nil,
@options : Array(T)? = nil,
@validate : (T -> Bool)? = nil,
@on_match : Proc(Nil)? = nil,
@format : ::Regex? = nil
)
{% unless T.class.has_method? :to_s %}
{% raise "ERROR : Flag(#{T}) : Error your flag type must have a to_s method" %}
{% end %}
{% if T < Array %}
{% elem = T.type_vars.first %}
{% raise "ERROR : Flag(#{T}) : Error your flag subtype #{elem} must have a to_s method" unless elem.class.has_method? :to_s %}
{% end %}
unless @default.nil?
{% if T < Array %}
default = "[" + @default.not_nil!.map(&.to_s).join(", ") + "]"
{% else %}
default = @default.not_nil!.to_s
{% end %}
else
default = ""
end
meta = FlagMeta.new(
type: {{T.stringify}},
array: {{ T < Array ? true : false }},
options: {% if T < Array %} @options.try(&.first.map(&.to_s)) {% else %} @options.try(&.map(&.to_s)) {% end %},
default: default,
format: @format.try(&.source)
)
super(var, short, long, env_var, description, delimiter, meta)
end
def requires_arg? : Bool
{{T}} != Bool
end
def process(argv : Array(Arg) = [] of Arg) : Nil
if requires_arg?
raise CliGen::FlagMissingArgumentError.new("Flag(#{T}, long: #{@long_key}) : requires an argument but provided array is empty") if argv.empty?
raise CliGen::FlagArgumentError.new("Flag(#{T}, long: #{@long_key}) : a flag token was provided where a value was expected (got: #{argv.first.value})") if argv.first.flag?
end
{% if T == Bool %}
@value = true
{% elsif T < Array %}
{% raise "ERROR : Flag(#{T}) : You cannot define multiple types of array entries" if T.type_vars.size > 1 %}
{% elem = T.type_vars.first %}
argv.each do |arg|
break if arg.flag?
unless @format.nil?
unless arg.value.includes?(@delimiter)
unless arg.value =~ @format
puts "DEBUG : Flag({{T}}, long: #{@long_key}) : #{arg.value} was not found to be matching the defined filter #{@format}. So breaking from parse loop" if ENV["DEBUG"]?
break
end
end
end
{% if elem < Int %}
{% int_case = elem.stringify =~ /^UInt/ ? "uint?".id : "int?".id %}
if arg.value.includes?(@delimiter)
@value = (@value || T.new) + arg.value.split(@delimiter).map do |val|
val = val.strip
unless arg.{{int_case}}(val)
raise CliGen::InvalidFlagValueError.new("Flag({{T}}, long: #{@long_key}) : '#{val}' is not a valid {{elem}}")
end
{{elem}}.new(val)
end
else
unless arg.{{int_case}}
raise CliGen::InvalidFlagValueError.new("Flag({{T}}, long: #{@long_key}) : '#{arg.value}' is not a valid {{T}}")
end
(@value ||= T.new) << {{elem}}.new(arg.value)
end
{% elsif elem < Float %}
if arg.value.includes?(@delimiter)
@value = (@value || T.new) + arg.value.split(@delimiter).map do |val|
val = val.strip
unless CliGen::Arg.float?(val)
raise CliGen::InvalidFlagValueError.new("Flag({{T}}, long: #{@long_key}) : '#{val}' is not a valid {{T}}")
end
{{elem}}.new(val)
end
else
unless arg.float?
raise CliGen::InvalidFlagValueError.new("Flag({{T}}, long: #{@long_key}) : '#{arg.value}' is not a float")
end
(@value ||= T.new) << {{elem}}.new(arg.value)
end
{% elsif elem == String %}
if arg.value.includes?(@delimiter)
@value = (@value || [] of String) + arg.value.split(@delimiter).map { |v|
unless @format.nil?
raise CliGen::InvalidFlagValueError.new("Flag({{T}}, long: #{@long_key}) : '#{v}' does not match required format /#{@format.not_nil!.source}/") unless v =~ @format
end
v
}
else
if ! @format.nil? && arg.value !~ @format
raise CliGen::InvalidFlagValueError.new("Flag({{T}}, long: #{@long_key}) : '#{arg.value}' does not match required format /#{@format.not_nil!.source}/")
end
(@value ||= [] of String) << arg.value
end
{% elsif elem.class < CliGen::Coercable %}
if arg.value.includes?(@delimiter)
@value = (@value || [] of {{elem}}) + arg.value.split(@delimiter).map { |i| {{elem}}.coerce(i) }
else
@value = (@value || [] of {{elem}}) + [({{elem}}.coerce(arg.value))]
end
{% else %}
{% raise "ERROR : Flag(#{T}) : #{elem} is not a coercable type. If you wish to coerce it from a bare string extend with CliGen::Coercable & implement the class method" %}
{% end %}
arg.processed
end
{% elsif T < Int %}
{% int_case = T.stringify =~ /^UInt/ ? "uint?".id : "int?".id %}
unless argv.first.{{int_case}}
raise CliGen::InvalidFlagValueError.new("Flag(#{T}, long: #{@long_key}) : '#{argv.first.value}' is not a valid {{T}}")
end
@value = T.new(argv.first.value)
argv.first.processed
{% elsif T < Float %}
unless argv.first.float?
raise CliGen::InvalidFlagValueError.new("Flag(#{T}, long: #{@long_key}) : '#{argv.first.value}' is not a valid {{T}}")
end
@value = T.new(argv.first.value)
argv.first.processed
{% elsif T == Time %}
@value = parse_time(argv.first.value)
argv.first.processed
{% elsif T == String %} # String
if ! @format.nil? && argv.first.value !~ @format
raise CliGen::InvalidFlagValueError.new("Flag(#{T}, long: #{@long_key}) : '#{argv.first.value}' does not match required format /#{@format.not_nil!.source}/")
end
@value = argv.first.value
argv.first.processed
{% elsif T.class < CliGen::Parsable %}
processed = argv.select(&.processed?)
@value = T.parse_args(argv)
post_processed = argv.select(&.processed?)
if processed == post_processed
raise CliGen::ParseableInvariantError.new("Flag({{T}}, long: #{@long_key})#process : {{T}}#parse_args did not mark any args as processed")
end
{% else %}
{% raise "ERROR : Flag({{T}}#process : Generic Type #{T} is not supported. To add support you must extend with CliGen::Parsable & implement the class method" %}
{% end %}
validate!
@on_match.try(&.call)
end
def value! : T
v = @value
# Priority: provided arg → env var → default → abort
if v.nil?
if raw = ENV[@env_var]?
v = coerce(raw)
end
end
v ||= @default
raise CliGen::MissingRequiredFlagError.new("#{CliGen::APPNAME}: required flag #{@long_key} was not provided") if v.nil?
v.not_nil!
end
def raw_value : String?
{% if T == Bool %}
@value.try(&.to_s)
{% elsif T <= Array %}
@value.try(&.join(","))
{% else %}
@value.try(&.to_s)
{% end %}
end
def satisfied? : Bool
return true if !@value.nil?
return true if @env_var && ENV[@env_var]?
return true if !@default.nil?
false
end
def validate! : Nil
v = value!
if opts = @options
{% if T < Array %}
v.each do |v2|
raise CliGen::InvalidOptionError.new("#{CliGen::APPNAME}: '#{v2}' is not a valid value for #{@long_key} (valid: #{opts.join(", ")})") unless opts.first.includes?(v2)
end
{% else %}
raise CliGen::InvalidOptionError.new("#{CliGen::APPNAME}: '#{v}' is not a valid value for #{@long_key} (valid: #{opts.join(", ")})") unless opts.includes?(v)
{% end %}
end
if check = @validate
raise CliGen::ValidationError.new("#{CliGen::APPNAME}: validation failed for #{@long_key} (got: #{v})") unless check.call(v)
end
end
def check! : Nil
raise CliGen::ReservedFlagError.new("Flag({{T}}, long: #{@long})#check! : -h is reserved for internal help") if @short == "-h"
raise CliGen::ReservedFlagError.new("Flag({{T}}, long: #{@long})#check! : --help is reserved for internal help") if @long_key == "--help"
end
private def coerce(raw : String) : T
{% if T == Bool %}
case raw
when /^(t|true|y|yes|1)$/i
true
when /^(f|false|n|no|0)$/i
false
else
raise CliGen::InvalidFlagValueError.new("Flag({{T}}, long: #{@long_key}) : '#{raw}' is not a valid boolean (expected: t/f/true/false/y/n/yes/no/1/0)")
end
{% elsif T < Int %}
{% int_case = T.stringify =~ /^UInt/ ? "uint?".id : "int?".id %}
unless CliGen::Arg.{{int_case}}(raw)
raise CliGen::InvalidFlagValueError.new("Flag({{T}}, long: #{@long_key}) : '#{raw}' is not a valid {{T}}")
end
T.new(raw)
{% elsif T < Float %}
unless CliGen::Arg.float?(raw)
raise CliGen::InvalidFlagValueError.new("Flag({{T}}, long: #{@long_key}) : '#{raw}' is not a valid {{T}}")
end
T.new(raw)
{% elsif T == Time %}
parse_time(raw)
{% elsif T < Array %}
if raw.includes?(@delimiter)
{% elem = T.type_vars.first %}
raw.split(@delimiter).map do |val|
unless @format.nil?
raise CliGen::InvalidFlagValueError.new("Flag({{T}}, long: #{@long_key}) : '#{val}' does not match required format /#{@format.not_nil!.source}/") unless val =~ @format
end
{% if elem < Int %}
val = val.strip
{% int_case = elem.stringify =~ /^UInt/ ? "uint?".id : "int?".id %}
unless CliGen::Arg.{{int_case}}(val)
raise CliGen::InvalidFlagValueError.new("Flag({{T}}, long: #{@long_key}) : '#{val}' is not a valid {{elem}}")
end
{{elem}}.new(val)
{% elsif elem < Float %}
unless CliGen::Arg.float?(val)
raise CliGen::InvalidFlagValueError.new("Flag({{T}}, long: #{@long_key}) : '#{val}' is not a valid {{elem}}")
end
{{elem}}.new(val)
{% elsif elem == String %}
val
{% elsif elem.class < CliGen::Coercable %}
{{elem}}.coerce(val)
{% else %}
{% raise "ERROR : Flag(#{T}) : #{elem} is not a coercable type. If you wish to coerce it from a bare string extend CliGen::Coercable & implement the class method" %}
{% end %}
end
else
if ! @format.nil? && raw !~ @format
raise CliGen::InvalidFlagValueError.new("Flag({{T}}, long: #{@long_key}) : '#{raw}' does not match required format /#{@format.not_nil!.source}/")
end
{% if elem < Int %}
{% int_case = elem.stringify =~ /^UInt/ ? "uint?".id : "int?".id %}
unless CliGen::Arg.{{int_case}}(raw)
raise CliGen::InvalidFlagValueError.new("Flag({{T}}, long: #{@long_key}) : '#{raw}' is not a valid {{elem}}")
end
[ {{elem}}.new(raw) ]
{% elsif elem < Float %}
unless CliGen::Arg.float?(raw)
raise CliGen::InvalidFlagValueError.new("Flag({{T}}, long: #{@long_key}) : '#{raw}' is not a valid {{elem}}")
end
[ {{elem}}.new(raw) ]
{% elsif elem == String %}
[ raw ]
{% elsif elem.class < CliGen::Coercable %}
[ {{elem}}.coerce(raw) ]
{% else %}
{% raise "ERROR : Flag(#{T}) : #{T} is not a coercable type. If you wish to coerce it from a bare string extend CliGen::Coercable & implement the class method" %}
{% end %}
end
{% elsif T == String %} # String
raw
{% elsif T.class < CliGen::Coercable %}
T.coerce(raw)
{% else %}
{% raise "ERROR : Flag(#{T}) : #{T} is not a coercable type. If you wish to coerce it from a bare string extend CliGen::Coercable & implement the class method" %}
{% end %}
end
private def parse_time(raw : String) : Time
formats = [
CliGen::Regex::INPUT_DATETIME_REGEX,
CliGen::Regex::INPUT_DATE_REGEX
]
raise CliGen::InvalidFlagValueError.new("#{CliGen::APPNAME}: invalid date/time format '#{raw}' (expected YYYY-MM-DD or YYYY-MM-DD HH:MM:SS)") unless formats.any? { |f| raw.match(f) }
if raw.match(formats[0])
Time.parse_local(raw, CliGen::Format::INPUT_DATETIME_FORMAT)
else
Time.parse_local(raw, CliGen::Format::INPUT_DATE_FORMAT)
end
end
end
end
+46
View File
@@ -0,0 +1,46 @@
require "./flag"
module CliGen
GLOBAL_FLAGS = [] of BaseFlag
GLOBAL_FLAGS << Flag(Bool).new(
var: "",
short: "-v",
long: "--verbose",
env_var: "VERBOSE",
default: false,
description: "Enable verbose output from program & help output"
)
macro add_global_flag(type, long, description, env_var = nil, short = nil, validation = nil, &on_match)
{% raise "ERROR : CliGen.add_global_flag : type must be a TypeNode" unless type.is_a? TypeNode %}
{% raise "ERROR : CliGen.add_global_flag : long must begin a StringLiteral" unless long.is_a? StringLiteral %}
{% raise "ERROR : CliGen.add_global_flag : long must begin with --" unless long =~ /^--/ %}
{% if short %}
{% raise "ERROR : CliGen.add_global_flag : Short must be a StringLiteral" unless short.is_a? StringLiteral %}
{% raise "ERROR : CliGen.add_global_flag : Short must be a - with single char (ex: -a)" unless short =~ /^-[a-zA-Z]/ %}
{% end %}
{% if validation %}
{% raise "ERROR : CliGen.add_global_flag : validation must be a Proc" unless validation.is_a? ProcLiteral %}
{% raise "ERROR : CliGen.add_global_flag : validation proc return type must be nil \"->(...) : Nil {...}\"" unless validation.is_a? ProcLiteral %}
{% raise "ERROR : CliGen.add_global_flag : validation proc must have a single input variable" unless validation.args.size == 1%}
{% arg = validation.args.first %}
{% raise "ERROR : CliGen.add_global_flag : validation proc input variable MUST be typed to match the flag type \"->(#{arg.name} : #{type}) : Nil { ... }\"" unless arg.restriction == type %}
{% end %}
{% raise "ERROR : CliGen.add_global_flag : decription must be a StringLiteral" unless description.is_a? StringLiteral %}
{% if env_var %}
{% raise "ERROR : CliGen.add_global_flag : env_var must be a StringLiteral" unless env_var.is_a? StringLiteral %}
{% else %}
{% env_var = long.gsub(/--/, "").upcase %}
{% end %}
CliGen::GLOBAL_FLAGS << CliGen::Flag({{type}}).new(
var: "",
short: {{short}},
long: {{long}},
description: {{description}},
env_var: {{env_var}},
on_match: {% if on_match %} ->() : Nil { {{on_match.body}} } {% else %} nil {% end %},
validation: {% if validation %} {{validation}} {% else %} nil {% end %}
)
end
end
+10
View File
@@ -0,0 +1,10 @@
module CliGen
enum MatchType
FlagWithArg
FlagMultipleShort
ShortWithInlineArg
SubCommand
Help
NoMatch
end
end
+3
View File
@@ -0,0 +1,3 @@
module CliGen::Parsable
abstract def parse_args(args : Array(CliGen::Arg))
end
+8
View File
@@ -1,4 +1,12 @@
module CliGen::Regex module CliGen::Regex
FLAG_REGEX=/^(-[a-zA-Z]|--[a-zA-Z-_0-9]+)$/
FLAG_WITH_ARG=/^(?<flag>(-[a-zA-Z]|--[a-zA-Z-_]+))="?(?<arg>\S+?)"?$/
FLAG_MULTIPLE_SHORT=/^-[a-zA-Z0-9]+/
INPUT_DATETIME_REGEX = /^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$/ INPUT_DATETIME_REGEX = /^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$/
INPUT_DATE_REGEX = /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/ INPUT_DATE_REGEX = /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/
FLOAT = /^[-+]?[[:digit:]]+(\.[[:digit:]]+)?$/
UINT = /^[[:digit:]]+$/
INT = /^[-+]?[[:digit:]]+$/
end end
+57
View File
@@ -0,0 +1,57 @@
Command: <%= @name %>
<%- unless @description.nil? -%>
Description: <%= @description %>
<%- end -%>
<%- unless @flags.empty? -%>
<%- len = @flags.map{|f| f.short.nil? ? f.long.size : "#{f.short},#{f.long}".size}.max + 5 -%>
Flags:
---------------------------------------------------------------
<%- @flags.each do |flag| -%>
<%- if flag.short.nil? -%>
<%- flags = [flag.long.strip] -%>
<%- else -%>
<%- flags = [flag.short,flag.long.strip] -%>
<%- end -%>
<%= "%-#{len}s %s" % [flags.join(","), flag.description.strip] %><%= flag.meta.options.nil? ? "" : " (valid: #{flag.meta.options.not_nil!.join(", ")})" %><%= flag.meta.default.empty? ? "" : " (default: #{flag.meta.default.not_nil!})" %>
<%- if verbose? -%>
<%= "%-#{len}s %s" % ["", "Type: #{flag.meta.type}"] %>
<%= "%-#{len}s %s" % ["", "ENV VAR: #{flag.env_var}"] %>
<%- unless flag.meta.format.nil? -%>
<%= "%-#{len}s %s" % ["", "Valid Format: #{flag.meta.format}"] %>
<%- end -%>
<%- if flag.meta.array -%>
<%= "%-#{len}s %s" % ["", "Delimiter: #{flag.delimiter}"] %>
<%- end -%>
<%- end -%>
<%- end -%>
<%- end -%>
<%- unless @commands.empty? -%>
Other Commands
---------------------------------------------------------------
<%- @commands.each do |command| -%>
<%= "%-#{len}s %s" % [ command.name, command.description ] %>
<%- end -%>
<%- end -%>
<%- if subcommands? -%>
SubCommands of <%= @name %>:
---------------------------------------------------------------
<%- subcommands.each do |cmd| -%>
<%= "%-#{len}s %s" % [cmd.name, cmd.description] %>
<%- end -%>
<%- cmds = subcommands.select{|c| ! c.examples.nil? } -%>
<%- unless cmds.empty? -%>
Examples:
---------------------------------------------------------------
<%- cmds.map(&.examples).flatten.each do |example| -%>
<%= example %>
<%- end -%>
<%- end -%>
<%- end -%>
Note: When wanting help output of any command you can provide the -h/--help flags or help command
+22
View File
@@ -0,0 +1,22 @@
!_TAG_EXTRA_DESCRIPTION anonymous /Include tags for non-named objects like lambda/
!_TAG_EXTRA_DESCRIPTION fileScope /Include tags of file scope/
!_TAG_EXTRA_DESCRIPTION pseudo /Include pseudo tags/
!_TAG_EXTRA_DESCRIPTION subparser /Include tags generated by subparsers/
!_TAG_FIELD_DESCRIPTION epoch /the last modified time of the input file (only for F\/file kind tag)/
!_TAG_FIELD_DESCRIPTION file /File-restricted scoping/
!_TAG_FIELD_DESCRIPTION input /input file/
!_TAG_FIELD_DESCRIPTION name /tag name/
!_TAG_FIELD_DESCRIPTION pattern /pattern/
!_TAG_FIELD_DESCRIPTION typeref /Type and name of a variable or typedef/
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_OUTPUT_EXCMD mixed /number, pattern, mixed, or combineV2/
!_TAG_OUTPUT_FILESEP slash /slash or backslash/
!_TAG_OUTPUT_MODE u-ctags /u-ctags or e-ctags/
!_TAG_OUTPUT_VERSION 1.1 /current.age/
!_TAG_PATTERN_LENGTH_LIMIT 96 /0 for no limit/
!_TAG_PROC_CWD /home/tristan/Projects/Crystal/cligen/ //
!_TAG_PROGRAM_AUTHOR Universal Ctags Team //
!_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/
!_TAG_PROGRAM_URL https://ctags.io/ /official site/
!_TAG_PROGRAM_VERSION 6.2.1 /v6.2.1/