Coverage for leeway/cli.py: 100.00%

5 statements  

« prev     ^ index     » next       coverage.py v7.4.1, created at 2024-02-04 19:49:56 +00:00

1""" 

2Module that contains the command line app. 

3 

4Why does this file exist, and why not put this in __main__? 

5 

6 You might be tempted to import things from __main__ later, but that will cause 

7 problems: the code will get executed twice: 

8 

9 - When you run `python -mleeway` python will execute 

10 ``__main__.py`` as a script. That means there won't be any 

11 ``leeway.__main__`` in ``sys.modules``. 

12 - When you import __main__ it will get executed again (as a module) because 

13 there's no ``leeway.__main__`` in ``sys.modules``. 

14 

15 Also see (1) from http://click.pocoo.org/5/setuptools/#setuptools-integration 

16""" 

17 

18import sys 

19 

20 

21def main(argv=sys.argv): # type: ignore 

22 """ 

23 Args: 

24 argv (list): List of arguments 

25 

26 Returns: 

27 int: A return code 

28 

29 Does stuff. 

30 """ 

31 argv = argv if argv is not None else sys.argv 

32 print(argv) 

33 return 0