| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
See https://github.com/leejarvis/slop/pull/251
|
|
|
|
|
|
|
| |
- https://github.com/leejarvis/slop/pull/250#discussion_r367361652
- https://github.com/leejarvis/slop/pull/250#discussion_r367420001
Signed-off-by: Hansuk <flavono123@gmail.com>
|
|
|
|
|
|
|
| |
- reference: https://stackoverflow.com/questions/638565/parsing-scientific-notation-sensibly
- remove the todo comment(no idea for etc)
Signed-off-by: Hansuk <flavono123@gmail.com>
|
|
|
|
| |
Signed-off-by: Hansuk <flavono123@gmail.com>
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
If flag value starts with "-", unknown option error is raised.
The current flag value check is "orig_arg == opt.value.to_s". There
are some objects such as Regexp and Time that input value and its #to_s
aren't same.
|
| |
|
|
|
|
|
|
|
|
| |
It's clear that we want an empty line when calling `opts.separator`
without arguments.
Leave the examples in the Readme still for a while with the empty string
to avoid confusion when using older versions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
use Slop::Result#clean_key in Slop::Result#option
fix typo in Slop::Result#[] and Slop::Result#fetch descriptions
handle case when Slop::Result#fetch tries to fetch an option that is not provided and does not have a default value
raise Slop::UnknownOption when Slop::Result#fetch tries to fetch an unexisting key
set Slop::Result#clean_key method as private
remove redundant Slop::Result#fetch tests
update description of Slop::Result#fetch test when trying to access an unexisting option
update error message when an option is not present on Slop::Result#fetch
description of Slop::Result#fetch
update expected error message on test for Slop::Result#fetch when an option is not present
|
|
|
|
|
|
|
| |
If the string includes an equals char but doesn't look like it's a
possible candidate for a flag=value, we should ignore it
see #226
|
|
|
|
|
|
| |
And fixed the inevitable missed last separator..
Fixes #222
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
This commit introduces support for required options,
which are options that cause the parser to raise
a `MissingRequiredOption` exception if not present.
Options can be marked as required by passing
`required: true` in their configuration, and any errors
caused by missing required options can be suppressed via
`suppress_errors: true`.
|
| |
|
|
|
|
| |
There's a FooOption defined in options_test.rb
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The default behaviour of translation flags-with-dashes is to underscore
them so they're symbol friendly. This config option allows us to avoid
this translation and simply return the flags verbatim:
opts = Slop.parse(underscore_flags: false) do |o|
o.on "--foo-bar"
end
opts.to_hash #=> { :"foo-bar" => true }
closes #204
|
|
|
|
| |
wat?
|
|
|
|
|
|
|
|
| |
Everything after -- is sacred and shouldn't be mutated. So lets just
remove it all straight away and add it to our arguments list after we're
done parsing
Closes #194
|
|
|
|
|
|
|
| |
Thanks to @RickHull for the "smashing" terminology and various
conversations
Fixes #199
|
|
|
|
| |
Closes #198
|
|
|
|
|
|
|
|
| |
This allows negative values as arguments to numeric options and strings
starting with - for any other type.
Fixes #170
Fixes #179
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This fixes the bug introduced in ebe678b1639654604b3e54b08ca710c38682b83e
where the argument after a flag is naively deleted. For example, with
--foo=bar baz
, both `--foo=bar' and `baz' are deleted when only `--foo=bar' should be
deleted.
|
|
|
|
| |
See #181.
|
| |
|
| |
|
|
|
|
| |
closes #168
|
|
|
|
|
| |
Used to work on 3.6
See https://github.com/leejarvis/slop/commit/e2775e27d866ba85f6b6bf50536135ee4e93c93e
|
|
|
|
|
|
| |
Rewrite the UnknownOption.getUnknownOption() to use
attr_reader :flags. And rename the initialize parameter
unknownOption to flag.
|
|
|
|
|
|
| |
Removes the MissingOption.getFlags() function
and replaces it with
attr_reader :flags
|
|
|
|
|
|
| |
A function in MissingArgument that returns
and array of all the flags that matches
the option missing an argument
|
| |
|
| |
|
|
|
|
|
|
|
| |
This allows to retrive the unknown option in
question when catching the error.
This can be useful to, for example, taylor a
spesific output for common errors amongst users.
|
|
|
|
| |
closes #162
|
|
|
|
|
| |
The double dash is a valid (special) option for Slop, so like the rest
of the options successfully processed, should be removed.
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
- in lib/
- in test/
- in README
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A NullOption is one whos return value we don't care about. For example,
you might just want a `--version` option which simply prints the
version and exits. In this case, having a `true` value in `to_hash` is
really just noise. We probably don't care about it, using NullOption
discards it.
I think using this for Options#on makes sense because this is logical:
opts.on '--version' do
puts VERSION
exit
end
Rather than:
opts.add '--version' do
puts VERSION
exit
end
And defaulting to a StringOption. This also means you have to be
explicit about adding such an option, which is a good thing.
|
| |
|
| |
|
| |
|
| |
|
| |
|