Coverage for src/sparkle/CLI/about.py: 83%

12 statements  

« prev     ^ index     » next       coverage.py v7.10.7, created at 2025-10-15 14:11 +0000

1#!/usr/bin/env python3 

2"""Sparkle command to show information about Sparkle.""" 

3 

4import sys 

5import argparse 

6import sparkle.__about__ 

7 

8 

9def parser_function() -> argparse.ArgumentParser: 

10 """Define the command line arguments. 

11 

12 Returns: 

13 The argument parser. 

14 """ 

15 parser = argparse.ArgumentParser("Show information about Sparkle.") 

16 return parser 

17 

18 

19def main(argv: list[str]) -> None: 

20 """Main function of the command.""" 

21 authors = sparkle.__about__.authors.split(", ") 

22 print( 

23 "\n".join( 

24 [ 

25 f"Sparkle ({sparkle.__about__.description})", 

26 f"Version: {sparkle.__about__.__version__}", 

27 f"Licence: {sparkle.__about__.licence}", 

28 f"Written by {', '.join(authors[:-1])} and {authors[-1]}", 

29 f"Contact: {sparkle.__about__.contact}", 

30 "For more details see README.md", 

31 ] 

32 ) 

33 ) 

34 sys.exit() 

35 

36 

37if __name__ == "__main__": 

38 main(sys.argv[1:])