Skip to content
/ MyShell Public

Python library for creating basic shells/menus.

License

Notifications You must be signed in to change notification settings

lu-chi/MyShell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MyShell - Python library for creating shells.

MyShell is a small python library for creating basic shells/menus.

Features

  • Easy to develop with.
  • Auto-complete
  • Support python 2 and 3.

How to

  • Basic shell
"""
 This function called in myshell.shell_add_option,
 and will be executed when the user enter the option.

 args - args[0], args[1] etc... the command line arguments,
 passed by the user.

 every function needs (args) !
"""

def print_database(args):
    if args[0] == "--help":
        print("Hey help")
    print("Database!")


"""
    This will create a basic shell interface.
"""
def shell():
    myshell.shell_add_option("list",   "List files", print_database)
    myshell.shell_add_option("get",    "get files", print_database)
    myshell.shell_add_option("dl", "download files", print_database)
    myshell.shell_add_option("upload", "upload files", print_database)
    """
        Starts the shell.
    """
    myshell.shell_shell()
  • Basic yes/no menu:
"""
 This will create a basic yes/no menu.
"""
def menu():
    """
        0 - for yes/no menu.
        1 - for list menu for example:
            1) red
            2) blue
            3) yellow
    """
    menu = myshell.Menu(0)
    menu.add_entry("Do you want to continue? ", print_database)
    menu.show()
    value = menu.run("> Please select answer")
    print("You selected: %s" %value)

That's easy!

Contributing

Contributions are very welcome!

  1. fork the repository
  2. clone the repo (git clone [email protected]:USERNAME/myshell.git)
  3. make your changes
  4. Add yourself in contributors.txt
  5. push the repository
  6. make a pull request

Thank you - and happy contributing!

Copying

Copyright 2015 (C) Hypsurus [email protected]
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html.

About

Python library for creating basic shells/menus.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages