Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🩹 Strip leading and trailing whitespace from path inputs #29

Merged
merged 2 commits into from
Sep 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion chonk/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,14 @@ def path_prompt(message: str, default: str, exists: bool = False) -> str:

while True:
path: str = prompt(f"{message} ", default=default, completer=path_completer)
path = path.strip() # # remove leading and trailing whitespace
full_path: str = os.path.abspath(os.path.expanduser(path))
if not exists or os.path.exists(full_path):
return full_path
print(f"🔴 {full_path} DOES NOT EXIST.")


def get_version(ctx, value):
def get_version(ctx, _, value):
if not value or ctx.resilient_parsing:
return
click.echo(f"chonk version {version('chonk')}")
Expand Down