Skip to content

Commit

Permalink
Merge pull request #1 from Mimickal/move-from-rolebot
Browse files Browse the repository at this point in the history
  • Loading branch information
Mimickal authored Sep 5, 2021
2 parents fd60ba2 + 3beda9f commit a33bda8
Show file tree
Hide file tree
Showing 6 changed files with 4,422 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Vim things
*.swp

# Node things
node_modules
.nyc_output

32 changes: 28 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,33 @@
# positional-args - Node.js positional argument parser

This library is a positional argument parser for Node.js. The API is flexible
enough to parse just single arguments, or define an entire set of positional
commands. Commands can be parsed from strings or arrays, allowing this library
to be used both for command-line arguments and things like Discord bots.
<a href="LICENSE.md"><img align="right" alt="AGPL-3.0 Logo"
src="https://www.gnu.org/graphics/lgplv3-with-text-154x68.png">
</a>

This library was originally written to be a lightweight, unintrusive alternative
to [Commando](https://www.npmjs.com/package/discord.js-commando) for Discord
bots.

Unlike other argument parsers, this library is built specifically for positional
arguments, allowing it to provide much more functionality and control over how
positional arguments are interpreted. It also doesn't force you to restructure
your code to use it. All the individual pieces are exposed and work standalone,
so you only have to use as much of the library as you need.

Features:
- No external dependencies.
- Lightweight, unintrusive API that doesn't change the paradigm of your code.
- Each class of the library is exposed, so you can use as much or as little as
you want.
- Parses from strings or arrays from any source.
- Validate and transform arguments with user-specified functions.
- Provides parsed arguments in a format similar to other argparse libraries,
such as [yargs](https://www.npmjs.com/package/yargs).
- Define commands with multiple argument lists and auto-generated help text.
- Command registry can consume a command string and delegate it to the
appropriate command.
- Async / Promise friendly. All user-specified functions may be async.
- Useful alternative to Commando.js for Discord bots.

## Installation

Expand Down
Loading

0 comments on commit a33bda8

Please sign in to comment.