Skip to content

Commit

Permalink
Better rendering of options
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Oct 13, 2022
1 parent b9044ef commit 4db7d10
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 24 deletions.
48 changes: 36 additions & 12 deletions README.md
Expand Up @@ -140,33 +140,57 @@ If the specification of the option does **not** contain an equal sign `=`, then

Some examples:

* -i option "i" is True
* -i

* -j5 option "j" has the value 5
Option "i" is True.

* -im options "i" and "m" are True
* -j5

* -/i option "i" is False
Option "j" has the value 5.

* -/im options "i" and "m" are False
* -im

* -no-i option "i" is False
Options "i" and "m" are True.

* --foo option "foo" is True
* -/i

* --/foo option "foo" is False
Option "i" is False.

* --no-foo option "foo" is False
* -/im

Options "i" and "m" are False.

* -no-i

Option "i" is False.

* --foo

Option "foo" is True.

* --/foo

Option "foo" is False.

* --no-foo

Option "foo" is False.

If the specification of an option contains an equal sign after the name, then whatever follows that, is considered the value of that option. Whether or not that value needs to be quoted, and how they are to be quoted, really depends on the shell that you use to access `rak`. Generally, if the value consists of alphanumeric characters only, no quoting is necessary. Otherwise it's better to quote your values.

Some examples:

* -s=foo option "s" has the value "foo"
* -s=foo

Option "s" has the value "foo".

* -t='foo bar'

Option "t" has the value "foo bar".

* -t='foo bar' option "t" has the value "foo bar"
* --frobnicate=yes

* --frobnicate=yes option "frobnicate" has the value "yes"
Option "frobnicate" has the value "yes".

CREATING YOUR OWN OPTIONS
=========================
Expand Down
58 changes: 46 additions & 12 deletions doc/App-Rak.rakudoc
Expand Up @@ -174,15 +174,41 @@ is considered to represent C<True>. The value can be negated in two ways:

Some examples:

=item -i option "i" is True
=item -j5 option "j" has the value 5
=item -im options "i" and "m" are True
=item -/i option "i" is False
=item -/im options "i" and "m" are False
=item -no-i option "i" is False
=item --foo option "foo" is True
=item --/foo option "foo" is False
=item --no-foo option "foo" is False
=item -i

Option "i" is True.

=item -j5

Option "j" has the value 5.

=item -im

Options "i" and "m" are True.

=item -/i

Option "i" is False.

=item -/im

Options "i" and "m" are False.

=item -no-i

Option "i" is False.

=item --foo

Option "foo" is True.

=item --/foo

Option "foo" is False.

=item --no-foo

Option "foo" is False.

If the specification of an option contains an equal sign after the name,
then whatever follows that, is considered the value of that option. Whether
Expand All @@ -193,9 +219,17 @@ it's better to quote your values.

Some examples:

=item -s=foo option "s" has the value "foo"
=item -t='foo bar' option "t" has the value "foo bar"
=item --frobnicate=yes option "frobnicate" has the value "yes"
=item -s=foo

Option "s" has the value "foo".

=item -t='foo bar'

Option "t" has the value "foo bar".

=item --frobnicate=yes

Option "frobnicate" has the value "yes".

=head1 CREATING YOUR OWN OPTIONS

Expand Down

0 comments on commit 4db7d10

Please sign in to comment.