Add initial scripts and project conventions
This commit is contained in:
1 parent
af9f32facc
commit
c777cf115b
14 files changed
+982
-9
No files matched your search
@@ -0,0 +1,45 @@
|
||||
# hello-world.sh
|
||||
|
||||
Reference example script — prints a greeting. Demonstrates the required
|
||||
structure every script in this repo must follow: `common.sh` sourcing,
|
||||
`SCRIPT_HELP` heredoc, `--help` handling, and argument parsing with
|
||||
`common::die` on invalid input.
|
||||
|
||||
**This is not a real utility.** Copy its structure when writing an actual
|
||||
script; don't invoke it from other scripts or automation.
|
||||
|
||||
## What it does
|
||||
|
||||
Prints `Hello, <name>!` to stdout, where `<name>` defaults to `world` or
|
||||
whatever is passed via `--name`.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Bash 4+ (uses `set -euo pipefail`, no external commands beyond common.sh)
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
./examples/hello-world.sh [OPTIONS]
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
| Option | Description |
|
||||
|--------|-------------|
|
||||
| `-h`, `--help` | Show help message and exit |
|
||||
| `-n`, `--name NAME` | Name to greet (default: `world`) |
|
||||
|
||||
## Examples
|
||||
|
||||
```bash
|
||||
# Default greeting
|
||||
./examples/hello-world.sh
|
||||
# → Hello, world!
|
||||
```
|
||||
|
||||
```bash
|
||||
# Custom name
|
||||
./examples/hello-world.sh --name Danail
|
||||
# → Hello, Danail!
|
||||
```
|
||||
Reference in new issue
Block a user