Skip to content

zlfn/xylitol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XYLITOL

Add cleanliness and freshness to your shell scripts.

XYLITOL plays a role similar to gum, but since it's written in Amber,
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 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 an option from a list of choices
  • input: Prompt the user for input.
  • confirm: Prompt the user for confirmation (yes/no).

Choose

Choose an option from a list of choices

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

Input

Prompt for input with a simple command.

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

Confirm

Prompt the user for confirmation (yes/no).

image
./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+

About

Add freshness to your shell scripts.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages