Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select option widget #605

Closed
blaggacao opened this issue Sep 21, 2021 · 7 comments
Closed

Select option widget #605

blaggacao opened this issue Sep 21, 2021 · 7 comments
Labels
help wanted Will be solved only if someone contributes it

Comments

@blaggacao
Copy link
Contributor

blaggacao commented Sep 21, 2021

since the following was a bit contrived to find, maybe we can add a simple select option widget for semi-interactive runbooks...


function select_iogo_job {
  local string=""
  info "Please select the nomad job(s) that you deployed with iogo"
  PS3="Please enter: "
  select opt in routing front back signer rabbit patroni Ok Abort; do
      case $REPLY in
          1 | 2 | 3 | 4 | 5 | 6)
              string="${string}-$opt"
              ;;
          7)
              break
              ;;
          8)
              info Aborting
              exit
              ;;
          *) echo "invalid node $REPLY";;
      esac
  done
  echo "$string"
}

Any ideas?

@kamadorueda
Copy link
Contributor

We currently have these two

let
   mySelect = toBashSelect {
    prompt = "pick whatever you want";
    options = [ "routing" "front" ... ];
   };
in
{ ... }
source "${envMySelect}/template" local selected_options  # derivations
source __argMySelect__/template local selected_options  # templates

echo "${selected_options[@]}"  # routing front .., whatever the user selected during the prompt

break and abort are automatically injected

@kamadorueda
Copy link
Contributor

also maybe toBashSelectMany, toBashSelectOne

@kamadorueda
Copy link
Contributor

or toBashSelect and a few options like:

  • allowMultipleAnswers ? bool
  • allowRepeatedAnswers ? bool
  • minimumSelections ? int

@blaggacao
Copy link
Contributor Author

The last suggestion seems best! Great conceptualization, thanks! I was a bit struggling on this one and I figured this might be the point where users start asking for a proper scripting language. My hope is we can extend bash's reach just another bit for most devops use cases...

@kamadorueda
Copy link
Contributor

is there a language you have in mind that covers all the use cases we have now + being a "proper" scripting language?

@blaggacao
Copy link
Contributor Author

Actually any language has the same problem: you can't paste them 1-by-1 on any dev's cli.

That's probably the single biggest advantage with bash in this devops case...

@kamadorueda kamadorueda added enhancement help wanted Will be solved only if someone contributes it and removed enhancement labels Sep 28, 2021
@kamadorueda kamadorueda moved this to 🆕 New in Makes Roadmap Sep 24, 2022
@kamadorueda kamadorueda moved this from 🆕 New to 📋 To do in Makes Roadmap Sep 24, 2022
@dsalaza4
Copy link
Contributor

We want makes to become a CLI that autocompletes existing jobs within a repository (#989) for maximum dev experience. We're not planning to support interactive shells.

@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Makes Roadmap Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Will be solved only if someone contributes it
Projects
Status: Done
Development

No branches or pull requests

3 participants