17 Commits

Author SHA1 Message Date
Peter Melnichenko
caf69bc943 Add a test for concat action + overwrite interaction 2018-03-17 14:09:54 +03:00
Peter Melnichenko
3a43d528c6 Fix whitespace warnings 2018-03-16 17:26:31 +03:00
mpeterv
413d3e32f1 Pass command name to command actions 2015-12-09 14:02:23 +03:00
mpeterv
79952deb42 Respect empty initial value in 'append' and 'concat' actions 2015-10-31 20:02:56 +03:00
mpeterv
4fb2991fb2 Add 'concat' action 2015-10-31 19:48:37 +03:00
mpeterv
38b6eb1392 Add :init() property
Allows setting initial stored value. Can be also set using
:default() with a non-string argument.
2015-10-31 19:19:56 +03:00
mpeterv
8343a41dfa Implement string aliases for actions
Added built-in "store_false" action.
2015-10-31 19:09:12 +03:00
mpeterv
4f9841dec6 Implement command actions 2015-10-31 15:50:23 +03:00
mpeterv
decd2040fa Add actions for arguments 2015-10-30 15:18:24 +03:00
mpeterv
93522f1856 Add more action tests 2015-10-30 15:04:45 +03:00
mpeterv
247c8a9cce Redesign argument storing
* Use state objects instead of tons of locals in the main
  function.
* Use actions for storing arguments into result table.
  Actions are now called at the end of each invocation,
  with result table, target index, arguments and overwrite flag as
  arguments.
* Remove command actions.
* Improve error messages, refer to options by the last used alias
  instead of the main name.

TODO:

* Improve error messages further ("argument 'foo' is required"
  -> "missing argument 'foo'", etc.).
* Add actions for positional arguments.
* Add actions for commands (should be called with final results
  after parsing is over, in "innermost first" order).
* Allow referring to built-in actions by strings a-la Python
  (e.g. action = "store_false").
* Allow setting initial value to be stored at target index
  for each option (perhaps use default value for that).
* Add more tests, particularly for actions.
2015-10-29 21:00:49 +03:00
mpeterv
01cc387863 Spec cleanups 2015-03-13 15:19:33 +03:00
mpeterv
59603d5f39 Fixed exploded tests to work with busted 2.0 2014-08-01 17:44:15 +04:00
mpeterv
db3e21e944 Refactoring: added sanity checks in setters 2014-03-02 00:49:44 +04:00
mpeterv
a4b93b0833 Changed actions behaviour
Actions are now just triggers. Actions for arguments and root parser ae removed.
2014-02-26 12:07:53 +04:00
mpeterv
ccad58ef50 return Parser as the module 2014-02-17 18:41:09 +04:00
mpeterv
ae06c981a8 added tests for actions 2014-01-20 22:14:50 +04:00