Create your own shell.
Project description
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file levish-0.1.8.1.tar.gz
.
File metadata
- Download URL: levish-0.1.8.1.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f977ab64bc4ecec28a97821da671cb4a27ff697ca6dc994a7a245f1a369163c |
|
MD5 | 2f1cefa3860ce4fa27414bf1706b9fdc |
|
BLAKE2b-256 | 14479709e8f88a1c534f7ece12fdd7da279f494acdd2ba4a6e3d69754e81f6ed |