@@ -32,7 +32,10 @@ class Key(NamedTuple):
3232 unsafe : bool
3333
3434
35- def do_shellcheck (melange_cfg : Mapping [str , Any ]) -> None :
35+ def do_shellcheck (
36+ melange_cfg : Mapping [str , Any ],
37+ shellcheck : list [str ],
38+ ) -> None :
3639 if melange_cfg == {}:
3740 return
3841
@@ -51,13 +54,19 @@ def do_shellcheck(melange_cfg: Mapping[str, Any]) -> None:
5154 with tempfile .NamedTemporaryFile (mode = "w" ) as shfile :
5255 shfile .write (step ["runs" ])
5356 subprocess .check_call (
54- [ " shellcheck" , "--shell=busybox" , shfile .name ],
57+ shellcheck + [ "--shell=busybox" , "-- " , shfile .name ],
5558 )
5659
5760
5861def main (argv : Sequence [str ] | None = None ) -> int :
5962 parser = argparse .ArgumentParser ()
6063 parser .add_argument ("filenames" , nargs = "*" , help = "Filenames to check." )
64+ parser .add_argument (
65+ "--shellcheck" ,
66+ default = ["shellcheck" ],
67+ nargs = "*" ,
68+ help = "shellcheck command" ,
69+ )
6170 args = parser .parse_args (argv )
6271
6372 melange_cfg = {}
@@ -82,7 +91,7 @@ def main(argv: Sequence[str] | None = None) -> int:
8291 try :
8392 with open (compiled_out .name ) as compiled_in :
8493 melange_cfg = yaml .load (compiled_in )
85- do_shellcheck (melange_cfg )
94+ do_shellcheck (melange_cfg , args . shellcheck )
8695 except ruamel .yaml .YAMLError as exc :
8796 print (exc )
8897 return 1
0 commit comments