feat: add api test

Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>
This commit is contained in:
Xinwei Xiong(cubxxw)
2023-11-07 03:31:16 +08:00
parent 762ff65225
commit 4d2332f1e3
19 changed files with 1254 additions and 326 deletions
+1 -2
View File
@@ -70,8 +70,7 @@ ITALIC_PREFIX="\033[3m" # Italic prefix
CYAN_PREFIX="\033[0;36m" # Cyan prefix
# Print colors you can use
openim::color::print_color()
{
openim::color::print_color() {
echo
echo -e ${bmagenta}--back-color:${normal}
echo "bblack; bgreen; bblue; bcyan; bred; byellow; bmagenta; bwhite"
+1 -2
View File
@@ -200,8 +200,7 @@ openim::log::status() {
done
}
openim::log::success()
{
openim::log::success() {
local V="${V:-0}"
if [[ ${OPENIM_VERBOSE} < ${V} ]]; then
return
+15
View File
@@ -1126,6 +1126,21 @@ function openim::util::require-jq {
fi
}
# openim::util::require-dig
# Checks whether dig is installed and provides installation instructions if it is not.
function openim::util::require-dig {
if ! command -v dig &>/dev/null; then
echo "dig command not found."
echo "Please install 'dig' to use this feature."
echo "Installation instructions:"
echo " For Ubuntu/Debian: sudo apt-get install dnsutils"
echo " For CentOS/RedHat: sudo yum install bind-utils"
echo " For macOS: 'dig' should be preinstalled. If missing, try: brew install bind"
echo " For Windows: Install BIND9 tools from https://www.isc.org/download/"
return 1
fi
}
# outputs md5 hash of $1, works on macOS and Linux
function openim::util::md5() {
if which md5 >/dev/null 2>&1; then