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

feat: add .select API #16

Open
tony-go opened this issue Apr 26, 2022 · 1 comment
Open

feat: add .select API #16

tony-go opened this issue Apr 26, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@tony-go
Copy link
Owner

tony-go commented Apr 26, 2022

Context

In some cases, CLI tools outputs list of choice:

How are you?
- bad
- so bad
- so so so bad

We'd like to have an API to simulate check list input:

const scenario_3 = clix('my command')
  .expect([ // Handle multiple lines with arrays
    'What is your choice?',
    /a/,
    /b/
  ])
  .select([1]) // using an array for multiple choices
  .expect('Ok, dude!');

const { ok } = await scenario_3.run();
assert.ok(ok);

Acceptance criteria

  • it should take a number or an array of numbers for multiple choices
  • it should return an instance of Scenario (this)
@tony-go tony-go added the enhancement New feature or request label Apr 26, 2022
@tony-go tony-go self-assigned this Apr 28, 2022
@tony-go
Copy link
Owner Author

tony-go commented May 23, 2022

We didn't benefit from a straightforward way to happen keystroke directly to the stdin... (look at nodejs/node#43137)

In my former investigation 👀 I've found a package called xdotool. I'll consider writing a POC with it, but maybe we'll have to revamp the whole project. 🙇‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant