Git Product home page Git Product logo

inquirer.sh's People

Contributors

artbit avatar gcaufy avatar kahkhang avatar tennysontbardwell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

inquirer.sh's Issues

list_input fails when there is one option

OPTIONS=()
OPTIONS+=( "One" )
list_input "Which one?" OPTIONS CHOICE

When you use the above code, pressing up or down causes "One" to repeat on every line, vs forcing you to stay in place.

didn't clear the terminal

screen shot 2017-06-25 at 11 02 13 pm

source checkbox_input.sh

hawker_centres=( 'Old Airport Road Hawker Centre' 'Golden Mile Food Complex' 'Maxwell Food Centre' 'Newton Food Centre' )

checkbox_input selected_hawkers "Which hawker centres do you prefer?" hawker_centres
echo "Selected indices $(join "${selected_hawkers[@]}")"
echo "Selected Hawker Centers:"
for i in $(seq 1 ${#selected_hawkers[@]}); do
  echo "${hawker_centres[${selected_hawkers[$i]}]}"
done

Somehow there's this lex behind the Selected Hawker Centers:

Text Input: No blanks, validation fails, default not possible

Perhaps this is user error with the new version, but there is no example that demonstrates how to use anything but the default when default is set.

For instance, from https://github.com/kahkhang/Inquirer.sh/blob/master/examples/text_input_example.sh, there is:

text_input "Gender" gender "Male"

However, if you use this, it doesn't show a default, instead it fails validation unless your answer is the default. So basically, you MUST type "Male" to get out of the prompt.

I also don't see any details on how to use the validation. I'd like to do something like this:

text_input "What IP range should the server use?" IP_RANGE "192.168.99.1/24" "Invalid IP range format." ???????

But even if this was working, I'm not sure what to include here. The name of a previously defined function?

Thanks!

Line wraps

screenshot 2017-06-25 22 56 45
If there are any line wraps, lists will be rendered incorrectly

Stays in -echo mode

If you source dist/Inquirer.sh after running text_input, list_input, or checkbox_input, the shell stays in stty -echo mode.

It also uses the “exit on error” option (set -e) that will force the shell to exit on any command with a non-zero exit status, which in turn may break scripts that source the inquirer scripts.

I suggest optionally enabling the set -e option is the script is not sourced, or better yet, unset the e flag if it was not set prior to the inquirer scripts:

#!/usr/bin/env bash <- I also recommend this instead of #!/bin/bash
# save the set options
OLD_SET=$-
...
# in cleanup part
if [[ $OLD_SET =~ e ]]
then set -e
else set +e
fi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.