diff --git a/src/cli/editor.py b/src/cli/editor.py index 9ff29a3f..d6e893d1 100644 --- a/src/cli/editor.py +++ b/src/cli/editor.py @@ -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", @@ -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)