An open API service indexing awesome lists of open source software.

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.

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

image

```bash
cat songs.txt | ./xylitol.sh choose
cat foods.txt | ./xylitol.sh choose --header "Grocery Shopping"
```

## Input
Prompt for input with a simple command.

image

```bash
./xylitol.sh input > answer.txt
./xylitol.sh input --prompt="Enter password: " --password > password.txt
```

## Confirm
Prompt the user for confirmation (yes/no).

image

```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+
```