Skip to content

Commit

Permalink
implements #3; #4; #5; #6
Browse files Browse the repository at this point in the history
  • Loading branch information
betafcc committed May 18, 2020
1 parent ccc210c commit c2ff64d
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 2 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,17 @@ clc '<red + bg blue + underline + bold:hello>'
### Available effects:
- normal
- bold
- dim
- strike
- italic
- underline
- reverse
- invisible
- blink

### Version:

```bash
clc -v
clc --version
```
25 changes: 25 additions & 0 deletions clc
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
#!/usr/bin/env bash
_system_arch=x86_64
_system_name=Mint
_system_type=Linux
_system_version=19.1
gvm_go_name=go1.12.5
gvm_pkgset_name=global
rvm_bin_path=/home/betafcc/.rvm/bin
rvm_path=/home/betafcc/.rvm
rvm_prefix=/home/betafcc
rvm_version='1.29.7 (latest)'
clc ()
{
if [ $# -eq 0 ]; then
clc_parse;
else
case "${1}" in
-v | --version)
echo 'v1.1.0'
;;
-e | --escape)
shift;
clc "$@" | sed -E 's,(\x1B\[[0-9;]*[a-zA-Z]),\\\[\1\\\],g'
Expand Down Expand Up @@ -40,6 +53,10 @@ clc_code_cyan ()
{
echo 36
}
clc_code_dim ()
{
echo 2
}
clc_code_green ()
{
echo 32
Expand All @@ -48,6 +65,10 @@ clc_code_invisible ()
{
echo 8
}
clc_code_italic ()
{
echo 3
}
clc_code_magenta ()
{
echo 35
Expand All @@ -68,6 +89,10 @@ clc_code_rgb ()
{
echo "38;2;${1};${2};${3}"
}
clc_code_strike ()
{
echo 9
}
clc_code_underline ()
{
echo 4
Expand Down
1 change: 1 addition & 0 deletions src/clc.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ clc() {
clc_parse
else
case "${1}" in
-v|--version) echo 'v1.1.0';;
-e|--escape) shift; clc "$@" | sed -E 's,(\x1B\[[0-9;]*[a-zA-Z]),\\\[\1\\\],g';;
*) printf '%s' "$@" | clc
esac
Expand Down
4 changes: 2 additions & 2 deletions src/clc_code.bash
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ clc_code_bg() {
__clc_short_hands() {
local key
local -A lookup_attr=(
[normal]='0' [bold]='1' [underline]='4'
[reverse]='7' [invisible]='8' [blink]='5'
[normal]='0' [bold]='1' [dim]='2' [italic]='3' [underline]='4'
[blink]='5' [reverse]='7' [invisible]='8' [strike]='9'
)
local -A lookup_color=(
[black]='0' [red]='1' [green]='2' [yellow]='3'
Expand Down

0 comments on commit c2ff64d

Please sign in to comment.