Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Megaf/libsay
Browse files Browse the repository at this point in the history
  • Loading branch information
Megaf committed Sep 21, 2022
2 parents f129054 + d2bc247 commit 1426d3c
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 54 deletions.
52 changes: 52 additions & 0 deletions COMMANDS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
## libsay commands.
Commands provided by importing libsay to your shell or project.

This is a brief overview of the commands available in the `libsay` library.

|Command |Argument |Description |Example |
|---------------------|-------------------|------------------------------------------------------------------|-------------------------------------------|
|`say` |"string" |Draws lines around text and formats it. From string, pipe or var. |`say "Hi`,`echo "Hi" | say`,`say file.txt` |

### Setting Colours
|Command |Argument |Description |Example |
|---------------------|-------------------|------------------------------------------------------------------|-------------------------------------------|
|`set_colour` |"fg"/"bg" "colour" |Sets the foreground/background colour to the desired colour. |`set_colour "fg" "light_blue"; echo "Hi"` |
|`set_border_colour` |none |With `say`, colours the box borders from `$border_colour` var. |`border_colour=light_cyan say "Hello!"` |

### Manipulating Text
|Command |Argument |Description |Example |
|---------------------|-------------------|------------------------------------------------------------------|-------------------------------------------|
|`symbol_repeat` |"character" "count"|Repeats a character a certain amount of times. |`symbol_repeat "_" "4"` |
|`rst` |none |Resets terminal's text style, effects and colours to the default. |`rst` |

### Text Effects
|Command |Argument |Description |Example |
|---------------------|-------------------|------------------------------------------------------------------|-------------------------------------------|
|`underline_on` |none |Underlines text after the command. |`underline_on; echo "Hello There!"` |
|`double_underline_on`|none |Same as above, but with a double line instead. |`double_underline_on; echo "Greetings"` |
|`overline_on` |none |Adds a line above the text, underline but overline. |`overline_on; echo "I'm overlined."` |
|`overunder_on` |none |Adds an underline and a overline. |`overunder_on; echo "Above and below"` |
|`bold_on` |none |Prints the text in bold. |`bold_on; echo "hi"`/`weight=bold say "hi"`|
|`invert_on` |none |Makes the background color the foreground and vice versa. |`invert_on; echo "Hello Inverted There!"` |
|`blink_on` |none |Makes text blink. |`blink_on; echo "I'm a blinking text"` |
|`italics_on` |none |Writes the text in Italics. |`italics_on; echo "e l e g a n t t e x t"`|
|`crossout_on` |none |Strikes-through text. |`crossout_on; echo "A mistake perhaps."` |
|`fade_on` |none |Makes the text less intense. |`fade_on; echo "Not a very bright string."`|

### Default Styles
|Command |Argument |Description |Example |
|---------------------|-------------------|------------------------------------------------------------------|-------------------------------------------|
|`c_error` |none |Uses colour scheme and text effect for "Error" messages. |`c_error; echo "An Error occurted."; rst` |
|`c_info` |none |Uses colour scheme and text effect for "Info" messages. |`c_info; echo "Piece of Information"; rst` |
|`c_warning` |none |Uses colour scheme and text effect for "Warning" messages. |`c_warning; echo "Warning! You Sure?"; rst`|
|`c_debug` |none |Uses colour scheme and text effect for "Debug" messages. |`c_debug; echo "DEBUG: Lot's of Info"; rst`|
|`c_notice` |none |Uses colour scheme and text effect for "Notice" messages. |`c_notice; echo "Notice about this."; rst` |
|`c_title` |none |Uses colour scheme and text effect for "Title" messages. |`c_title; echo "This Is The Title"; rst` |
|`c_normal` |none |Uses colour scheme and text effect for "Normal" messages. |`c_normal; echo "Just a perfect day."; rst`|

### Drawing shapes
|Command |Argument |Description |Example |
|---------------------|-------------------|------------------------------------------------------------------|-------------------------------------------|
|`draw` |"part_name" |draws pre defined shapes. Used internally to make the box|`draw leftside_c line line rightside_c` |

For more information [check the Wiki!](https://github.com/Megaf/libsay/wiki)
55 changes: 1 addition & 54 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,57 +4,4 @@
easily imported to you console based project to provide some nice and colourfull
text output to the users of your projects. All without changing your code!

## Examples:
`say lines.txt`

![image](https://user-images.githubusercontent.com/6201512/190273332-364163d1-61b3-4c9f-bcab-3d8b05a69dc2.png)

`say "Hello there!`

![image](https://user-images.githubusercontent.com/6201512/190273389-6e548ac5-b99a-4054-b796-a0ecba5b228b.png)

`uname -s -r -o | say`

![image](https://user-images.githubusercontent.com/6201512/190273639-04667347-b2ae-4738-8aeb-ce2eef68e9cc.png)

Automagically parsing text:

![image](https://user-images.githubusercontent.com/6201512/190273818-5794f8c1-97f1-4a7a-b030-d7ffcd5baa6c.png)

### Adding to your shell
`libsay` will provide new commands to your shell.
For example, the command `say`. It prints text given to it.
You can do `say "Hello world!` and the output will be:

![image](https://user-images.githubusercontent.com/6201512/190270607-652233d7-dc67-40ba-845c-ead2208de2cc.png)

1. Simply download the `libsay` library and save it to somewhere safe in your system, for example, `~/.local/lib/`.
2. Load the lib at login by adding it to your `.bashrc`. Add at the end, for example, `source ~/.local/lib/libsay`.
3. Just load it to your current terminal without changing anything else. `source libsay`.

#### What it adds to your shell
`libsay` can do a lot more than `say`. It will add the following commands:
1. `say` -> Adds a nice border around the text.
2. `draw` -> Allows you to "draw" lines and corners.
- Available commands in `draw`:
- `topleftcorner`, `top`, `toprightcorner`, `rightside`, `leftside`, `bottomleftcorner`, `bottom`, `bottomrightcorner`
- Check the documentation for the full list.
3. `set_colour fg/bg` -> You can change the colour of your foreground and back ground.
- `set_colour fg "colour"` -> For example, `set_colour fg blue` to change text colour to blue.
- `set_colour bg "colour"` -> For example, `set_colour bg white` to change the text background to white.
- Example:
- `set_colour fg red; echo "This text will be in red."; rst`
- `set_colour bg blue; set_colour fg white; echo "This text will be in white with a blue background."; rst`
4. `rst` -> Resets the colours and style to your shells default.
5. Preformatted styles -> `libsay` comes with some pre selected colour schemes schemes for some types of messages.
- `c_debug`, `c_error`, `c_info`, `c_warning`. These are used by `say` as well when reading your input.
- Example: `c_error; echo "This text is using the error scheme. Text in red, underlined, with black background."; rst`

There's a lot more! Check the docs!

### Adding to your project
When you have libsay in your project, and you want highlight for error, warning, information, notices and debug messages, all you have to do is start the messages with either, `ERROR:`, `INFO:`, `WARN:/WARNING`, `DEBUG:`, or `NOTICE` and instead of using `echo` or `printf` you use `say`.
Just add to the top of your code, `source libsay` and you will be good to go.

# UNDER CONSTRUCTION.
## More to come.
Check [our Wiki](https://github.com/Megaf/libsay/wiki) for examples, usage and install instructions!

0 comments on commit 1426d3c

Please sign in to comment.