{"id":17383605,"url":"https://github.com/netapp/recline","last_synced_at":"2025-04-15T09:53:32.314Z","repository":{"id":40264997,"uuid":"263628386","full_name":"NetApp/recline","owner":"NetApp","description":"Writing argparse-based command line applications can become tedious, repetitive, and difficult to do right. Relax and let this library free you from that burden.","archived":false,"fork":false,"pushed_at":"2025-03-14T21:19:20.000Z","size":10170,"stargazers_count":10,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-28T19:07:39.615Z","etag":null,"topics":["argparse-alternative","cli","netapp-public","python","shell","terminal"],"latest_commit_sha":null,"homepage":"https://netapp.github.io/recline","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NetApp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-13T12:49:56.000Z","updated_at":"2025-03-14T21:16:54.000Z","dependencies_parsed_at":"2023-01-25T16:00:39.978Z","dependency_job_id":"66b13c04-a516-4af7-9eaa-b13f69c8ce84","html_url":"https://github.com/NetApp/recline","commit_stats":{"total_commits":53,"total_committers":6,"mean_commits":8.833333333333334,"dds":"0.13207547169811318","last_synced_commit":"1c6961ad3fd75b5e2f30b83b5c994989b6de75ed"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetApp%2Frecline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetApp%2Frecline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetApp%2Frecline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetApp%2Frecline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NetApp","download_url":"https://codeload.github.com/NetApp/recline/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249048714,"owners_count":21204306,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["argparse-alternative","cli","netapp-public","python","shell","terminal"],"created_at":"2024-10-16T07:43:14.221Z","updated_at":"2025-04-15T09:53:32.277Z","avatar_url":"https://github.com/NetApp.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](https://github.com/NetApp/recline/actions/workflows/build.yml/badge.svg?branch=main)\n\n# recline\n\nWriting argparse-based command line applications can become tedious, repetitive,\nand difficult to do right. Relax and let this library free you from that burden.\n\nThis library helps you quickly implement an interactive command-based application in Python.\n\n## Documentation First\nWe all know that writing documentation is very important and yet it can easily become\nand afterthought or a nice to have if we're not diligent. This is often because it\nmeans duplicating a piece of your implementation in words, effectively writing the\nsame thing twice. Recline strives to deduplicate this work by taking a documentation\nfirst attitude where your documentation _becomes_ the implementation without additional\nwork from you.\n\n## Interactive\n\nThe default mode is to run a REPL interface where a prompt is given to the user, the\nuser types one of the available commands, the application processes it, displays the\nresult, and then control is returned to the user once more.\n\nBut if your user isn't expected to or doesn't always want to run multiple commands,\nyou also get a more traditional command-line interface for free.\n\n## Command-based\n\nThe application will be command based. Each command will have one or more words\nthat identify the command. It may also have one or more arguments that augment or\nvary the action that command will take.\n\n## Batteries included\n\nWhile the library is designed to be easy to implement for simple or small applications,\nit also comes with full power features for larger use cases including:\n\n* Tab completion\n* Input verification\n* Output formatting\n* Debugger integration\n\n# Before getting started\n\nSome things to consider and prepare before you can use this library.\n\n## Software requirements\n\n```\n1. Python 3.9 or later\n```\n\n## Installing and importing the library\n\nYou can install the package [from pypi](https://pypi.org/project/recline) using the pip utility:\n\n```\npip install recline\n```\n\nYou can then import the library into your application:\n\n```python\nimport recline\n```\n\n# Quick Start\n\nAfter installing the package, you can get started with a few lines in `hello.py`:\n\n```python\nimport recline\n\n@recline.command\ndef hello(name: str = None) -\u003e None:\n    \"\"\"A basic hello world\n\n    You can greet just about anybody with this command if they give you their name!\n\n    Args:\n        name: If a name is provided, the greeting will be more personal\n    \"\"\"\n    response = \"I'm at your command\"\n    if name:\n        response += \", %s\" % name\n    print(response)\n\nrecline.relax()\n```\n\n## Interactive mode\n\nThe default mode when a recline applciation is run is an interactive style. Running\nour above `hello.py` results in the following output:\n\n```\n$ python hello.py\n\u003e help\nAvailable Commands:\n\nhello - A basic hello world You can greet just about anybody with this command if\n\nBuilt-in Commands\n-----------------\nexit - Exit the application\nhelp - Display a list of available commands and their short description\nman - Display the full man page for a given command\n\u003e hello ?\nA basic hello world You can greet just about anybody with this command if\n\nOptional arguments:\n  -name \u003cname\u003e If a name is provided, the greeting will be more personal\n    Default: None\n\u003e hello\nI'm at your command\n\u003e hello -name Dave\nI'm at your command, Dave\n\u003e exit\n$\n```\n\n## Non-interactive mode\n\nIf you would like to use the application as part of a larger script, it is much\neasier to do in a non-interactive way. This is also possible using recline without\nneeding to change the application. Here's an example:\n\n```\n$ python hello.py -c \"hello -name Dave\"\nI'm at your command, Dave\n$\n```\n\nSee the [full documentation](https://netapp.github.io/recline) for more advanced usages and examples\n\n# Contributing [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/NetApp/recline/issues)\n\nYou may read about the contribution process including how to build and test your changes [here](CONTRIBUTING.md).\n\n# Why recline?\n\nThere are a large number of different command line libraries on PyPi and GitHub.\nAnd some of them have the same sort of decorator design. Most, however, are missing\nthe interactive elements that recline focuses on (tab completion, command chaining,\nbackground jobs, man pages). If you're still looking for the right fit for your\napplication and recline isn't it, you can check out these other fine projects (in no\nparticular order):\n\n* https://github.com/kootenpv/cliche\n* https://github.com/gowithfloat/clippy\n* https://github.com/epsy/clize\n* https://github.com/pallets/click\n* https://github.com/micheles/plac\n* https://github.com/google/python-fire\n* https://github.com/kennethreitz-archive/clint\n* https://docs.openstack.org/cliff/latest\n* https://github.com/miguelgrinberg/climax\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetapp%2Frecline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnetapp%2Frecline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetapp%2Frecline/lists"}