bash_bundler

Crates.iobash_bundler
lib.rsbash_bundler
version0.1.1
sourcesrc
created_at2021-05-24 11:59:15.499197
updated_at2021-05-24 12:30:04.863303
descriptionCollects/bundles bash files into one file.
homepage
repositoryhttps://github.com/thomas9911/bash_bundler
max_upload_size
id401394
size23,853
Thomas Timmer (thomas9911)

documentation

README

bash_bundler

Crates.io Documentation Crates.io

Collects/bundles bash files into one file.

By default uses the saver # import ./filename.sh syntax to include other bash files. But can be set to use the already existing source ./filename.sh syntax.

Getting started

cargo install bash_bundler

Once installed:

bash_bundler your-main-file.sh > bundled.sh

Or with a config file:

bash_bundler --config your-config.toml > bundled.sh

examples and style differences

There is a difference between the import and source import statements. The import is relative to the current file, but the source is relative from the base/root file.

for instance: your root file is in src/my_project.sh that looks like:

# import ./utils/utils.sh

my_func "hallo"

and utils.sh looks like:

# import ./other.sh # other contains the my_func

this will import from file ./src/utils/other.sh

With the source it is relative from the root file so like:

source ./utils/utils.sh

my_func "hallo"

and utils.sh looks like:

source ./utils/other.sh # other contains the my_func

This is done so that files containing the source can just be used in normal bash.

cd src
./my_project.sh

Check the tests folder for more direct examples.

Config

Configs can be used to override/save arguments. Config should look like:


[bundler]
replace_source = true
replace_comment = false
root_path = "./tests/source.sh"

CLI helptext

USAGE:
    bash_bundler [FLAGS] [OPTIONS] <root-path>

FLAGS:
    -h, --help
            Prints help information

        --disable-comment
            disable the '# import ./file.sh` syntax

        --enable-source
            enable the 'source ./file.sh` syntax

    -V, --version
            Prints version information


OPTIONS:
    -c, --config <config>
            path to your toml config


ARGS:
    <root-path>
            starting or `main` bash file
Commit count: 10

cargo fmt