Skip to main content

Create simple, nested, command-line interfaces.

Project description

Create simple, nested, command-line interfaces with Clams (Command Line Applications Made Simple).

Installation

pip install clams

Example

A simple example with hello and goodbye subcommands. This can be found at /demo/salutation.py.

from clams import arg, Command


salutation = Command('salutation')


@salutation.register('hello')
@arg('name', nargs='?')  # same interface as argparse's ``add_argument``
def handler(name):
    print 'Hello %s' % (name or 'Nick')


@salutation.register('goodbye')
@arg('name', nargs='?')
def handler(name):
    print 'Goodbye %s' % (name or 'Nick')


if __name__ == '__main__':
    salutation.init()
    salutation.parse_args()

Usage:

$ cd demo

$ ./salutation.py hello
Hello Nick
$ ./salutation.py hello Jason
Hello Jason

$ ./salutation.py goodbye "my friend."
Goodbye my friend.

Documentation

Clams documentation is available on ReadTheDocs and can be found locally in the /docs directory.

Issue Reporting and Contact Information

If you have any problems with this software, please take a moment to report them at https://github.com/unbservices/clams or by email to nick@unb.services.

If you are a security researcher or believe you have found a security vulnerability in this software, please contact us by email at nick@unb.services.

Contributing

Contributions are always welcome, whether it’s reporting a bug or sending a pull request. If you want to help, but don’t know where to start, email me at nick@unb.services and I’ll try to point you in the right direction.

Project details


Download files

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

Source Distribution

clams-0.0.5.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

clams-0.0.5-py2-none-any.whl (6.5 kB view details)

Uploaded Python 2

File details

Details for the file clams-0.0.5.tar.gz.

File metadata

  • Download URL: clams-0.0.5.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for clams-0.0.5.tar.gz
Algorithm Hash digest
SHA256 d2270c222edcbcd274670e562c61a7a05ba8ea8a99c0a777d388a93719080ec6
MD5 04b8355e7a7790cda96277a01fe33c37
BLAKE2b-256 ec051538e0f5a2e945789d8a076bd1cfea80c958336b589e844ee6d2ac7e64f3

See more details on using hashes here.

File details

Details for the file clams-0.0.5-py2-none-any.whl.

File metadata

File hashes

Hashes for clams-0.0.5-py2-none-any.whl
Algorithm Hash digest
SHA256 e33735a71ddcf698697c36d9c92ff364633895f3ae8606748b62bfa1093a050d
MD5 36bf509868250dffd9082f0d252fb965
BLAKE2b-256 06c5345ab5833e5b93a561b439b7c50dddd9b0f4d518d63b7e4176290e77caf0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page