Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

A simple Command Line Option Processor

Project description

clop provides minimal command line option specification and processing.

When your command line processing requires the power of a king on a real horse, use argparse in the standard python library.

When banging two coconut halves together on a stick pony is good enough, use clop.

A single class to specify command line options, process a command line against those options, and make the processed results available as a dict. Also provides a simple help string for each option and the calling program.

Run this module as a program for a short demo, or see main().

  • Options are a dash and a single letter: -o
  • A dash can only appear in front of a single option letter, not in arguments.
  • An option can be followed by zero or more arguments.
  • An option can only be specified with its letter (-o). No –long options.
  • An option letter can be any “letter” where letter.isalpha() is True.
  • Options cannot be composed. Only one character per dash, not -olmp.
  • Options can appear in any order on the command line.
  • Options and arguments on the command line are strings. The calling program does any type and value checking and conversion of arguments after clop’s command line processing. Clop makes no judgments other than allowed options and arguments.

Examples:

cmd.py -o
cmd.py -o arg
cmd.py -o one two
cmd.py -o -n one -m two three

Errors:

cmd.py -o -arg              # Only single letter options.
cmd.py --o one --long two   # No leading double dashes.
cmd.py lost args            # Format is -o and zero or more args for the option.
cmd.py -o one - -n two -    # No lone dashes.

More clop features are unlikely. If you need more, argparse is excellent, and comes with a real horse.

Project details


Release history Release notifications

History Node

0.2.8

History Node

0.2.7

History Node

0.2.6

History Node

0.2.5

History Node

0.2.0

This version
History Node

0.1.2

History Node

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
clop-0.1.2-py2.py3-none-any.whl (7.0 kB) Copy SHA256 hash SHA256 Wheel 2.7 Jun 13, 2016
clop-0.1.2.tar.gz (4.7 kB) Copy SHA256 hash SHA256 Source None Jun 13, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page