Skip to main content

A tool that help using python function into terminal

Project description

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.2.0

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

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

easy-terminal-0.8.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

easy_terminal-0.8.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file easy-terminal-0.8.0.tar.gz.

File metadata

  • Download URL: easy-terminal-0.8.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for easy-terminal-0.8.0.tar.gz
Algorithm Hash digest
SHA256 89fa294bdacdc08c1ac588c56311a54ec9eced6b85268535ec21fec1015b614f
MD5 f29903344ac8e9874a78e7d5fa031975
BLAKE2b-256 cd6dc448fcec06dfab66ecabfff7b0bf1dadffa43cb8de7454aade2db2f246bb

See more details on using hashes here.

File details

Details for the file easy_terminal-0.8.0-py3-none-any.whl.

File metadata

File hashes

Hashes for easy_terminal-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c9a1d02c531bc6cd50d41b1dfc40bbf9f74e404da847a4b89c84cc4da0a85b7f
MD5 e04676bc71b7a32285267e3a40618c3d
BLAKE2b-256 844b26d765ac08dd17985af05ebe5035fcf3be8c62862ecdca888d465ad725ae

See more details on using hashes here.

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