Skip to content

deohayer/argapp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

argapp - A Python package for CLI application development

Overview

argapp is an OOP wrapper for argparse and argcomplete:

  • Allows writing CLI applications using OOP - encapsulates argparse API.
  • Provides limited support for the shell completion via argcomplete.

Full documentation is available at https://deohayer.github.io/argapp-ws.

Features

  • Offers several classes for CLI parsing via OOP.
    • Arg represents optional and positional arguments, with the most essential use cases covered.
    • App represents a main command or a subcommand.
    • The fields are validated upon construction or setting, raising an Exception in case of any issues.
    • The parsing can be overridden by subclassing Arg.
  • Offers shell completion support if argcomplete is installed:
    • The required API calls are already in place. It is only required to install argcomplete and add the PYTHON_ARGCOMPLETE_OK comment to the script.
    • Specific completions are added automatically.

Dependencies

  • Linux
  • Python 3
    • 3.6
    • 3.7
    • 3.8
    • 3.9
    • 3.10
    • 3.11

Installation

  • The package can be installed globally by running:
    pip3 install argapp
  • The Git repository can be used directly. The repository layout is designed with exactly this use case in mind.
  • For the argcomplete installation, please follow the official documentation.

Limitations

  • No abbreviated optional arguments.
  • No argument groups of any kind.
  • No partial parsing.
  • argcomplete.autocomplete() call is hidden and cannot be parametrized.
  • The completion has no test coverage.