Skip to content

twisted-fun/mate

Repository files navigation

Mate: Extremely pluggable and modular shell

build pypi codecov Vulnerabilities

Features

  • Easy plugin creation using setuptools
  • Manage group of plugins better by mate --shells
  • Built-in auto complete
  • Forced modularity in plugins
  • Dope looking shell
  • Provides command output redirect to embedded ipython
  • Supports batch executions by mate --exec and JSON formatted output

Installation

Using pypi

pip3 install mate-shell

Using git

git clone https://github.com/twisted-fun/mate.git
cd mate
pip3 install -e .

Usage

Hope this asciinema will help.

Plugins

Commands can be added into mate shell as plugins. And it's super easy!

Writing a plugin

# demo_plugin.py
from mate import add_plugins, command


def sxor(s1, s2):
    return "".join(chr(ord(a) ^ ord(b)) for a, b in zip(s1, s2))


@command(option="xor")
def bitwise_string_xor(self, str1, str2):
    """A bitwise xor operation for two strings."""
    return {"result": sxor(str1, str2).__repr__()}


add_plugins(modules=[bitwise_string_xor])
# setup.py
from setuptools import setup

setup(
    name="mate-demo-plugin",
    install_requires="mate-shell",
    entry_points={"mate": ["bitwise_str_xor = demo_plugin"]},
    py_modules=["demo_plugin"],
)

Installing the plugin

pip3 install -e .

Accessing the plugin

Check out this asciinema.

About

Extremely pluggable and modular shell

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published