Skip to main content

monolith is an argparse based command line interface framework

Project description

monolith is simple framwork for creating command line tools. Subcommands are class based (approach and part of implementation was inspired by Django management commands, however monolith uses argparse instead of optparse).

Supported Python versions are 2.6/2.7 and 3.2+.

Example

#!/usr/bin/env python
"""
Example of how to create git-like execution manager with monolith.
This is completely fake command.
"""
from __future__ import print_function
from __future__ import unicode_literals
from monolith.cli import ExecutionManager
from monolith.cli import LabelCommand
from monolith.cli import arg
from monolith.cli import CompletionCommand


class AddCommand(LabelCommand):

    def handle_label(self, label, namespace):
        print("A %s" % label, file=self.stdout)


def get_manager(**kwargs):
    manager = ExecutionManager(**kwargs)
    manager.register('add', AddCommand)
    manager.register('completion', CompletionCommand),
    manager.execute()

if __name__ == '__main__':
    main()

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

monolith-0.1.0.tar.gz (10.7 kB view details)

Uploaded Source

File details

Details for the file monolith-0.1.0.tar.gz.

File metadata

  • Download URL: monolith-0.1.0.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for monolith-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4562d10a01f9c4243dd1283fb882f4791a2b1bcd9c95b54dde24f397433ac1f2
MD5 df8ee0c98bda052796c2a8d71f399a30
BLAKE2b-256 4946bf9f68247cb55d7e7755ce606db42c12a9feba2133541e9df8251c8f7e6c

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