cloudspannerecosystem / spanner-cli

Interactive command line tool for Cloud Spanner
Apache License 2.0
230 stars 28 forks source link

Allow newline in prompt #186

Open apstndb opened 2 months ago

apstndb commented 2 months ago

Other interactive SQL tools (and interactive shells) allow to contain newlines in prompt, and it is used by some users.

Examples

I believe that allowing newlines helps both showing detail informations in prompt and short indentation in spanner-cli.

Expected behavior

prompt = "[\\p:\\i:\\d]\\n   > "

shows

[very-long-project-id:very-long-instance-id:very-long-database-id]
   >

and continuation prompt is aligned to the last line of the prompt

[very-long-project-id:very-long-instance-id:very-long-database-id]
   > SELECT *
  -> FROM Singers;

Related discussion https://github.com/cloudspannerecosystem/spanner-cli/issues/183#issuecomment-2333003880