https://github.com/zlfn/xylitol
Add freshness to your shell scripts.
https://github.com/zlfn/xylitol
Last synced: 5 months ago
JSON representation
Add freshness to your shell scripts.
- Host: GitHub
- URL: https://github.com/zlfn/xylitol
- Owner: zlfn
- License: mpl-2.0
- Created: 2025-11-24T19:17:26.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-12-04T03:40:02.000Z (6 months ago)
- Last Synced: 2025-12-06T22:48:35.324Z (6 months ago)
- Language: Shell
- Size: 433 KB
- Stars: 3
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# XYLITOL
Add **cleanliness** and **freshness** to your shell scripts.
XYLITOL plays a role similar to [gum](https://github.com/charmbracelet/gum), but since it's written in [Amber](https://amber-lang.com/),
it doesn't depend on external binaries and remains fully portable.
## Execution
Just download and execute `xylitol.sh` script. (Bash 4.0+ is required.)
ANSI support is required for the terminal.
or use [Amber](https://amber-lang.com/) to compile Bash script from amber code.
```
bash <(curl -s "https://raw.githubusercontent.com/amber-lang/amber/master/setup/install.sh")
amber build src/main.ab xylitol.sh
```
## Commands
* [`choose`](#choose): Choose an option from a list of choices
* [`input`](#input): Prompt the user for input.
* [`confirm`](#confirm): Prompt the user for confirmation (yes/no).
## Choose
Choose an option from a list of choices

```bash
cat songs.txt | ./xylitol.sh choose
cat foods.txt | ./xylitol.sh choose --header "Grocery Shopping"
```
## Input
Prompt for input with a simple command.

```bash
./xylitol.sh input > answer.txt
./xylitol.sh input --prompt="Enter password: " --password > password.txt
```
## Confirm
Prompt the user for confirmation (yes/no).

```bash
./xylitol.sh confirm && rm file.txt || echo "File not removed"
```
### Tested on
```
- macOS 15+ / iTerm2 3.6.2+ / GNU bash 5.3.3+
- macOS 15+ / iTerm2 3.6.2+ / Bash subshell in nushell 0.101.0+
- Arch Linux ARM / Wezterm 20240203+ / GNU bash 5.3.3+
```