IBM / clai

Command Line Artificial Intelligence or CLAI is an open-sourced project from IBM Research aimed to bring the power of AI to the command line interface.
https://clai-home.mybluemix.net/
MIT License
475 stars 73 forks source link

CLAI removes single quotes from command #66

Open djfitzgerald opened 4 years ago

djfitzgerald commented 4 years ago

Describe the bug When calling a command with single quotes, those single quotes are removed when inserted back into the history. For example:

echo 'hello world'

enters the history as:

echo hello world

I strongly suspect this is linked to Issue #60.

To Reproduce Steps to reproduce the behavior:

  1. Execute the command echo 'hello world'
  2. Use your up arrow to see the last command entered
  3. That command will be echo hello world

Expected behavior Instead, the last command executed should be echo 'hello world'

Screenshots If applicable, add screenshots to help explain your problem.

Log file If you found an error or an unexpected behaviour. It's useful for us the server log. You can find it in /var/tmp/app.log please attach it to the issue or copy and paste last lines.

shell and OS (please complete the following information):

Additional context I've done some debugging on the problem, and it looks like bash-preexec.sh is getting this line as:

__bp_in_prompt_command 'echo '\''hello world'\'''

when it really should be:

__bp_in_prompt_command 'echo \'hello world\''

bash-preexec.sh is getting this from the shell variable $BASH_COMMAND, so maybe bash itself is causing the problem.