u8slvn / hyperfocus

📝 Minimalist daily task manager.
https://hyperfocus.readthedocs.io
MIT License
8 stars 3 forks source link

feat: add click integer list parameter type #13

Closed u8slvn closed 2 months ago

u8slvn commented 3 months ago

Add a new parameter type to cast string into integer list. This will be useful to implement multiple task IDs picking.

"1 2 3" => [1, 2 , 2]

Example:

import click
from hyperfocus.console.core.parameters import INT_LIST

@click.command()
def cli_test():
    value = click.prompt("Enter a list of integers", default=[], type=INT_LIST)
    click.echo(" - ".join(str(item) for item in value))