1
- # import logging
2
1
import os
3
2
4
3
from typing import Callable , Any
@@ -55,7 +54,7 @@ def convert(self, value, param, ctx):
55
54
return res
56
55
57
56
def shell_complete (self , ctx , param , incomplete ):
58
- others , last = (['' ] + incomplete .rsplit (self .delimiter , 1 ))[- 2 :]
57
+ others , last = ([None ] + incomplete .rsplit (self .delimiter , 1 ))[- 2 :]
59
58
# logging.warning(f"Shell completion for delimited path list: others={others}, last={last}")
60
59
dir_path , prefix = os .path .split (last )
61
60
dir_path = dir_path or '.'
@@ -72,7 +71,7 @@ def shell_complete(self, ctx, param, incomplete):
72
71
elif os .path .isfile (full_path ):
73
72
if self .file_okay :
74
73
possibles .append (full_path )
75
- start = f'{ others } { self .delimiter } ' if others else ''
74
+ start = f'{ others } { self .delimiter } ' if others is not None else ''
76
75
res = [CompletionItem (f"{ start } { path } " ) for path in possibles ]
77
76
# logging.warning(f"Shell completion for delimited path list: res={possibles}")
78
77
return res
@@ -105,10 +104,8 @@ class EasyconfigParam(click.ParamType):
105
104
name = 'easyconfig'
106
105
107
106
def shell_complete (self , ctx , param , incomplete ):
108
- if not incomplete :
109
- return []
110
107
set_up_configuration (args = ["--ignore-index" ], silent = True , reconfigure = True )
111
- return [CompletionItem (ec ) for ec in search_easyconfigs (fr'^{ incomplete } .*\.eb$' , filename_only = True )]
108
+ return [CompletionItem (ec , help = '' ) for ec in search_easyconfigs (fr'^{ incomplete } .*\.eb$' , filename_only = True )]
112
109
113
110
114
111
@dataclass
@@ -150,7 +147,7 @@ def to_click_option_dec(self):
150
147
kwargs ['type' ] = DelimitedString (delimiter = ',' )
151
148
kwargs ['multiple' ] = True
152
149
elif self .type in ['pathlist' , 'pathtuple' ]:
153
- kwargs ['type' ] = DelimitedPathList (delimiter = ',' )
150
+ kwargs ['type' ] = DelimitedPathList (delimiter = os . pathsep )
154
151
kwargs ['multiple' ] = True
155
152
elif self .type in ['urllist' , 'urltuple' ]:
156
153
kwargs ['type' ] = DelimitedString (delimiter = '|' )
0 commit comments