Compare commits

...

2 Commits

Author SHA1 Message Date
920faf284d
bash: check command exists 2022-08-13 11:50:44 +03:00
c01cbe5914
add Colorize 2022-08-13 11:41:05 +03:00
3 changed files with 37 additions and 0 deletions

12
~/Bash/command_exists.sh Normal file
View File

@ -0,0 +1,12 @@
#!/bin/bash
if ! [ -x "$(command -v git)" ]; then
echo 'Error: git is not installed.' >&2
exit 1
fi
if ! command -v crystal &> /dev/null
then
echo "<the_command> could not be found"
exit
fi

24
~/Crystal/Colorize.cr Normal file
View File

@ -0,0 +1,24 @@
require "colorize"
"foo".colorize(:green)
100.colorize(:red)
[1, 2, 3].colorize(:blue)
# Available colors are:
# :default
# :black
# :red
# :green
# :yellow
# :blue
# :magenta
# :cyan
# :light_gray
# :dark_gray
# :light_red
# :light_green
# :light_yellow
# :light_blue
# :light_magenta
# :light_cyan
# :white

View File

@ -4,3 +4,4 @@
- [Значение из Regex::MatchData](value_from_match.cr) - Получить значение из `Regex::MatchData("Happy")`
- [IO::TimeoutError](prompt_timeout.cr) - Установка тайм-аута на пользовательский ввод
- [ENV["..."]](env_variable.cr) - Переменные среды
- [Colorize](Colorize.cr) - Цветной вывод в консоль