childsish / argparse-to-json

Convert Python argparse to json compatible with JSON Form

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

argparse-to-json

Convert Python argparse parsers to json compatible with JSON Form.

Usage

import argparse

from argparse_to_json import convert_parser_to_json

parser = argparse.ArgumentParser()
parser.add_argument('input')
json_schema = convert_parser_to_json(parser)

See the example folder for a Flask app that renders forms for command line interfaces using JSON Form. You can run the example as follows:

pip install flask
FLASK_APP=app.py
flask run

Why?

Because maybe I wanted to have a simple way to create GUIs for my Python CLI's.

About

Convert Python argparse to json compatible with JSON Form

License:MIT License


Languages

Language:JavaScript 94.8%Language:Python 4.5%Language:HTML 0.6%