mirror of
				https://github.com/python-escpos/python-escpos
				synced 2025-10-23 09:30:00 +00:00 
			
		
		
		
	add basic argcomplete support
This commit is contained in:
		
							
								
								
									
										2
									
								
								setup.py
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								setup.py
									
									
									
									
									
								
							| @@ -110,6 +110,8 @@ setup( | ||||
|         'six', | ||||
|         'appdirs', | ||||
|         'pyyaml', | ||||
|         'argparse', | ||||
|         'argcomplete', | ||||
|     ], | ||||
|     setup_requires=[ | ||||
|         'setuptools_scm', | ||||
|   | ||||
| @@ -1,4 +1,5 @@ | ||||
| #!/usr/bin/env python | ||||
| # PYTHON_ARGCOMPLETE_OK | ||||
| """ CLI | ||||
|  | ||||
| This module acts as a command line interface for python-escpos. It mirrors | ||||
| @@ -14,6 +15,11 @@ from __future__ import print_function | ||||
| from __future__ import unicode_literals | ||||
|  | ||||
| import argparse | ||||
| try: | ||||
|     import argcomplete | ||||
| except ImportError: | ||||
|     # this CLI works nevertheless without argcomplete | ||||
|     pass  # noqa | ||||
| import sys | ||||
| import six | ||||
| from . import config | ||||
| @@ -499,6 +505,10 @@ def main(): | ||||
|                                                            help='Print the version of python-escpos') | ||||
|     parser_command_version.set_defaults(version=True) | ||||
|  | ||||
|     # hook in argcomplete | ||||
|     if 'argcomplete' in globals(): | ||||
|         argcomplete.autocomplete(parser) | ||||
|  | ||||
|     # Get only arguments actually passed | ||||
|     args_dict = vars(parser.parse_args()) | ||||
|     if not args_dict: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Patrick Kanzler
					Patrick Kanzler