Coverage for mfplugin/cli_tools/plugins_validate_name.py: 0%

17 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-11-13 15:57 +0000

1#!/usr/bin/env python3 

2 

3import argparse 

4import sys 

5from mfplugin.utils import validate_plugin_name, BadPluginName 

6 

7DESCRIPTION = "validate a plugin name" 

8 

9 

10def main(): 

11 arg_parser = argparse.ArgumentParser(description=DESCRIPTION) 

12 arg_parser.add_argument("plugin_name", type=str, 

13 help="plugin name candidate") 

14 args = arg_parser.parse_args() 

15 

16 try: 

17 validate_plugin_name(args.plugin_name) 

18 except BadPluginName as e: 

19 print("ERROR: %s" % e) 

20 sys.exit(1) 

21 print("OK") 

22 sys.exit(0) 

23 

24 

25if __name__ == '__main__': 

26 main()