summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* Handle equals character for non-option valuespedantic-equalsLee Jarvis2018-03-121-0/+5
| | | | | | | 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
* Add more tests for Options#separatorLee Jarvis2017-11-171-1/+22
| | | | | | And fixed the inevitable missed last separator.. Fixes #222
* Fix separator so it doesn't mutate user dataMarc-Andre Lafortune2017-11-131-1/+10
|
* Support for required optionsWilliam Woodruff2017-09-291-0/+14
| | | | | | | | | | | 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`.
* Fix bug preventing '--' being passed as the first argument.Thomas Bénéteau2017-08-051-0/+6
|
* Fix non-deterministic testLee Jarvis2017-05-011-1/+1
| | | | There's a FooOption defined in options_test.rb
* Add config option underscore_flagslbriais-feature/add_config_for_underscore_switchLaurent B2017-05-011-0/+4
| | | | | | | | | | | | | | 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
* Fix ridiculous minitest warningLee Jarvis2017-04-292-3/+3
| | | | wat?
* Avoid deleting args after '--'Lee Jarvis2017-04-291-1/+2
| | | | | | | | 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
* Fix support for parsing -x5Lee Jarvis2017-01-291-0/+13
| | | | | | | Thanks to @RickHull for the "smashing" terminology and various conversations Fixes #199
* Handle bad constant names in Slop.option_defined?Lee Jarvis2016-08-211-0/+17
| | | | Closes #198
* Support arguments to options with leading -Andrew Clemons2016-04-041-0/+21
| | | | | | | | This allows negative values as arguments to numeric options and strings starting with - for any other type. Fixes #170 Fixes #179
* Can specify a custom banner string in Options via configPhil Rees2016-03-181-1/+12
|
* Allow disabling the delimiter for array argumentsMike Pastore2016-02-181-0/+6
|
* Fix bug where true is passed to BoolOption block regardless of --no- prefixBen Brady2015-11-241-1/+7
|
* Fix bug regarding --foo=bar style optionsNaoki Mizuno2015-09-081-0/+5
| | | | | | | | | | 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.
* Fix arguments removed with option argumentsNaoki Mizuno2015-09-081-0/+5
| | | | See #181.
* #163 only raise MissingArgument if not default_valueBen Brady2015-06-301-0/+3
|
* Better handling of option names with multiple wordsTim Rogers2015-06-132-6/+18
|
* Support --no- prefix for inverting boolean optionsLee Jarvis2015-05-211-4/+9
| | | | closes #168
* Added support for RegexpLaurent Arnoud2015-05-171-0/+13
| | | | | Used to work on 3.6 See https://github.com/leejarvis/slop/commit/e2775e27d866ba85f6b6bf50536135ee4e93c93e
* Rewrite UnknownOption.getUnknownOption() to flagsigurdsvela2015-04-071-1/+1
| | | | | | Rewrite the UnknownOption.getUnknownOption() to use attr_reader :flags. And rename the initialize parameter unknownOption to flag.
* Rewrite MissingOption.getFlags() to flagssigurdsvela2015-04-071-1/+1
| | | | | | Removes the MissingOption.getFlags() function and replaces it with attr_reader :flags
* Implement getFlags in MissingArgumentsigurdsvela2015-04-061-0/+7
| | | | | | A function in MissingArgument that returns and array of all the flags that matches the option missing an argument
* Remove semi-colons to conform to the code stylesigurdsvela2015-04-061-1/+1
|
* Fix typo in commentsigurdsvela2015-04-061-1/+1
|
* Implement getUnknownMessage in UnknownOptionsigurdsvela2015-04-061-0/+7
| | | | | | | 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.
* Add explicit value setter to Result classLee Jarvis2015-02-041-0/+14
| | | | closes #162
* Remove "--" from the unprocessed argumentsDavid Rodríguez2015-01-111-0/+5
| | | | | The double dash is a valid (special) option for Slop, so like the rest of the options successfully processed, should be removed.
* Support `tail: true` config optionLee Jarvis2015-01-021-0/+6
|
* Reset parser every time parse is calledLee Jarvis2014-12-303-14/+14
|
* Support a limit config to ArrayOptionLee Jarvis2014-12-301-0/+6
|
* add Float supportRick Hull2014-12-291-0/+18
| | | | | | - in lib/ - in test/ - in README
* Add result/parser `arguments` methodLee Jarvis2014-12-191-0/+6
|
* Add NullOption and default to using itLee Jarvis2014-12-172-13/+28
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Default array values to []Lee Jarvis2014-11-191-0/+4
|
* Ensure booleans default to falseLee Jarvis2014-11-191-0/+5
|
* Handle UnknownOption exceptionsLee Jarvis2014-11-191-0/+14
|
* Add MissingArgument error processing, and suppressingLee Jarvis2014-11-191-0/+17
|
* Handle short grouped flagsLee Jarvis2014-11-191-1/+12
|
* Support flag=argLee Jarvis2014-11-191-0/+19
|
* Yield option arguments to option blocksLee Jarvis2014-11-191-0/+7
|
* Allow options to be hidden from help stringLee Jarvis2014-11-191-0/+5
|
* Support method_missing checks for used optionsLee Jarvis2014-11-191-0/+7
|
* Add custom "finish" method for optionsLee Jarvis2014-11-191-0/+17
|
* Handle default valuesLee Jarvis2014-11-191-0/+6
|
* Add more option typesLee Jarvis2014-11-191-0/+54
|
* Store executed count on optionsLee Jarvis2014-11-191-0/+7
|
* Ignore everything after -- and reset the parserLee Jarvis2014-11-191-0/+5
|
* Expose used/unused options in parserLee Jarvis2014-11-191-0/+24
|