Skip to main content

Create your own shell.

Project description

header

levish: Create your own Shell

Installation

Install levish using pip:

pip install levish

Getting started

Using levish is very easy. We start by importing the 'Shell' class and creating a new Shell object.

from levish import Shell

sh = Shell("MyShell")

After that we can create our first command. We do that by first creating a simple function. The function has to take varargs called '*args'. Then we can add the function to our Shell object using the add_command() method. Pass in our new created function and add a simple description using the 'description' argument.

def hello(*args):
    print("what's up?")

sh.add_command(hello, description="This command prints hello!")

Now we just need to run our shell. We do that by executing the run() function of our Shell object.

Complete code

from levish import Shell

sh = Shell("MyShell")

def cmd_hello(*args):
    print("hello!")

sh.add_command(hello, description="This command prints hello!")

sh.run()

Output

[>] hello
hello!

Other examples can be found in the examples folder.

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

levish-0.1.8.1.tar.gz (4.2 kB view hashes)

Uploaded Source

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