Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a Python library that eases the creation of CLI utilities like Django management commands?

I want to create a set of command-line utilities in python that would be used like so:

python utility.py command1 -option arg

Very similar to django management commands. Is there any library that eases the creation of such commands?

like image 360
Vasil Avatar asked Jun 08 '10 08:06

Vasil


People also ask

What is a Django management command?

Django management commands are included as part of Django apps and are designed to fulfill repetitive or complex tasks through a one keyword command line instruction. Every Django management command is backed by a script that contains the step-by-step Python logic to fulfill its duties.

What is BaseCommand Django?

BaseCommand is a Django object for creating new Django admin commands that can be invoked with the manage.py script. The Django project team as usual provides fantastic documentation for creating your own commands.

What is manage py in Python?

Manage.py in Django is a command-line utility that works similar to the django-admin command. The difference is that it points towards the project's settings.py file. This manage.py utility provides various commands that you must have while working with Django.


2 Answers

Baker is rather nice I think. Optfunc maybe also.

like image 50
Steven Avatar answered Sep 30 '22 23:09

Steven


Optparse is the way to go

like image 32
ba__friend Avatar answered Oct 01 '22 00:10

ba__friend