Skip to content

Commit 58d199f

Browse files
committed
Support empty lines and comment lines in the options/args file
1 parent 584f856 commit 58d199f

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

byexample/cmdline.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,14 @@ def convert_arg_line_to_args(self, arg_line):
222222
223223
>>> parser.convert_arg_line_to_args('foo bar')
224224
['foo bar']
225+
226+
Empty lines or lines that starts with a # are ignored.
227+
228+
>>> parser.convert_arg_line_to_args(' ')
229+
[]
230+
231+
>>> parser.convert_arg_line_to_args(' # foo ')
232+
[]
225233
'''
226234
arg_line = arg_line.lstrip()
227235
if arg_line and arg_line[0] in self.prefix_chars:
@@ -249,6 +257,12 @@ def convert_arg_line_to_args(self, arg_line):
249257
# Paste the flag with its value (or values) with a '='
250258
return [flag + '=' + value]
251259

260+
if arg_line and arg_line[0] == '#':
261+
return []
262+
263+
if not arg_line:
264+
return []
265+
252266
return [arg_line]
253267

254268

0 commit comments

Comments
 (0)