cloudspannerecosystem / spanner-cli

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

Add --prompt2 and --no-prompt2 #184

Closed apstndb closed 1 month ago

apstndb commented 3 months ago

The default behavior is unchanged.

$ ./spanner-cli --project ${SPANNER_PROJECT} --instance ${SPANNER_INSTANCE} --database ${SPANNER_DATABASE}             
Connected.
spanner> SELECT 1 +
      -> 2;

--prompt2 modifies multi-line prompt.

$ ./spanner-cli --project ${SPANNER_PROJECT} --instance ${SPANNER_INSTANCE} --database ${SPANNER_DATABASE} --prompt2='$ '
Connected.
spanner> SELECT 1 +
       $ 2;

--no-promp2 sets prompt2 to empty.

$ ./spanner-cli --project ${SPANNER_PROJECT} --instance ${SPANNER_INSTANCE} --database ${SPANNER_DATABASE} --no-prompt2     
Connected.
spanner> SELECT 1 +
         2;

fixes #183

apstndb commented 3 months ago

My latest thought is

It seems to be better to unify to single option --prompt2.

apstndb commented 3 months ago

I have prototyped another implementation with parser status https://github.com/cloudspannerecosystem/spanner-cli/pull/185