-
Notifications
You must be signed in to change notification settings - Fork 2.1k
pyterm: Disable repeating command on empty line #12096
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
pyterm: Disable repeating command on empty line #12096
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
@@ -791,6 +803,9 @@ if __name__ == "__main__": | |||
"of CR and LF. Examples: -nl=LF, -nl=CRLF. " | |||
"(Default is %s)" % defaultnewline, | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I learned something.
so did I :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -105,7 +105,8 @@ class SerCmd(cmd.Cmd): | |||
def __init__(self, port=None, baudrate=None, toggle=None, tcp_serial=None, | |||
confdir=None, conffile=None, host=None, run_name=None, | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 test
with different RIOT_TERMINAL, currently supported (not on all boards)pyterm
,socat
,picocom
. If possible one withterm_rtt
. But as it is internally usingpyterm
it will benefit from the changes automatically.RIOT_TERMINAL=pyterm samr21-xpro
RIOT_TERMINAL=picocom samr21-xpro
RIOT_TERMINAL=socat samr21-xpro
native
On IoT-LAB it works too
Issues/PRs references
Different behavior between testing locally and in
CI
.Also repeating the last command was always a pain when testing.