Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Simplification of CLI construction in Python based on argparse: just add branches and arguments. CLI construction from yaml file also available.
Simplification of CLI construction in Python based on argparse: just add branches and arguments. CLI construction from yaml file also available.
If you are interested in participating, please feel free to contribute.
Explore the docs »
Report Bug
Request Feature
pip install arbutus
Once installed, the cli can be defined using a yaml file, using the keywords branches to define new branch names and arguments to define new arguments and it's characteristics. For example:
main:
branches:
sum:
arguments:
integers:
type: float
nargs: +
help: list of integers to sum
action:
name: sum_
source: sample
store:
arguments:
something:
type: str
nargs: +
help: string or strings to store
action: store
The yaml above would imply that a module
named sample includes the action sum_
, and makes use of the store
action.
These actions can be defined using the @Arbutus.new_action
wrapper. For example:
from arbutus import Arbutus
@Arbutus.new_action
def sum_(*args, **kwargs):
total = 0
for number in kwargs['values']:
total += number
print(total)
Finally, the CLI itself can be constructed by calling the from_yaml
method:
import arbutus
if __name__ == '__main__':
cli = arbutus.Arbutus()
cli.from_yaml('sample/cli.yaml')
cli.parse_args()
The CLI can then be called like:
# This would display general help about the CLI functionality
python3 sample/sample.py -h
# This would display general help about the sum test functionality
python3 sample/sample.py sum -h
# This would throw the result of running the sum function with the passed arguments
python3 sample/sample.py sum 12 25 3
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
Distributed under the MIT License. See LICENSE
for more information.
Alvaro U. Bravo - alvaroubravo@gmail.com
Project Links:
FAQs
Simplification of CLI construction in Python based on argparse: just add branches and arguments. CLI construction from yaml file also available.
We found that arbutus demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.