Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 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).
  • file: Pick a file from system.

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"

File

Prompt the user to select a file from the file tree.

image
./xylitol.sh file ~/.config

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

Contributing

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages