Skip to content

Commit

Permalink
add base path option
Browse files Browse the repository at this point in the history
  • Loading branch information
SlapDrone committed Nov 17, 2023
1 parent 9421637 commit 69b8ff4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions slopify/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,25 @@ def slop(
def slather(
markdown_file: Path = typer.Option(
None, "--input", "-i", help="Markdown file containing the code to apply."
),
base: Path = typer.Option(
None, "--base", "-b", help="Base directory for applying the code."
)
):
base_path = base or Path.cwd()
if markdown_file:
markdown_content = markdown_file.read_text(encoding="utf-8")
apply_markdown(markdown_content)
apply_markdown(markdown_content, base_path=base_path)
typer.echo(f"Applied code from {markdown_file}")
else:
markdown_content = pyperclip.paste()
if markdown_content:
apply_markdown(markdown_content)
apply_markdown(markdown_content, base_path=base_path)
typer.echo("Applied code from clipboard")
else:
typer.echo("Clipboard is empty. No code was applied.", err=True)


if __name__ == "__main__":
app()

0 comments on commit 69b8ff4

Please sign in to comment.