From 0068c92a7b3948e85599c86f66024b28af8eab7b Mon Sep 17 00:00:00 2001 From: Foil-hat-guy Date: Mon, 28 Apr 2025 23:15:37 +0300 Subject: [PATCH] README.md is updated. --- README.md | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 202e493..aa92b9f 100644 --- a/README.md +++ b/README.md @@ -1,31 +1,35 @@ -### The "UI" package +### The "STTY" package -This package provides --verbose and --quiet flag features to your cli. -It recognize both short and long flags. The package contains three functions: -- **PrintOut** to print regular messages unless --quiet flag is set. -- **PrintVerbose** to print messages only if --verbose flag is set, but --quiet -flag is not. -- **SetupOutputMode** to reconfigure output mode in the runtime. +This package provides simplified way to invoke **stty** utility to perform some +tasks by means of it. For now the only a few number of functions are implemented: +set tty baudrate, check tty baudrate and test if selected baudrate is available +for some tty. ------------- ### Usage 1. Download the package by **go get** command: ```shell -go get code.foilhatguy.casa/pub/ui +go get code.foilhatguy.casa/pub/stty ``` + 2. Import package to your golang code: ```go import ( - "code.foilhatguy.casa/pub/ui" + "code.foilhatguy.casa/pub/stty" ) ``` -There is no need for additional configuration. The package have its own **init** -function to detect --verbose and --quiet flags. -3. Use **PrintOut** and **PrintVerbose** functions to print -messages to the standard output: +3. Create new stty object by means of **Get()** function: ```go - ui.PrintOut("Some regular message.") - ui.PrintVerbose("Some message printed only if --verbose flag is set.") + sttyControl, err := stty.Get() +``` + +If **stty** is unavailable at the current system this function will +return an error. + +4. Use stty object to perform some tasks. For instance, test if baudrate of 9600 +is available at **/dev/ttyUSB0**: +```go + ok, err := sttyControl.TestBaudRate("/dev/ttyUSB0", 9600) ``` \ No newline at end of file