caveats
- shellcheck:
- arguments are accessed via
args
, and in partial snippets shellcheck complains aboutused but not assigned
- solution: in
bashly-settings.yml
usevar_aliases.args: ARGS
- solution: in
- arguments are accessed via
- partial snippets in
src/
are going to be wrapped in a function:- creating functions results in a "function inside a function" situation in the final script
- if you use
local VARNAME
, shellcheck complains about'local' is only valid in functions
- solution: ALWAYS use the
src/*.sh
files to just call a function that is going to be coded in asrc/lib/*.sh
file.
- solution: ALWAYS use the
- validations are purely based on output (something in output means failure)
bashly tutorial
Planning a bashly tutorial with the topics to be addressed:
- very minimal
bashly.yml
neededrndm
doingecho "$RANDOM"
- highlight that the contents of
root_command.sh
are going to be wrapped in aroot_command()
function.
- passing long options
rndm --max NUM
prints a random number between 0 andNUM
- options are provided in the
$args
variable rndm --min NUM
prints a random number between NUM and 32767
- passing short options
--min
or-m
--max
or-M
- validate the argument:
- custom validations
- if the function prints a string to stdout, it's considered an error.
- bashly wants your code to be clean, with all inputs already validated
- numbers must be:
- integers
- between 0 and 32767
- min < max
- custom validations
- flags
rndm --web
get's the random number from https://random.org/-w
as a short option
- dependencies
rndm --web
depends oncurl
being available
- subcommands:
- convert
rndm
torndm number
- convert
- create
rndm password
- the default behavior is to use alphanumeric characters for the password
--size NUM
: tamanho da senha (default is 8)--alpha
: only alphabet chars--num
: only numbers- conflicts with
--alpha
- conflicts with
usage ideas
zxz
https://github.com/meleu/zxz - client for https://0x0.st/
cht
cheatsheet manager
features
- visualize with
bat
orglow
for syntax highlight? fzf
to search files- save in markdown files
- configfile to specify directories
- separate private vs. public cheatsheets
testing "formatter" setting
- no formatter specified