@@ -88,6 +88,24 @@ def _get_arg_parser():
8888 )
8989 lnt .add_argument ("files" , nargs = "*" , help = "Files to lint" )
9090
91+ tst = subp .add_parser (
92+ "test" ,
93+ help = "Lint, then build/run a cfbs project in a throwaway container as one non-interactive check" ,
94+ description = "A convenience wrapper chaining `cfengine lint`, `cfengine build`, `cfengine deploy` and `cfengine run` "
95+ "to quickly test a module or policy-set end-to-end." ,
96+ )
97+ tst .add_argument (
98+ "--strict" ,
99+ type = str ,
100+ default = "yes" ,
101+ help = "Strict mode for linting. Default=yes, checks for undefined promise types, bundles, bodies, functions" ,
102+ )
103+ tst .add_argument (
104+ "files" ,
105+ nargs = "*" ,
106+ help = "Files/Folder to lint (default is . (the entire project) )" ,
107+ )
108+
91109 dev_parser = subp .add_parser (
92110 "dev" , help = "Utilities intended for developers / maintainers of CFEngine"
93111 )
@@ -245,6 +263,11 @@ def run_command_with_args(args) -> int:
245263 (args .strict .lower () in ("y" , "ye" , "yes" )),
246264 args .syntax_description ,
247265 )
266+ if args .command == "test" :
267+ return commands .test (
268+ args .files ,
269+ (args .strict .lower () in ("y" , "ye" , "yes" )),
270+ )
248271 if args .command == "report" :
249272 return cfengine_commands .report (
250273 target = args .hub ,
@@ -376,7 +399,7 @@ def validate_args(args):
376399 if "hub" in args and args .hub :
377400 log .debug (f"validate_args, hubs in args, args.hub='{ args .hub } '" )
378401 if args .hub in ["local" , "localhost" ]:
379- args .hub = ["local " ]
402+ args .hub = ["localhost " ]
380403 else :
381404 args .hub = resolve_hosts (args .hub )
382405
0 commit comments