pyterm: Disable repeating command on empty line#12096
pyterm: Disable repeating command on empty line#12096cladmi wants to merge 7 commits intoRIOT-OS:masterfrom
Conversation
Just send a empty newline when it receives a newline. This is the behavior of all the other terminals.
Test receiving an empty line. It was before not possible with `pyterm` but is fixed by previous commit.
|
I think this was intentionally implemented this way, right @OlegHahm? What is the motivation in removing this quite nice feature that allows to rapidly re-execute commands? |
The reasoning "because other terminals do so as well" seems quite a weak argument to remove a feature. |
|
It is the default |
|
Being able to send an empty line is something I would need instead of relying on sending a useless character to workaround Also, when typing |
|
|
I know, it's quite annoying ;-P |
|
How about making it configurable then? |
|
Having worked with For me it was just a side-effect of the default behavior of |
Hitting two keys quickly in an alternating fashion is far more far more error prone and exhausting than just hitting or even just holding one button (enter) |
|
To precise what happens here:
Guess who has a standard behavior ? |
I am not aware that there is a standard on how a terminal should behave...
This is why I suggested that, instead of killing this feature (at least I consider it as such), we make it configurable... |
Add a variable for `pyterm` specific flags that are not handled by other terminals. This will prevent issues with boards that have options only supported by `pyterm` and setting `pyterm` options from the environment.
pyterm: Disable repeating command on empty line by default
This can be enabled again by giving '--repeat-command-on-empty-line' and
with 'PYTERMFLAGS' in the environment.
PYTERMFLAGS='--repeat-command-on-empty-line' BOARD=samr21-xpro make -C
examples/default/ term
dist/tools/pyterm/pyterm
Outdated
| default=defaultnewline) | ||
| parser.add_argument("--repeat-command-on-empty-line", | ||
| help="Enable repeating command on empty line", | ||
| action="store_true", default=False) |
There was a problem hiding this comment.
To keep the existing behaviour, the default should be True. IIUC, you can change this via PYTERMFLAGS in your test if you want.
There was a problem hiding this comment.
It is done on purpose, as I want the behavior to be the same when you do make test, make term, and use any other RIOT_TERMINAL.
And to do the opposite, it cannot just be flipped, but the option would need to be renamed to a "do not repeat command on empty line" as it is an option without argument.
There was a problem hiding this comment.
Indeed, but in this case, there's no need for default=False since it's set automatically when using action="store_true".
Anyway, as some others, I wouldn't invert this behaviour in this PR just because it's more convenient for tests. The goal of the tool is to be convenient for users and if users tend to prefer the "repeat command" on empty line, this should be the default. The test can be adapted.
There was a problem hiding this comment.
It is done on purpose, as I want the behavior to be the same when you do
make test,make term, and use any otherRIOT_TERMINAL.And to do the opposite, it cannot just be flipped, but the option would need to be renamed to a "do not repeat command on empty line" as it is an option without argument.
Please remember, that the testing experience is not the primary user experience, but the normal terminal is.
There was a problem hiding this comment.
Yes, then having different behavior depending on the board, example (ethos), or RIOT_TERMINAL is for me bad as user experience.
There was a problem hiding this comment.
Yes, then having different behavior depending on the board, example (ethos), or RIOT_TERMINAL is for me bad as user experience.
So does just silently deactivating a feature many people rely on for their local testing.
There was a problem hiding this comment.
I learned something.
so did I :)
There was a problem hiding this comment.
Yes, then having different behavior depending on the board, example (ethos), or RIOT_TERMINAL is for me bad as user experience.
So does just silently deactivating a feature many people rely on for their local testing.
Those are different tools BTW. Especially ethos and native could also use pyterm by wrapping around with TCP, however this would just add unnecessary overhead when doing this in the default case.
There was a problem hiding this comment.
"unnecessary" agreed.
What happened to me, was more when typing a "ping" command, I would type "enter" to add some spacing, and oh, it would be repeated many times.
And it cannot be interrupted with ctrl+c.
I usually do not call it a feature when it can be done explicitly with just "up + enter".
There was a problem hiding this comment.
I usually do not call it a feature when it can be done explicitly with just "up + enter".
Again, "up + enter" is very unreliable if you are doing flood testing with commands that are only doing one thing at a time...
|
I will re-open on top of #12107 and put the inconsistency with other platforms in an issue. |
miri64
left a comment
There was a problem hiding this comment.
Alternatively, we could slowly phase over to False being the default, but not in one PR and not if --repeat-command-on-empty-line remains the only option to set the flag (too long to use it on a regular basis with TERMFLAGS)
dist/tools/pyterm/pyterm
Outdated
| log_dir_name=None, newline=None, formatter=None, | ||
| set_rts=None, set_dtr=None, serprompt=None): | ||
| set_rts=None, set_dtr=None, serprompt=None, | ||
| repeat_command_on_empty_line=False): |
There was a problem hiding this comment.
Just a reminder, that True should be the default ;-).
|
I added the configuration alone in #12120 |
|
Closed in favor of
|
|
Thank you! |
Contribution description
Just send a empty newline when it receives a newline.
This is the behavior of all the other terminals.
This also works when applied in conjunction with #12094
Testing procedure
Run
BOARD=your_board make -C tests/test_tools/ flash testwith different RIOT_TERMINAL, currently supported (not on all boards)pyterm,socat,picocom. If possible one withterm_rtt. But as it is internally usingpytermit will benefit from the changes automatically.RIOT_TERMINAL=pyterm samr21-xproRIOT_TERMINAL=picocom samr21-xproRIOT_TERMINAL=socat samr21-xpronativeOn IoT-LAB it works tooIssues/PRs references
Different behavior between testing locally and in
CI.Also repeating the last command was always a pain when testing.