andreztz / cmd-parser

Command Parser Library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cmd-parser

PyPI - Version PyPI - Python Version

The cmd-parser library provides a simple way to parse command-line style input strings into a structured dictionary format. This is useful for applications that need to interpret commands with arguments and parameters.


Table of Contents

Installation

You can install the Command Parser Library using pip:

pip install cmd-parser

Usage

Here's a quick example of how to use the library:

from cmd_parser.core import asdict, parse

command_string = '!command arg1 arg2 param1="value1 test" param2=value2'
parsed_command = parse(command_string)
print(asdict(parsed_command))

This will output:

{
    'command': 'command',
    'args': ['arg1', 'arg2'],
    'kwargs': {
        'param1': 'value1 test',
        'param2': 'value2'
    }
}

License

cmd-parser is distributed under the terms of the MIT license.

About

Command Parser Library

License:MIT License


Languages

Language:Python 100.0%