Look, you don't have to like it.
Run make to bundle the library into a single file
build/jdvlib.sh.
Copy that file to your project and source it in your scripts.
# shellcheck source=./jdvlib.sh
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/jdvlib.sh"These variables affect the behaviour:
JDVLIB_DEBUG: Set totrueto enable debug output. There is not a lot of this, though.- Deprecation messages will include file and line of the caller.
JDVLIB_LOG_DEPRECATIONS: Set to something to log deprecation messages to~/.jdvlib-deprecations.log.
Functions that support the library. This module is the basis for imports, so there should never be an import of this file.
meta::for_each_library_modulemeta::importmeta::is_compilingmeta::lib_is_compiledmeta::library_pathmeta::module_is_running
Functions related to ANSI escape codes. This code is vendored in from Tyler Akins' ansi project.
Click to expand (118 functions)
ansi::ansiansi::backwardansi::bellansi::bgBlackansi::bgBlackIntenseansi::bgBlueansi::bgBlueIntenseansi::bgColoransi::bgCyanansi::bgCyanIntenseansi::bgGreenansi::bgGreenIntenseansi::bgMagentaansi::bgMagentaIntenseansi::bgRedansi::bgRedIntenseansi::bgRgbansi::bgWhiteansi::bgWhiteIntenseansi::bgYellowansi::bgYellowIntenseansi::blackansi::blackIntenseansi::blinkansi::blueansi::blueIntenseansi::boldansi::coloransi::colorCodePatchansi::colorCodesansi::colorTableansi::colorTableLineansi::columnansi::columnRelativeansi::cyanansi::cyanIntenseansi::deleteCharsansi::deleteLinesansi::doubleUnderlineansi::downansi::encircleansi::eraseCharsansi::eraseDisplayansi::eraseLineansi::faintansi::fontansi::forwardansi::frakturansi::frameansi::greenansi::greenIntenseansi::hideCursoransi::iconansi::ideogramLeftansi::ideogramLeftDoubleansi::ideogramRightansi::ideogramRightDoubleansi::ideogramStressansi::insertCharsansi::insertLinesansi::inverseansi::invisibleansi::isAnsiSupportedansi::italicansi::lineansi::lineRelativeansi::magentaansi::magentaIntenseansi::nextLineansi::noBlinkansi::noBorderansi::noInverseansi::noOverlineansi::noStrikeansi::noUnderlineansi::normalansi::overlineansi::plainansi::positionansi::previousLineansi::rapidBlinkansi::redansi::redIntenseansi::repeatansi::reportansi::reportIconansi::reportPositionansi::reportScreenCharsansi::reportTitleansi::reportWindowCharsansi::reportWindowPixelsansi::reportWindowPositionansi::reportWindowStateansi::resetansi::resetAttributesansi::resetBackgroundansi::resetColoransi::resetFontansi::resetForegroundansi::resetIdeogramansi::restoreCursoransi::rgbansi::saveCursoransi::scrollDownansi::scrollUpansi::showCursoransi::showHelpansi::strikeansi::tabBackwardansi::tabForwardansi::titleansi::underlineansi::upansi::visibleansi::whiteansi::whiteIntenseansi::yellowansi::yellowIntense
Functions to help with parsing and validation of command line arguments.
args::check_help_argargs::ensure_num_argsargs::ensure_num_args_betweenargs::flag_valueargs::get_flag_value
Functions that relate to the code itself, where it is located, and how it is used.
code::is_sourcedcode::script_dir
This is a compatibility layer for deprecated functions. It is intended to be used when refactoring code to use the new functions. It will be removed in the future.
Click to expand (38 functions)
askcan_user_write_to_dircheck_help_argdeco_messagediedotenv_deletedotenv_loaddotenv_saveecho_stepensure_debianensure_dir_existsensure_docker_hostensure_file_existsensure_has_commandsensure_in_pathensure_in_remote_mountensure_num_argsensure_pveensure_rootensure_var_is_setfailflag_valueget_archget_oshas_commandinfois_in_remote_mountis_linuxis_lxcis_macosis_owned_by_userload_envnoopokprint_alignedreplace_between_markersrun_asscript_dir
Functions used to manage environment variables.
env::dotenv_deleteenv::dotenv_loadenv::dotenv_saveenv::ensure_is_set
Functions related to the filesystem. Existance, permissions, etc.
fs::can_user_write_to_dirfs::ensure_dir_existsfs::ensure_file_existsfs::ensure_in_remote_mountfs::is_in_remote_mountfs::is_owned_by_user
Functions related to functions and function management.
func::ensurefunc::list_functions_in_file
Functions related to Proxmox Virtual Environment (PVE).
pve::ensure_lxcpve::ensure_pvepve::is_lxcpve::is_pve
Functions related to the system, its attributes and capabilities.
sys::ensure_debiansys::ensure_docker_hostsys::ensure_has_commandssys::ensure_in_pathsys::ensure_linuxsys::ensure_macossys::get_archsys::get_ossys::has_commandsys::is_debiansys::is_docker_hostsys::is_in_pathsys::is_linuxsys::is_macossys::run_as
Functions that relate to text manipulation.
text::apply_in_placetext::comment_out_inside_markerstext::delete_around_markerstext::delete_inside_markerstext::filter_inside_markerstext::format_inside_markerstext::print_alignedtext::read_inside_markerstext::replace_between_markers_legacytext::replace_inside_markers
Functions to interact with the user.
ui::askui::deco_messageui::deprecateui::dieui::echo_stepui::failui::infoui::noopui::okui::reassurance_requiredui::reassure
Functions related to users and groups.
user::add_to_groupsuser::createuser::ensure_existsuser::ensure_group_existsuser::ensure_in_groupuser::ensure_rootuser::existsuser::group_existsuser::is_in_groupuser::is_root