Code Monkey home page Code Monkey logo

easy-terminal's Introduction

easy-terminal

A library that help you to convert function into terminal command

Getting started

  1. Installation
  2. Usages
  3. Code example
  4. Documentation

Installation

pip install easy-terminal

Require easy-events>=2.11.3

GitHub : Github

Usages

Add the @terminal() before the function you want to try in the terminal Use @main() to redirect any input to the function linked

Code example

from easy_terminal import terminal

help_msg = """
pc processor ram    : will print the informations of the pc
hello               : will print world
help                : will show this message
"""

@terminal(aliases=["help"])
def h():
    print(help_msg)

class A:
    nb = 1

    def __init__(self, nb=5):
        self.nb = nb

    @terminal()
    def hello(self):
        print("world", self.nb, "\n")

a = A(6)

@terminal()
async def hello():
    print("world\n")
    

@terminal()
def pc(processor: str = "intel", ram: str = "8go"):
    print(f"processor: {processor}\nram : {ram}\n")



@main()
def principal(car: str = "mercedes"):
    print(f"Your car is a {car}")

"""
>hello
world

>A.hello
world 1

>a.hello
world 6

>pc
processor: intel
ram : 8go

>pc amd
processor: amd
ram : 8go

>pc amd 16go
processor: amd
ram : 16go

>help

pc processor ram    : will print the informations of the pc
hello               : will print world
help                : will show this message


>peugot
Your car is a peugot
"""

This lib make you run python function in a terminal

easy-terminal's People

Contributors

thephoenix78 avatar

Stargazers

Cory Jones avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.