Skip to content

hypercli is a powerful Python package that simplifies the process of creating interactive menus and command-line interfaces. It provides a user-friendly and customizable interface for building command-line applications with enhanced features.

License

Notifications You must be signed in to change notification settings

HYP3R00T/hypercli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

 _                               _ _
| |                             | (_)
| |__  _   _ _ __   ___ _ __ ___| |_
| '_ \| | | | '_ \ / _ \ '__/ __| | |
| | | | |_| | |_) |  __/ | | (__| | |
|_| |_|\__, | .__/ \___|_|  \___|_|_|
        __/ | |
       |___/|_|               v 1.0.1

hypercli

hypercli is a Python package that provides an elegant solution for interacting with command line tools. It offers a menu-based command line interface (CLI) that allows users to navigate through different options and execute functions based on their choices.

Features

  • Generate menu-driven CLI programs with ease using decorators
  • Customize the menus, options, and visual styles according to your requirements
  • Supports nested menus and navigation between menus

Installation

You can install hypercli using pip. Open your terminal and run the following command:

pip install hypercli

Usage

To use hypercli, import the hypercli module from the hypercli package and create an instance of the hypercli class. You can then define your menus, options, and functions to be executed. Finally, call the run() method to start the CLI interface.

Use the Wiki for more information on the configs, methods, and resources available in hypercli.

Here's an example of how to use hypercli:

# import hypercli
from hypercli import hypercli

# create an instance of hypercli
cli = hypercli()

# configure the instance
cli.config["banner_text"] = "HYPERCLI"
cli.config["intro_title"] = "Intro"
cli.config["intro_content"] = "Generate enhanced menu-driven CLI programs with ease!"
cli.config["show_menu_table_header"] = True

# add navigation options to the menu
cli.link("Main Menu", "Mathematics Menu")
cli.link("Main Menu", "String Menu")


@cli.entry(menu="Main Menu", option="Greeter")
def greet():
    name = input("Enter your name: ")
    print(f"Hello, {name}!")


@cli.entry(menu="Mathematics Menu", option="Add two numbers")
def add(num1=1, num2=1):
    a = int(input(f"Enter first number (default {num1}): ") or num1)
    b = int(input(f"Enter second number (default {num2}): ") or num2)
    print(f"{a} + {b} = {a + b}")


@cli.entry(menu="Mathematics Menu", option="Subtract two numbers")
def sub(num1=1, num2=1):
    a = int(input(f"Enter first number (default {num1}): ") or num1)
    b = int(input(f"Enter second number (default {num2}): ") or num2)
    print(f"{a} - {b} = {a - b}")


@cli.entry(menu="String Menu", option="Reverse a string")
def reverse():
    string = input("Enter a string: ")
    print(string[::-1])


@cli.entry(menu="String Menu", option="Show length of a string")
def str_length():
    string = input("Enter a string: ")
    print(f"Length of string is {len(string)}")


# run the cli
cli.run()

License

This project is licensed under the MIT License. See the MIT file for more information.

About

hypercli is a powerful Python package that simplifies the process of creating interactive menus and command-line interfaces. It provides a user-friendly and customizable interface for building command-line applications with enhanced features.

Topics

Resources

License

Stars

Watchers

Forks

Languages