Some helper scripts for the day to day work with Ubuntu in WSL2
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
634 B

""" 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)