Skip to content

Commit

Permalink
feat: CLI - open directory/file command (smh)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlin7 committed Jun 12, 2024
1 parent 3514b05 commit 3bb2958
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/cli/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@
from src import App


@click.command()
@click.argument(
"path",
type=click.Path(
exists=True,
dir_okay=True,
resolve_path=True,
),
required=False,
)
def open(path=None) -> typing.Callable[[App, str], None]:
"""Open a file or folder in the editor"""

return lambda app, path=path: app.open(path)


@click.command()
@click.argument(
"path",
Expand Down Expand Up @@ -40,3 +56,4 @@ def goto(path=None, linecol=None) -> typing.Callable[[App, str], None]:

def register(cli: click.Group):
cli.add_command(goto)
cli.add_command(open)

0 comments on commit 3bb2958

Please sign in to comment.