Browse Source

added cli for generating a list of ints

master
Holger Frey 3 months ago
parent
commit
7c81a21a1f
  1. 1
      pyproject.toml
  2. 15
      work_helpers/random_int.py

1
pyproject.toml

@ -22,6 +22,7 @@ requires = [ @@ -22,6 +22,7 @@ requires = [
[tool.flit.scripts]
nice_path = "work_helpers.nice_path:make_nice_path"
random_password = "work_helpers.password:get_random_password"
random_ints = "work_helpers.random_int:generate_random_number_list"
sensospot_rename = "work_helpers.sensospot_rename:sensospot_rename"
sg_list_frms = "work_helpers.sg_frm_list:cli"
sg_mbp_new_version = "work_helpers.sg_mbp_build:sg_mbp_new_version"

15
work_helpers/random_int.py

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
import click
import random
import pyperclip
@click.command()
@click.argument("length", default=100, type=int)
def generate_random_number_list(length=100):
""" generates a new line separated list of integers and copies it to the clipboard """
numbers = list(range(1, length + 1))
random.shuffle(numbers)
integer_list = "\n".join(str(i) for i in numbers)
pyperclip.copy(integer_list)
click.echo("Copied to clipboard:", err=True)
click.echo(integer_list)
Loading…
Cancel
Save