Package with scripts to use ANSI characters to modify the shell output.
Project description
Shell Utilities
The project shell-utilities is a set of scripts to use ANSI characters to modify the shell output.
Messages
This module provide a class to management the shell output from the program. Is posible enable or disable different types of messages and provide a style with ANSI codes, is posible disable this function also.
Example
import sys
import argparse
from shellu.messages import *
mw = MessageWriter.getInstance()
def writeInformation(message: str):
mw.writeMessage(message=message)
def writeError(message: str):
mw.writeMessage(message=message, messagetype=MessageType.ERROR, foregroundcolor=ForegroundColor.RED)
def writeVerbose(message: str):
mw.writeMessage(message=message, messagetype=MessageType.VERBOSE, backgroundcolor=BackgroundColor.BLACK, foregroundcolor=ForegroundColor.YELLOW, displaymode=DisplayMode.BOLD)
def writeDebug(message: str):
mw.writeMessage(message=message, messagetype=MessageType.DEBUG, foregroundcolor=ForegroundColor.PURPLE)
def writeWarning(message: str):
mw.writeMessage(message=message, messagetype=MessageType.WARNING, backgroundcolor=BackgroundColor.YELLOW, foregroundcolor=ForegroundColor.RED, displaymode=DisplayMode.NEGATIVE2)
def argumentsParser(args):
parser = argparse.ArgumentParser(description="Test script")
parser.add_argument('-v', '--verbose', dest='verbose', action='store_true', help='Enable the verbose messages')
parser.add_argument('--debug', dest='debug', action='store_true', help='Enable the debug messages')
parser.add_argument('--no-warning', dest='nowarning', action='store_true', help='Disable the warning messages')
parser.add_argument('--no-ansi-codes', dest='noansicodes', action='store_true', help='Disable the warning messages')
return parser.parse_args(args=args)
def main():
arguments = argumentsParser(sys.argv[1:])
mw.setVerbose(arguments.verbose)
mw.setDebug(arguments.debug)
mw.setWarning(not arguments.nowarning)
mw.setANSICode(not arguments.noansicodes)
writeInformation("This is a information message")
writeVerbose("This is a verbose message")
writeDebug("This is a debug message")
writeWarning("This is a warning message")
if __name__ == '__main__':
main()
Required version
3.7
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 Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file shellu-0.0.1-py3-none-any.whl.
File metadata
- Download URL: shellu-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba69c2c390b172a9d40f76440ad7a8a4145ae0e6495526ce3fb123b09a11b3e8
|
|
| MD5 |
bf3de9b5ff84d3ce5aa3c698e8901dd9
|
|
| BLAKE2b-256 |
4d55587cc4712ed00995cdf499bc164e9320281e514d4c8473f570b7478ccb20
|