bash-compiler command
1. Usage
The framework works with bash-compiler, a GoLang implementation that generates standalone executables from YAML definitions.
Using bash-compiler binary:
export PATH=$PATH:/home/wsl/fchastanet/bash-compiler/bin
FRAMEWORK_ROOT_DIR=$(pwd) bash-compiler \
src/_binaries/shellcheckLint/shellcheckLint-binary.yaml
Using Go interpreter (must be executed from bash-compiler folder):
export FRAMEWORK_ROOT_DIR=/home/wsl/fchastanet/bash-dev-env/vendor/bash-tools-framework
go run ./cmd/bash-compiler "${FRAMEWORK_ROOT_DIR}/src/_binaries/shellcheckLint/shellcheckLint-binary.yaml"
Compile all *-binary.yaml files at once:
export FRAMEWORK_ROOT_DIR=/home/wsl/fchastanet/bash-dev-env/vendor/bash-tools-framework
go run ./cmd/bash-compiler $(find "${FRAMEWORK_ROOT_DIR}/src/_binaries" -name '*-binary.yaml' -print)
See Bash Compiler documentation for more information.
2. Example: Creating a Command
To create a new command using the framework:
- Create a YAML definition in
src/_binaries/myCommand/myCommand-binary.yaml - Define the command’s options and main script
- Compile using bash-compiler
- The generated binary will be placed in
bin/myCommand
See the framework command template for a starting point.