NAME

App::Spec::Argument - App::Spec objects representing command line options or parameters

SYNOPSIS

EXAMPLES

Options can be defined in a verbose way via key value pairs, but you can also use a shorter syntax.

The first item of the string is the name of the option using a syntax very similar to the one from Getopt::Long.

The idea comes from Ingy's http://www.schematype.org/.

Then you can optionally define a type, a default value and a summary.

You can see a list of supported syntax in this example from t/data/12.dsl.yaml:

---
# version with short dsl syntax
name: myapp
appspec: { "version": 0.001 }
class: App::Spec::Example::MyApp
title: My Very Cool App
abstract: This app can do very cool things
options:
  - foo --Foo
  - spec: verbose|v+ --be verbose
  - spec: +req --Some required flag
  - spec: number=i --integer option
  - spec: number2|n= +integer --integer option
  - date|d=s =today
  - items=s@ --multi option

---
# version with verbose syntax
name: myapp
appspec: { "version": 0.001 }
class: App::Spec::Example::MyApp
title: My Very Cool App
abstract: This app can do very cool things
options:
  - name: foo
    type: flag
    summary: Foo
  - name: verbose
    summary: be verbose
    type: flag
    multiple: true
    aliases: ["v"]
  - name: req
    summary: Some required flag
    required: true
    type: flag
  - name: number
    summary: integer option
    type: integer
  - name: number2
    summary: integer option
    type: integer
    aliases: ["n"]
  - name: date
    type: string
    default: today
    aliases: ["d"]
  - name: items
    type: string
    multiple: true
    summary: multi option

METHODS

common

Builds a hash with the given hashref and fills in some defaults.

my %hash = $class->common($args);
from_dsl

Builds a hash from the dsl string

%dsl = $class->from_dsl("verbose|v+ --Be verbose");