A lightweight wrapper around Gum: A tool for glamorous shell scripts. See the Gum documentation for more documentation on the underlying features.
Install with composer:
composer install adamgaskins/gumwrapper
Usage:
$gum = new Gum();
$gum->choose([ 'apple', 'banana', 'pear' ])
The following platforms are currently supported. Please make a PR to BinManager.php
to add support for other platforms Gum supports!
- Apple M1
- Apple Intel
- Windows i386
- Windows x86_64
$result = $gum->choose([ 'apple', 'banana', 'pear', 'orange' ]);
// example: "apple"
$gum->choose(
$options = [ 'apple', 'banana', 'pear', 'orange' ],
$limit = 2, // enable multiselect
$height = 10 // scroll if more than 10 items
);
$result = $gum->confirm();
// example: true
$gum->confirm(
$prompt = 'Are you sure?',
$affirmativeText = 'Yeah!',
$negativeText = 'Actually, no',
$default = false // default to "no" option
);
$result = $gum->input('What is your name?');
// example: "Adam"
$gum->input(
$placeholder = 'Password',
$prompt = '> ',
$initialValue = null,
$charLimit = 400,
$width = 10,
$password = true
);
Note: Do not write any output or call any other Gum commands before ->terminate()
-ing the spinner, or errors may occur.
$spinner = $gum->spin();
sleep(10); // do some long task
$spinner->terminate();
$gum->spin(
$title = 'Downloading files...',
$spinner = 'pulse'
);
- Write
- Filter