Closed stuft2 closed 6 years ago
I believe this is a problem throughout all the shell and not just after making a typo. For example: I've noticed that when I've made a SNS topic, the command shell displays the ARN for the topic but then doesn't revert back to the origial aws>
and instead I have to press return again (which displays and error telling me that I entered in something invalid) and then the aws>
is finally displayed so I can begin to do something outside of just sns. I know it's not something huge but I'd like to see it fixed in the next version of aws-shell.
Hi @stuft2, thanks for the report!
When I make a typo in the aws-shell, it stores the command history in the history file incorrectly.
Just to clarify, it sounds like you are suggesting that aws-shell should only log your history if you execute a proper command, ignoring invalid commands?
For example: I've noticed that when I've made a SNS topic, the command shell displays the ARN for the topic but then doesn't revert back to the origial aws> and instead I have to press return again
I think this might be a separate issue, please feel free to submit a bug report if you agree.
@donnemartin I feel like the aws-shell should log incorrect commands as well. That way you can go back and fix what you did wrong. However, the issue I'm seeing is that when I do make a typo, aws-shell logs the history incorrectly and so the following command (no matter what it is) is always wrong.
The aws-shell log file snippet that I posted above shows that when I made an incorrect command, it logged +aws
at the beginning of the command. The final command that was logged in the snippet (the one that worked) did not log +aws
and only longed from +lambda
on. Did that help make the issue clearer? Thanks.
To add further clarity to the log file I posted above, the first log didn't work because I made a typo in lambda and spelled it lamda instead of lambda (aws-shell also logged the command incorrectly. It added a +aws
to the front of the command); the second didn't work because I pressed my up arrow key, fixed the typo, and then the extra +aws
made the command invalid (I didn't enter aws
into the shell. That's the error that the log file made). The third log worked because I removed the extra aws
from the command.
I would consider this a bug but, at first glance, some may see it as a feature-request.
Thanks for clarifying!
Seems I'm seeing something different, there does seem to be a bug somewhere.
Commands executed:
aws> aws
aws> aws s3 ls
aws> s3 ls
aws> ss3 ls
Contents of ~/.aws/shell/history
# 2016-10-19 20:34:03.570867
+aws
# 2016-10-19 20:34:47.883330
+aws s3 ls
# 2016-10-19 20:34:54.580947
+s3 ls
# 2016-10-19 20:34:56.878143
+ss3 ls
# 2016-10-19 20:37:04.129488
+.edit
Results shown after running .edit
aws aws aws
aws aws aws s3 ls
aws aws s3 ls
aws aws ss3 ls
Yep, that looks like the same bug I'm finding too.
The file history (~/.aws/shell/history
) logs the commands exactly as they are typed at the prompt, as this is passed to the prompt as the history object. I cannot replicate commands being prepended with 'aws'
and then being stored into file history. This is the history that is used when you push the up arrow key.
In addition, there is an InMemoryHistory
object that is separate from the FileHistory
which is not attached to the prompt_toolkit
prompt. Entries in the memory history are manually pushed after the 'aws'
is prepended, so InMemoryHistory contains the full_cmd
. When the EditHandler
is executed it creates a temporary file based on the commands stored in the memory history and prepends 'aws'
a second time.
When I make a typo in the aws-shell, it stores the command history in the history file incorrectly. So when I press the up arrow and correct the typo, I also have to correct the error that was made when my history was logged in the .aws/shell/history file. My history file looks like this:
it's adding + aws on my command so when I rerun the command it says there was an error because aws is not a choice option. The error says:
aws: error: argument command: Invalid choice, valid choices are: ...
and then gives a list of the valid choices.The last command in the command history was the one that worked and the first two commands returned the error.