Skip to content

Commit

Permalink
doc: Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
juanibiapina committed May 23, 2024
1 parent 85e8bb6 commit 8c65ea9
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,24 @@ else
fi
```

`sub` looks for special comments in a comment block in the beginning of the
file. The special comments are:

- `Summary:` A short description of the script.
- `Usage:` A description of the arguments the script accepts. The `{cmd}` token
is required and will be replaced by the name of the script. Note that the
Usage comment syntax must be valid and is used to parse command line
arguments. See the [Usage syntax](#usage-syntax) section for more
information.
- Extended documentation: Any other comment lines in this initial block will be
considered part of the extended documentation.

## Sharing code between scripts

When invoking subcommands, `sub` sets an environment variable called
`_HAT_ROOT` (where `HAT` is the capitalized name of your CLI. This variable
holds the canonicalized path to the root of your CLI. It can be used for
instance for sourcing shared scripts from a `lib` directory next to `libexec`:
holds the path to the root of your CLI. It can be used, for instance, for
sourcing shared scripts from a `lib` directory next to `libexec`:

```sh
source "$_CLINAME_ROOT/lib/shared.sh"
Expand All @@ -190,11 +202,11 @@ source "$_CLINAME_ROOT/lib/shared.sh"
When invoking subcommands, `sub` sets an environment variable called
`_HAT_CACHE` (where `HAT` is the capitalized name of your CLI. This variable
points to an XDG compliant cache directory that can be used for storing
temporary files.
temporary files shared between subcommands.

## Migrating to Sub 2.x

### change --bin was to --executable
### change --bin to --executable

The `--bin` argument was renamed to `--executable` to better reflect its purpose.

Expand Down

0 comments on commit 8c65ea9

Please sign in to comment.