diff --git a/pyproject.toml b/pyproject.toml index 73e99c3..e606f11 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,11 +20,12 @@ requires = [ [tool.flit.scripts] +nice_path = "work_helpers.nice_path:make_nice_path" +random_password = "work_helpers.password:get_random_password" +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_release:sg_mbp_new_version" +sg_mbp_release = "work_helpers.sg_mbp_release:sg_mbp_release" xls2changelog = "work_helpers.excel2changelog:cli" xls2markdown = "work_helpers.excel2markdown:cli" xls2pylist = "work_helpers.excel2pylist:cli" -sg_mbp_release = "work_helpers.sg_mbp_release:sg_mbp_release" -sg_mbp_new_version = "work_helpers.sg_mbp_release:sg_mbp_new_version" -sg_list_frms = "work_helpers.sg_frm_list:cli" -random_password = "work_helpers.password:get_random_password" -sensospot_rename = "work_helpers.sensospot_rename:sensospot_rename" diff --git a/work_helpers/nice_path.py b/work_helpers/nice_path.py new file mode 100644 index 0000000..6d2f269 --- /dev/null +++ b/work_helpers/nice_path.py @@ -0,0 +1,22 @@ +""" create a nice path representation from a copied windows path """ + +import click +import pyperclip + +REPLACEMENTS = { + "G:": "Google Drive", +} + +def replace(segment, replacements=REPLACEMENTS): + return replacements.get(segment, segment) + + +@click.command() +@click.option("--separator", default=" / ") +def make_nice_path(separator): + ugly_path = pyperclip.paste() + ugly_segments = ugly_path.split("\\") + pretty_segments = [replace(segment) for segment in ugly_segments] + pretty_path = separator.join(pretty_segments) + pyperclip.copy(pretty_path) + click.echo(f"Copied path '{pretty_path}' to clipboard", err=True)