Package: recline
reclineWriting argparse-based command line applications can become tedious, repetitive,
and difficult to do right. Relax and let this library free you from that burden.This library helps you quickly implement an interactive command-based application in Python.Documentation FirstWe all know that writing documentation is very important and yet it can easily become
and afterthought or a nice to have if we're not diligent. This is often because it
means duplicating a piece of your implementation in words, effectively writing the
same thing twice. Recline strives to deduplicate this work by taking a documentation
first attitude where your documentationbecomesthe implementation without additional
work from you.InteractiveThe default mode is to run a REPL interface where a prompt is given to the user, the
user types one of the available commands, the application processes it, displays the
result, and then control is returned to the user once more.But if your user isn't expected to or doesn't always want to run multiple commands,
you also get a more traditional command-line interface for free.Command-basedThe application will be command based. Each command will have one or more words
that identify the command. It may also have one or more arguments that augment or
vary the action that command will take.Batteries includedWhile the library is designed to be easy to implement for simple or small applications,
it also comes with full power features for larger use cases including:Tab completionInput verificationOutput formattingDebugger integrationBefore getting startedSome things to consider and prepare before you can use this library.Software requirements1. Python 3.5 or laterInstalling and importing the libraryYou can install the packagefrom pypiusing the pip utility:pip install reclineYou can then import the library into your application:importreclineQuick StartAfter installing the package, you can get started with a few lines inhello.py:importrecline@recline.commanddefhello(name:str=None)->None:"""A basic hello worldYou can greet just about anybody with this command if they give you their name!Args:name: If a name is provided, the greeting will be more personal"""response="I'm at your command"ifname:response+=",%s"%nameprint(response)recline.relax()Interactive modeThe default mode when a recline applciation is run is an interactive style. Running
our abovehello.pyresults in the following output:$ python hello.py
> help
Available Commands:

hello - A basic hello world You can greet just about anybody with this command if

Built-in Commands
-----------------
exit - Exit the application
help - Display a list of available commands and their short description
man - Display the full man page for a given command
> hello ?
A basic hello world You can greet just about anybody with this command if

Optional arguments:
  -name <name> If a name is provided, the greeting will be more personal
    Default: None
> hello
I'm at your command
> hello -name Dave
I'm at your command, Dave
> exit
$Non-interactive modeIf you would like to use the application as part of a larger script, it is much
easier to do in a non-interactive way. This is also possible using recline without
needing to change the application. Here's an example:$ python hello.py -c "hello -name Dave"
I'm at your command, Dave
$See thefull documentationfor more advanced usages and examplesContributingYou may read about the contribution process including how to build and test your changeshere.Why recline?There are a large number of different command line libraries on PyPi and GitHub.
And some of them have the same sort of decorator design. Most, however, are missing
the interactive elements that recline focuses on (tab completion, command chaining,
background jobs, man pages). If you're still looking for the right fit for your
application and recline isn't it, you can check out these other fine projects (in no
particular order):https://github.com/kootenpv/clichehttps://github.com/gowithfloat/clippyhttps://github.com/epsy/clizehttps://github.com/pallets/clickhttps://github.com/micheles/plachttps://github.com/google/python-firehttps://github.com/kennethreitz-archive/clinthttps://docs.openstack.org/cliff/latesthttps://github.com/miguelgrinberg/climax