tomocafe / bash-boost Goto Github PK
View Code? Open in Web Editor NEWbash-boost is a set of library functions for bash, useful for both scripting and interactive use. It draws inspiration from the Boost C++ libraries.
License: MIT License
bash-boost is a set of library functions for bash, useful for both scripting and interactive use. It draws inspiration from the Boost C++ libraries.
License: MIT License
bb_expect "$(bb_relpath "/foo/bar/baz" "/foo/bar")" "baz"
fatal error: expected baz got /baz
Use printf
Use official bash Docker images to run make test
See:
Currently returns after left side if right under
What constitutes a patch, minor, or major release.
Breaking changes or deprecation can only occur in major releases. Add latest link for each major release.
Already done for global opts, replicate for cli/arg (program opts)
Push, pop, and swap file extensions
Style, philosophy, logistics...
Camel to snake, capitalize sentence, etc.
For example, if bb_getx()
prints the result to stdout, have bb_getx-v()
yield the same result in the variable $BB_RESULT
.
my_x="$(bb_getx)"
bb_getx-v
my_x2="$BB_RESULT"
bb_expect "$my_x" "$my_x2" # should be same
Supported in manual, Markdown and man page
For functions that do not add any functionality, but make using existing functionality more human-readable, less terse.
Example: bb_expressive_is_directory
instead of test -d
Create tarball for uploading
Replace symbolic link with deep copy
Cleanup is at end of function, but there are conditions where we return early.
Use ${!varname}
where varname=foo
to get $foo
.
Write window/tab title before returning if only left-hand prompt
Should handle the whole boilerplate:
bb_parseargs "$@"
set -- "${BB_POSARGS[@]}"
unset BB_POSARGS
Date and time utilities leveraging builtin printf
interface to strftime
.
Use _bb_result
to print result of function to stdout.
getinput
to poll for input, optional validation function
yn
to ask yes/no
bb_unpack LISTVAR var1 var2 ...
would set var1=${LISTVAR[0]}
, etc.
Stop assigning once the list is empty.
If called twice in a script, don't use previous map values, etc.
Spawn a new terminal instance inheriting the current shell's environment.
Now done on each check in as part of CI/CD 🎉
Use ^ to denote rounding up to the nearest, e.g. +0d^
means the upcoming 00:00, +1h^
at 06:30 means 08:00, -1h^
at 06:30 means 06:00, etc.
^d
, ^h
can be shorthand for +0d^
, +0h^
(etc.)
Line 11 in 16f3701
see dependency list
bb_
(e.g. bb_load
)BB_
(e.g. BB_ROOT
)_bb_
(e.g. _bb_on_first_load
)__bb_
(e.g. __bb_true
)If you type bb<TAB>
, we don't want it to show a bunch of internal functions that aren't useful to an end user. For example, bb_on_first_load
Allow customization of color, basic output format
# functionname REQARG ... [OPTARG ...]
# Brief description
# Arguments: (*required)
# * REQARG: description
# OPTARG: description
# Returns: description
# Consumes variables:
# - VAR1: description
# Emits variables:
# - VAR2: description
function bb_module_pkg_functionname () {
Make sure no collision with function names between modules, packages, etc.
sort [SORT_OPTS --] ITEMS ...
Uses GNU coreutils sort
with SORT_OPTS
passed directly to sort
.
If --
is omitted, sort
is invoked without options (default).
Where should the scripts live in a distribution. /etc
?
bb_requiredarg NAME DESCRIPTION
Retrieve with bb_getopt
by name.
Issue bb_errusage
during bb_parseargs
if required arguments are unset.
bash-boost/src/interactive/bookmark.sh
Line 132 in 16f3701
Also should clarify in docs what keys are supported
Remove all variables, functions, etc.
Similar to bb_processargs
All of the information in the function contract (can be auto-extracted) plus more detailed explanation, examples, notes.
Line 335 in fd03852
Display all terminal colors
Use alias for return, which returns in normal mode but does nothing in standalone mode.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.