feat: add inquirer example
This commit is contained in:
parent
73ddb8084f
commit
c3d893d268
|
@ -1,3 +1,4 @@
|
||||||
|
import inquirer
|
||||||
import typer
|
import typer
|
||||||
|
|
||||||
from joj3_config_generator.utils.logger import logger
|
from joj3_config_generator.utils.logger import logger
|
||||||
|
@ -5,26 +6,26 @@ from joj3_config_generator.utils.logger import logger
|
||||||
app = typer.Typer(add_completion=False)
|
app = typer.Typer(add_completion=False)
|
||||||
|
|
||||||
|
|
||||||
@app.callback()
|
@app.command()
|
||||||
def callback() -> None:
|
def create() -> None:
|
||||||
"""
|
"""
|
||||||
Awesome Portal Gun
|
Create a new JOJ3 config file
|
||||||
"""
|
"""
|
||||||
|
logger.info("Creating")
|
||||||
|
questions = [
|
||||||
|
inquirer.List(
|
||||||
|
"size",
|
||||||
|
message="What size do you need?",
|
||||||
|
choices=["Jumbo", "Large", "Standard", "Medium", "Small", "Micro"],
|
||||||
|
),
|
||||||
|
]
|
||||||
|
answers = inquirer.prompt(questions)
|
||||||
|
logger.info(answers)
|
||||||
|
|
||||||
|
|
||||||
@app.command()
|
@app.command()
|
||||||
def shoot() -> None:
|
def convert() -> None:
|
||||||
"""
|
"""
|
||||||
Shoot the portal gun
|
Convert a JOJ1 config file to JOJ3 config file
|
||||||
"""
|
"""
|
||||||
typer.echo("Shooting portal gun")
|
logger.info("Converting")
|
||||||
logger.info("Shooting portal gun")
|
|
||||||
|
|
||||||
|
|
||||||
@app.command()
|
|
||||||
def load() -> None:
|
|
||||||
"""
|
|
||||||
Load the portal gun
|
|
||||||
"""
|
|
||||||
typer.echo("Loading portal gun")
|
|
||||||
logger.info("Loading portal gun")
|
|
||||||
|
|
144
pdm.lock
144
pdm.lock
|
@ -5,7 +5,7 @@
|
||||||
groups = ["default", "dev", "lint", "test"]
|
groups = ["default", "dev", "lint", "test"]
|
||||||
strategy = ["inherit_metadata"]
|
strategy = ["inherit_metadata"]
|
||||||
lock_version = "4.5.0"
|
lock_version = "4.5.0"
|
||||||
content_hash = "sha256:0abdfb3aee2af3f426cf278d46d31a85433577081a2e77308639f57a5491805d"
|
content_hash = "sha256:07daa7949bf3bbb6729544b8f66c26ea6c033b07c669f98e26c5524501c739fd"
|
||||||
|
|
||||||
[[metadata.targets]]
|
[[metadata.targets]]
|
||||||
requires_python = ">=3.10"
|
requires_python = ">=3.10"
|
||||||
|
@ -25,6 +25,17 @@ files = [
|
||||||
{file = "annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89"},
|
{file = "annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89"},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ansicon"
|
||||||
|
version = "1.89.0"
|
||||||
|
summary = "Python wrapper for loading Jason Hood's ANSICON"
|
||||||
|
groups = ["default"]
|
||||||
|
marker = "platform_system == \"Windows\" and python_version >= \"3.10\""
|
||||||
|
files = [
|
||||||
|
{file = "ansicon-1.89.0-py2.py3-none-any.whl", hash = "sha256:f1def52d17f65c2c9682cf8370c03f541f410c1752d6a14029f97318e4b9dfec"},
|
||||||
|
{file = "ansicon-1.89.0.tar.gz", hash = "sha256:e4d039def5768a47e4afec8e89e83ec3ae5a26bf00ad851f914d1240b444d2b1"},
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "black"
|
name = "black"
|
||||||
version = "24.10.0"
|
version = "24.10.0"
|
||||||
|
@ -62,6 +73,25 @@ files = [
|
||||||
{file = "black-24.10.0.tar.gz", hash = "sha256:846ea64c97afe3bc677b761787993be4991810ecc7a4a937816dd6bddedc4875"},
|
{file = "black-24.10.0.tar.gz", hash = "sha256:846ea64c97afe3bc677b761787993be4991810ecc7a4a937816dd6bddedc4875"},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "blessed"
|
||||||
|
version = "1.20.0"
|
||||||
|
requires_python = ">=2.7"
|
||||||
|
summary = "Easy, practical library for making terminal apps, by providing an elegant, well-documented interface to Colors, Keyboard input, and screen Positioning capabilities."
|
||||||
|
groups = ["default"]
|
||||||
|
marker = "python_version >= \"3.10\""
|
||||||
|
dependencies = [
|
||||||
|
"backports-functools-lru-cache>=1.2.1; python_version < \"3.2\"",
|
||||||
|
"jinxed>=1.1.0; platform_system == \"Windows\"",
|
||||||
|
"ordereddict==1.1; python_version < \"2.7\"",
|
||||||
|
"six>=1.9.0",
|
||||||
|
"wcwidth>=0.1.4",
|
||||||
|
]
|
||||||
|
files = [
|
||||||
|
{file = "blessed-1.20.0-py2.py3-none-any.whl", hash = "sha256:0c542922586a265e699188e52d5f5ac5ec0dd517e5a1041d90d2bbf23f906058"},
|
||||||
|
{file = "blessed-1.20.0.tar.gz", hash = "sha256:2cdd67f8746e048f00df47a2880f4d6acbcdb399031b604e34ba8f71d5787680"},
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfgv"
|
name = "cfgv"
|
||||||
version = "3.4.0"
|
version = "3.4.0"
|
||||||
|
@ -242,6 +272,22 @@ files = [
|
||||||
{file = "distlib-0.3.9.tar.gz", hash = "sha256:a60f20dea646b8a33f3e7772f74dc0b2d0772d2837ee1342a00645c81edf9403"},
|
{file = "distlib-0.3.9.tar.gz", hash = "sha256:a60f20dea646b8a33f3e7772f74dc0b2d0772d2837ee1342a00645c81edf9403"},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "editor"
|
||||||
|
version = "1.6.6"
|
||||||
|
requires_python = ">=3.8"
|
||||||
|
summary = "🖋 Open the default text editor 🖋"
|
||||||
|
groups = ["default"]
|
||||||
|
marker = "python_version >= \"3.10\""
|
||||||
|
dependencies = [
|
||||||
|
"runs",
|
||||||
|
"xmod",
|
||||||
|
]
|
||||||
|
files = [
|
||||||
|
{file = "editor-1.6.6-py3-none-any.whl", hash = "sha256:e818e6913f26c2a81eadef503a2741d7cca7f235d20e217274a009ecd5a74abf"},
|
||||||
|
{file = "editor-1.6.6.tar.gz", hash = "sha256:bb6989e872638cd119db9a4fce284cd8e13c553886a1c044c6b8d8a160c871f8"},
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "exceptiongroup"
|
name = "exceptiongroup"
|
||||||
version = "1.2.2"
|
version = "1.2.2"
|
||||||
|
@ -290,6 +336,37 @@ files = [
|
||||||
{file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"},
|
{file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "inquirer"
|
||||||
|
version = "3.4.0"
|
||||||
|
requires_python = ">=3.8.1"
|
||||||
|
summary = "Collection of common interactive command line user interfaces, based on Inquirer.js"
|
||||||
|
groups = ["default"]
|
||||||
|
marker = "python_version >= \"3.10\""
|
||||||
|
dependencies = [
|
||||||
|
"blessed>=1.19.0",
|
||||||
|
"editor>=1.6.0",
|
||||||
|
"readchar>=4.2.0",
|
||||||
|
]
|
||||||
|
files = [
|
||||||
|
{file = "inquirer-3.4.0-py3-none-any.whl", hash = "sha256:bb0ec93c833e4ce7b51b98b1644b0a4d2bb39755c39787f6a504e4fee7a11b60"},
|
||||||
|
{file = "inquirer-3.4.0.tar.gz", hash = "sha256:8edc99c076386ee2d2204e5e3653c2488244e82cb197b2d498b3c1b5ffb25d0b"},
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "jinxed"
|
||||||
|
version = "1.3.0"
|
||||||
|
summary = "Jinxed Terminal Library"
|
||||||
|
groups = ["default"]
|
||||||
|
marker = "platform_system == \"Windows\" and python_version >= \"3.10\""
|
||||||
|
dependencies = [
|
||||||
|
"ansicon; platform_system == \"Windows\"",
|
||||||
|
]
|
||||||
|
files = [
|
||||||
|
{file = "jinxed-1.3.0-py2.py3-none-any.whl", hash = "sha256:b993189f39dc2d7504d802152671535b06d380b26d78070559551cbf92df4fc5"},
|
||||||
|
{file = "jinxed-1.3.0.tar.gz", hash = "sha256:1593124b18a41b7a3da3b078471442e51dbad3d77b4d4f2b0c26ab6f7d660dbf"},
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "loguru"
|
name = "loguru"
|
||||||
version = "0.7.2"
|
version = "0.7.2"
|
||||||
|
@ -645,6 +722,18 @@ files = [
|
||||||
{file = "pyyaml-6.0.2.tar.gz", hash = "sha256:d584d9ec91ad65861cc08d42e834324ef890a082e591037abe114850ff7bbc3e"},
|
{file = "pyyaml-6.0.2.tar.gz", hash = "sha256:d584d9ec91ad65861cc08d42e834324ef890a082e591037abe114850ff7bbc3e"},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "readchar"
|
||||||
|
version = "4.2.0"
|
||||||
|
requires_python = ">=3.8"
|
||||||
|
summary = "Library to easily read single chars and key strokes"
|
||||||
|
groups = ["default"]
|
||||||
|
marker = "python_version >= \"3.10\""
|
||||||
|
files = [
|
||||||
|
{file = "readchar-4.2.0-py3-none-any.whl", hash = "sha256:2a587a27c981e6d25a518730ad4c88c429c315439baa6fda55d7a8b3ac4cb62a"},
|
||||||
|
{file = "readchar-4.2.0.tar.gz", hash = "sha256:44807cbbe377b72079fea6cba8aa91c809982d7d727b2f0dbb2d1a8084914faa"},
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rich"
|
name = "rich"
|
||||||
version = "13.9.2"
|
version = "13.9.2"
|
||||||
|
@ -662,6 +751,21 @@ files = [
|
||||||
{file = "rich-13.9.2.tar.gz", hash = "sha256:51a2c62057461aaf7152b4d611168f93a9fc73068f8ded2790f29fe2b5366d0c"},
|
{file = "rich-13.9.2.tar.gz", hash = "sha256:51a2c62057461aaf7152b4d611168f93a9fc73068f8ded2790f29fe2b5366d0c"},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "runs"
|
||||||
|
version = "1.2.2"
|
||||||
|
requires_python = ">=3.8"
|
||||||
|
summary = "🏃 Run a block of text as a subprocess 🏃"
|
||||||
|
groups = ["default"]
|
||||||
|
marker = "python_version >= \"3.10\""
|
||||||
|
dependencies = [
|
||||||
|
"xmod",
|
||||||
|
]
|
||||||
|
files = [
|
||||||
|
{file = "runs-1.2.2-py3-none-any.whl", hash = "sha256:0980dcbc25aba1505f307ac4f0e9e92cbd0be2a15a1e983ee86c24c87b839dfd"},
|
||||||
|
{file = "runs-1.2.2.tar.gz", hash = "sha256:9dc1815e2895cfb3a48317b173b9f1eac9ba5549b36a847b5cc60c3bf82ecef1"},
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "shellingham"
|
name = "shellingham"
|
||||||
version = "1.5.4"
|
version = "1.5.4"
|
||||||
|
@ -674,6 +778,18 @@ files = [
|
||||||
{file = "shellingham-1.5.4.tar.gz", hash = "sha256:8dbca0739d487e5bd35ab3ca4b36e11c4078f3a234bfce294b0a0291363404de"},
|
{file = "shellingham-1.5.4.tar.gz", hash = "sha256:8dbca0739d487e5bd35ab3ca4b36e11c4078f3a234bfce294b0a0291363404de"},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "six"
|
||||||
|
version = "1.16.0"
|
||||||
|
requires_python = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"
|
||||||
|
summary = "Python 2 and 3 compatibility utilities"
|
||||||
|
groups = ["default"]
|
||||||
|
marker = "python_version >= \"3.10\""
|
||||||
|
files = [
|
||||||
|
{file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"},
|
||||||
|
{file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"},
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tomli"
|
name = "tomli"
|
||||||
version = "2.0.2"
|
version = "2.0.2"
|
||||||
|
@ -746,6 +862,20 @@ files = [
|
||||||
{file = "virtualenv-20.27.0.tar.gz", hash = "sha256:2ca56a68ed615b8fe4326d11a0dca5dfbe8fd68510fb6c6349163bed3c15f2b2"},
|
{file = "virtualenv-20.27.0.tar.gz", hash = "sha256:2ca56a68ed615b8fe4326d11a0dca5dfbe8fd68510fb6c6349163bed3c15f2b2"},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wcwidth"
|
||||||
|
version = "0.2.13"
|
||||||
|
summary = "Measures the displayed width of unicode strings in a terminal"
|
||||||
|
groups = ["default"]
|
||||||
|
marker = "python_version >= \"3.10\""
|
||||||
|
dependencies = [
|
||||||
|
"backports-functools-lru-cache>=1.2.1; python_version < \"3.2\"",
|
||||||
|
]
|
||||||
|
files = [
|
||||||
|
{file = "wcwidth-0.2.13-py2.py3-none-any.whl", hash = "sha256:3da69048e4540d84af32131829ff948f1e022c1c6bdb8d6102117aac784f6859"},
|
||||||
|
{file = "wcwidth-0.2.13.tar.gz", hash = "sha256:72ea0c06399eb286d978fdedb6923a9eb47e1c486ce63e9b4e64fc18303972b5"},
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "win32-setctime"
|
name = "win32-setctime"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
|
@ -757,3 +887,15 @@ files = [
|
||||||
{file = "win32_setctime-1.1.0-py3-none-any.whl", hash = "sha256:231db239e959c2fe7eb1d7dc129f11172354f98361c4fa2d6d2d7e278baa8aad"},
|
{file = "win32_setctime-1.1.0-py3-none-any.whl", hash = "sha256:231db239e959c2fe7eb1d7dc129f11172354f98361c4fa2d6d2d7e278baa8aad"},
|
||||||
{file = "win32_setctime-1.1.0.tar.gz", hash = "sha256:15cf5750465118d6929ae4de4eb46e8edae9a5634350c01ba582df868e932cb2"},
|
{file = "win32_setctime-1.1.0.tar.gz", hash = "sha256:15cf5750465118d6929ae4de4eb46e8edae9a5634350c01ba582df868e932cb2"},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "xmod"
|
||||||
|
version = "1.8.1"
|
||||||
|
requires_python = ">=3.8"
|
||||||
|
summary = "🌱 Turn any object into a module 🌱"
|
||||||
|
groups = ["default"]
|
||||||
|
marker = "python_version >= \"3.10\""
|
||||||
|
files = [
|
||||||
|
{file = "xmod-1.8.1-py3-none-any.whl", hash = "sha256:a24e9458a4853489042522bdca9e50ee2eac5ab75c809a91150a8a7f40670d48"},
|
||||||
|
{file = "xmod-1.8.1.tar.gz", hash = "sha256:38c76486b9d672c546d57d8035df0beb7f4a9b088bc3fb2de5431ae821444377"},
|
||||||
|
]
|
||||||
|
|
|
@ -6,6 +6,7 @@ dependencies = [
|
||||||
"typer>=0.12.5",
|
"typer>=0.12.5",
|
||||||
"loguru>=0.7.2",
|
"loguru>=0.7.2",
|
||||||
"pydantic>=2.9.2",
|
"pydantic>=2.9.2",
|
||||||
|
"inquirer>=3.4.0",
|
||||||
]
|
]
|
||||||
requires-python = ">=3.6"
|
requires-python = ">=3.6"
|
||||||
authors = [{ name = "JOJ3-dev", email = "joj3@focs.ji.sjtu.edu.cn" }]
|
authors = [{ name = "JOJ3-dev", email = "joj3@focs.ji.sjtu.edu.cn" }]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user