Skip to content

Commit 3bb2958

Browse files
committed
feat: CLI - open directory/file command (smh)
1 parent 3514b05 commit 3bb2958

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/cli/editor.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,22 @@
1010
from src import App
1111

1212

13+
@click.command()
14+
@click.argument(
15+
"path",
16+
type=click.Path(
17+
exists=True,
18+
dir_okay=True,
19+
resolve_path=True,
20+
),
21+
required=False,
22+
)
23+
def open(path=None) -> typing.Callable[[App, str], None]:
24+
"""Open a file or folder in the editor"""
25+
26+
return lambda app, path=path: app.open(path)
27+
28+
1329
@click.command()
1430
@click.argument(
1531
"path",
@@ -40,3 +56,4 @@ def goto(path=None, linecol=None) -> typing.Callable[[App, str], None]:
4056

4157
def register(cli: click.Group):
4258
cli.add_command(goto)
59+
cli.add_command(open)

0 commit comments

Comments
 (0)