Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

monolith

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

monolith

monolith is an argparse based command line interface framework

  • 0.3.3
  • PyPI
  • Socket score

Maintainers
1

.. image:: https://secure.travis-ci.org/lukaszb/monolith.png?branch=master :target: http://travis-ci.org/lukaszb/monolith

Monolith

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, 3.2+ and PyPy.

Latest documentation can be found at https://monolith.readthedocs.org/en/latest/.

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 monolith.cli import SimpleExecutionManager
from monolith.cli import BaseCommand
from monolith.cli import LabelCommand
from monolith.cli import arg

class AddCommand(LabelCommand):
    
    def handle_label(self, label, namespace):
        print("A %s" % label)


class CommitCommand(BaseCommand):
    args = BaseCommand.args + [
        arg('-a', '--add', action='store_true', default=False),
        arg('-m', '--message', help="Commit's message", required=True),
    ]

    def handle(self, namespace):
        print('Commit message: %r' % namespace.message)
        if namespace.add:
            print(' * add switch given!')


def main():
    manager = SimpleExecutionManager('mygit', commands={
        'add': AddCommand,
        'commit': CommitCommand,
    })
    manager.execute()

if __name__ == '__main__':
    main()

FAQs


Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc