diff --git a/pyproject.toml b/pyproject.toml index 499a070..16f9336 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" diff --git a/work_helpers/random_int.py b/work_helpers/random_int.py new file mode 100644 index 0000000..30f7024 --- /dev/null +++ b/work_helpers/random_int.py @@ -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) + \ No newline at end of file