Skip to content

Added actual documentation! (and some fun API tweaks)

Latest
Compare
Choose a tag to compare
@Mimickal Mimickal released this 17 Sep 22:44
1d32d16

General changes

The biggest change here is the addition of actual documentation. See https://github.com/Mimickal/positional-args/blob/master/API.md

API changes

Removed

  • Command.getDescription(). This was a silly one-off function that no other fields had. With the addition of property accessors, it didn't make sense to keep this. Use Command.desc instead.
  • Fake private underscore instance values (_async, _name, etc...) and functions (_parseSingle, etc...) have been replaced with real private values. You shouldn't have been using these anyway, but now you can't!

These removals don't actually remove functionality though, because...

Added

  • ... most instance properties have now been exposed via javascript getters and setters. You can still do everything with the functional interfaces, but these are provided for people who prefer imperative interfaces.
    • get/set Argument.is_async
    • get/set Argument.is_optional
    • get/set Argument.is_varargs
    • get/set Argument.name
    • get/set Argument.preprocessor
    • get Command.argsets (no set, this is read-only)
    • get/set Command.desc (Use this now that Command.getDescription() has been removed)
    • get/set Command.is_async
    • get/set Command.name
    • get/set CommandRegistry.is_async
    • get/set CommandRegistry.default_handler
    • (No getter/setter for help handler yet, since that's actually implemented as a command).
  • The built-in help handler and default command handler are now both available as static functions:
    • CommandRegistry.defaultDefaultHandler(parts)
    • CommandRegistry.defaultHelpHandler(args, command_map)