Cargo-like workflow

From Crate to BashBox

If you know Cargo, Sh:erpa is mimicking things like Cargo new, build, doc, test...

Creating a BashBox

# Create a new BashBox
sherpa new myScript

Running sherpa new myScript will create a new BashBox (think Crate) myScript in ${SCD}, initialize a git repo inside and copy over the starter template.

# /home/user/sherpa/boxes/myScript

.
├── data
│   └── example.yaml
├── docs
│   └── myScript.md
├── README.md
├── Sherpa.yaml
├── src
│   ├── bin.sh
│   ├── _globals.sh
│   ├── _header.sh
│   ├── _lib.sh
│   ├── _options.sh
│   └── __paths.txt
├── target
│   └── local
│       └── myScript
└── tests
    └── example_test.sh

Both run and build commands are creating a symlink between the builtScript stored in target/local/myScript and a virtual file in .sherpa/bin, so for all the tests involving arguments you can use myScript arg1 arg2. The compile command can transform the executable into a binary.

/home/user/sherpa/boxes/myScript
# Upon BashBox creation it will:
sherpa build

# so you can already go:
myScript arg1 arg2

Sherpa.yaml Manifest

As expected, that file contains the metadata for the package.

package:
  title: myScript
  description: A short description of the package
  version: 0.1.0
  author: AndiKod
  license: MIT

Eventually, at some point a second section could be added, once I'll figure out a way to integrate per-project dependencies and a sort of lock file.

Sourcing libraries

For the pleasure of it, additional libraries are sourced with:

# /home/user/sherpa/boxes/myScript/src/bin.sh

use "std/fmt"

This would first look for a lib/std/fmt.sh file in the SherpaCustomDir, the user customised libraries, and if not there default to the version in the main SherpaDotDir.

The rest of the commands

So far, the Cargo commands ported to Sh:erpa are: new, init, build, run, doc, test, install, uninstall and looking for ways to bring in the rest.

Some complementary commands, Sh:erpa specific alre completing the toolbox.