Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General / custom option like -o customkey=customvalue in typer? #397

Open
7 tasks done
tddschn opened this issue May 14, 2022 · 1 comment
Open
7 tasks done

General / custom option like -o customkey=customvalue in typer? #397

tddschn opened this issue May 14, 2022 · 1 comment
Labels
question Question or problem

Comments

@tddschn
Copy link

tddschn commented May 14, 2022

First Check

  • I added a very descriptive title to this issue.
  • I used the GitHub search to find a similar issue and didn't find it.
  • I searched the Typer documentation, with the integrated search.
  • I already searched in Google "How to X in Typer" and didn't find any information.
  • I already read and followed all the tutorial in the docs and didn't find an answer.
  • I already checked if it is not related to Typer but to Click.

Commit to Help

  • I commit to help with one of those options 👆

Example Code

I want my app to do this:

$ my-app -o a=1 -o b=2 -o passwordlogin=false

Description

I'm using my typer app to pass a json body to an API, the body should be formatted like this:

{
  "module1": true
  "module2": false
}

where the module names are supplied by the user.

How do I do this in typer?

Operating System

macOS

Operating System Details

No response

Typer Version

0.4.1

Python Version

Python 3.10.4

Additional Context

No response

@tddschn tddschn added the question Question or problem label May 14, 2022
@Andrew-Sheridan
Copy link

  • accept strings with a known pattern eg keyvalue
  • split the strings on into tuples
  • do stuff with your list of tuples

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question or problem
Projects
None yet
Development

No branches or pull requests

2 participants