Skip to content

terminal command lisa accepts directory name #1357

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions apps/mintty/mintty_win.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import subprocess
from typing import Optional

from talon import Context, Module, actions, settings, ui

Expand Down Expand Up @@ -113,8 +114,8 @@ def file_manager_open_volume(volume: str):
"""file_manager_open_volume"""
actions.user.file_manager_open_directory(volume)

def terminal_list_directories():
actions.insert("ls")
def terminal_list_directories(path: Optional[str] = None):
actions.insert(f"ls {path or ''}")
actions.key("enter")

def terminal_list_all_directories():
Expand Down
5 changes: 3 additions & 2 deletions apps/windows_command_processor/command_processor_win.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
from typing import Optional

from talon import Context, actions, ui

Expand Down Expand Up @@ -79,9 +80,9 @@ def file_manager_open_volume(volume: str):
"""file_manager_open_volume"""
actions.user.file_manager_open_directory(volume)

def terminal_list_directories():
def terminal_list_directories(path: Optional[str] = None):
"""Lists directories"""
actions.insert("dir")
actions.insert(f"dir {path or ''}")
actions.key("enter")

def terminal_list_all_directories():
Expand Down
5 changes: 3 additions & 2 deletions apps/wsl/wsl.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import re
import subprocess
import sys
from typing import Optional

from talon import Context, Module, actions, app, ui
from talon.debug import log_exception
Expand Down Expand Up @@ -475,8 +476,8 @@ def file_manager_select_file(path: str):
def file_manager_open_volume(volume: str):
actions.user.file_manager_open_directory(volume)

def terminal_list_directories():
actions.insert("ls")
def terminal_list_directories(path: Optional[str] = None):
actions.insert(f"ls {path or ''}")
actions.key("enter")

def terminal_list_all_directories():
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ pythonpath = [

[tool.pyright]
reportSelfClsParameterName = false
reportGeneralTypeIssues = false
4 changes: 3 additions & 1 deletion tags/terminal/terminal.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from typing import Optional

from talon import Module

mod = Module()


@mod.action_class
class Actions:
def terminal_list_directories():
def terminal_list_directories(path: Optional[str] = None):
"""Lists directories"""

def terminal_list_all_directories():
Expand Down
2 changes: 1 addition & 1 deletion tags/terminal/terminal.talon
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ tag: terminal
-
# tags should be activated for each specific terminal in the respective talon file

lisa: user.terminal_list_directories()
lisa [dir] [<user.text>]: user.terminal_list_directories(text or "")
lisa all: user.terminal_list_all_directories()
katie [dir] [<user.text>]: user.terminal_change_directory(text or "")
katie root: user.terminal_change_directory_root()
Expand Down
7 changes: 4 additions & 3 deletions tags/terminal/unix_shell.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Optional

from talon import Context, Module, actions

ctx = Context()
Expand All @@ -14,9 +16,8 @@
class Actions:
# Implements the functions from terminal.py for unix shells

def terminal_list_directories():
"""Lists directories"""
actions.insert("ls")
def terminal_list_directories(path: Optional[str] = None):
actions.insert(f"ls {path or ''}")
actions.key("enter")

def terminal_list_all_directories():
Expand Down
9 changes: 5 additions & 4 deletions tags/terminal/windows_shell.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Optional

from talon import Context, Module, actions

ctx = Context()
Expand All @@ -9,11 +11,10 @@

@ctx.action_class("user")
class Actions:
# Implements the functions from terminal.py for unix shells
# Implements the functions from terminal.py for PowerShell

def terminal_list_directories():
"""Lists directories"""
actions.insert("ls")
def terminal_list_directories(path: Optional[str] = None):
actions.insert(f"ls {path or ''}")
actions.key("enter")

def terminal_list_all_directories():
Expand Down
Loading