commandparse


Namecommandparse JSON
Version 1.1.2 PyPI version JSON
download
home_pagehttps://github.com/flgy/commandparse
SummaryCLI application commands parser
upload_time2023-07-30 18:17:30
maintainer
docs_urlNone
authorflgy
requires_python
licenseMIT
keywords cli command argparse parser
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # commandparse

Module to parse command based CLI application.

Usage:

* Subclass the Command class
* Add a method with a name such as `prefix_commandname` with kwargs as required argument
* Create an ArgumentParser instance
* Call the `Subclass.add_suparsers` with the ArgumentParser instance and other settings
* Use the `dispatch_command` function with the args returned by `parser.parse_args()`

```
parser = ArgumentParser(...)
[...]
Subclass.add_subparsers(parser, prefixes=["get_", "do_", ...], title="commands", description="available commands")

cmd = Subclass(...)
cmd.dispatch_command(commands, args)
```

See example.py for a more complete example. For a real world application using this lib, see: https://github.com/franc-pentest/ldeep

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/flgy/commandparse",
    "name": "commandparse",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "CLI,command,argparse,parser",
    "author": "flgy",
    "author_email": "florian.guilbert@synacktiv.com",
    "download_url": "https://files.pythonhosted.org/packages/79/6b/6f1879101e405e2a5c7d352b340bc97d1936f8d54a8934ae32aac1828e50/commandparse-1.1.2.tar.gz",
    "platform": "any",
    "description": "# commandparse\n\nModule to parse command based CLI application.\n\nUsage:\n\n* Subclass the Command class\n* Add a method with a name such as `prefix_commandname` with kwargs as required argument\n* Create an ArgumentParser instance\n* Call the `Subclass.add_suparsers` with the ArgumentParser instance and other settings\n* Use the `dispatch_command` function with the args returned by `parser.parse_args()`\n\n```\nparser = ArgumentParser(...)\n[...]\nSubclass.add_subparsers(parser, prefixes=[\"get_\", \"do_\", ...], title=\"commands\", description=\"available commands\")\n\ncmd = Subclass(...)\ncmd.dispatch_command(commands, args)\n```\n\nSee example.py for a more complete example. For a real world application using this lib, see: https://github.com/franc-pentest/ldeep\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "CLI application commands parser",
    "version": "1.1.2",
    "project_urls": {
        "Homepage": "https://github.com/flgy/commandparse"
    },
    "split_keywords": [
        "cli",
        "command",
        "argparse",
        "parser"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "796b6f1879101e405e2a5c7d352b340bc97d1936f8d54a8934ae32aac1828e50",
                "md5": "ee2a58eb3c5bbfc1f677992e5234ea4f",
                "sha256": "4bd7bdd01b52eaa32316d6149a00b4c3820a40ff2ad62476b46aaae65dbe9faa"
            },
            "downloads": -1,
            "filename": "commandparse-1.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "ee2a58eb3c5bbfc1f677992e5234ea4f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5366,
            "upload_time": "2023-07-30T18:17:30",
            "upload_time_iso_8601": "2023-07-30T18:17:30.839275Z",
            "url": "https://files.pythonhosted.org/packages/79/6b/6f1879101e405e2a5c7d352b340bc97d1936f8d54a8934ae32aac1828e50/commandparse-1.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-30 18:17:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "flgy",
    "github_project": "commandparse",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "commandparse"
}
        
Elapsed time: 0.42381s