MarketSquare / MarketSquare/SSHLibrary

Add keywords ``Read Until Multiple`` and ``Read Until Multiple Regexp`` equivalent to ``Read Until`` and ``Read Until Regexp`` but accepting multiple expectations

Open
#476 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
167
Forks
145
PR merge metrics
No merged PRs in 30d

Description

Add keywords Read Until Multiple and Read Until Multiple Regexp equivalent to Read Until and Read Until Regexp but accepting multiple expectations
Those keywords would then return the index of the matched expectation and the output.
An argument could be used to add the prompt as an expectation with index `-1`.

The signatures would be:
```python
def read_until_multiple(*expected, loglevel=None, until_prompt=False, strip_prompt=False):
def read_until_multiple_regexp(*regexp, loglevel=None, until_prompt=False, strip_prompt=False):
```

This would help handling cases where there is multiple behaviors such as an error returning to the prompt while the normal behavior would request other actions from the user. For example requesting a manual entry on linux, if the entry is not found an error is returned while otherwise we are on the requested manual entry.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the existing Read Until and Read Until Regexp implementations and their tests, then compare how they handle expectations, prompts, logging, and stripping. Done means both new keywords accept multiple expectations or regexps, return the matched index and output, and support the proposed prompt options.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.