File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ def installed(self) -> bool:
18
18
return which (self .name ) is not None
19
19
20
20
def command (self , prompt : str , qb_args : str ) -> str :
21
+ prompt = prompt or "''"
21
22
return f"{ self .name } { self .args .format (prompt = prompt , qb_args = qb_args )} "
22
23
23
24
def commandline (self , profiles : list [str ], prompt : str , qb_args : str ) -> str :
@@ -59,9 +60,9 @@ def custom_dmenu(command: str) -> Dmenu:
59
60
split = command .split (" " , maxsplit = 1 )
60
61
if len (split ) == 1 or not split [1 ]:
61
62
name = Path (command ).name
62
- for m in supported_menus ():
63
- if isinstance (m , Dmenu ) and m .name == name :
64
- return m if m .name == command else replace (m , name = command )
63
+ for menu in supported_menus ():
64
+ if isinstance (menu , Dmenu ) and menu .name == name :
65
+ return menu if menu .name == command else replace (menu , name = command )
65
66
return Dmenu (split [0 ], split [1 ] if len (split ) == 2 else "" )
66
67
67
68
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ def test_custom_menu_default_args(tmp_path: Path):
70
70
environ ["DISPLAY" ] = ":1"
71
71
dmenu = find_menu (str (menu ))
72
72
assert dmenu is not None
73
- assert f"{ menu } -dmenu" in dmenu .commandline (["p1" , "p2" ], "" , "" )
73
+ assert f"{ menu } -dmenu -no-custom -p '' " in dmenu .commandline (["p1" , "p2" ], "" , "" )
74
74
75
75
76
76
def test_custom_menu_custom_args (tmp_path : Path ):
@@ -80,4 +80,4 @@ def test_custom_menu_custom_args(tmp_path: Path):
80
80
environ ["DISPLAY" ] = ":1"
81
81
dmenu = find_menu (command )
82
82
assert dmenu is not None
83
- assert command in dmenu .commandline (["p1" , "p2" ], "" , "" )
83
+ assert dmenu .commandline (["p1" , "p2" ], "" , "" ). endswith ( command )
You can’t perform that action at this time.
0 commit comments