Skip to main content

Interact cli.

Project description

https://img.shields.io/pypi/v/interact-cli.svg https://img.shields.io/pypi/pyversions/interact-cli.svg https://img.shields.io/pypi/dm/interact-cli.svg https://api.travis-ci.com/caizhengxin/interact-cli.svg?branch=master Documentation Status https://img.shields.io/github/languages/code-size/caizhengxin/interact-cli https://img.shields.io/pypi/l/interact-cli

Interactive command line tool.

Features

  • Interact input

  • Supports multiple data types

Support type

  • boolean

  • string

  • int

  • list

  • choice

Installation

To install interact-cli, run this command in your terminal:

$ pip3 install interact-cli

Usage

See interact.json

interact:

from interact import interact


if __name__ == "__main__":
    obj = interact("interact.json")
    print(obj)
    print(obj.version)

interacts:

from interact import interacts


config = {
    "project_name": {
        "type": "string",
        "default": "interact-cli",
        "description": "Your Project name"
    },
    "description": {
        "type": "string",
        "default": "Interactive command line tool.",
        "description": "Project description"
    },
    "author": {
        "type": "string",
        "default": "jankincai",
        "description": "Your name"
    },
    "email": {
        "type": "string",
        "default": "jankincai12@gmail.com",
        "description": "Your email"
    },
    "version": {
        "type": "string",
        "default": "0.1.0",
        "description": "Project version"
    },
    "use_code_hosting": {
        "type": "boolean",
        "default": True,
        "description": "Use code hosting platform"
    },
    "code_hosting": {
        "type": "choice",
        "default": 1,
        "choice": [
            "github",
            "gitee",
            "gitlab"
        ],
        "description": "Code hosting",
        "when": "use_code_hosting == true"
    },
    "code_hosting_username": {
        "type": "string",
        "default": "jankincai",
        "description": "Your code hosting username",
        "when": "use_code_hosting == true"
    }
}


if __name__ == "__main__":
    obj = interacts(config)
    print(obj)
    print(obj.version)

load:

from interact import load


if __name__ == "__main__":
    print(load("interact.json"))

loads:

from interact import loads


if __name__ == "__main__":
    print(loads(config))

Demo

Credits

This package was created with Cookiecutter and the caizhengxin/cookiecutter-package project template.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

interact-cli-0.1.0.tar.gz (7.6 kB view hashes)

Uploaded Source

Built Distribution

interact_cli-0.1.0-py2.py3-none-any.whl (9.6 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page