Skip to content
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

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

apstndb
Copy link
Collaborator

@apstndb apstndb commented Aug 21, 2024

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
Copy link
Collaborator Author

apstndb commented Aug 23, 2024

My latest thought is

  • In the future, PostgreSQL style prompt variables such as %R may be supported, in which case --prompt2 will be required.
  • --no-prompt2 is not needed if --prompt2 can differentiate between unset and empty
    • It seems that jessevdk/go-flags can do it using *string.

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

@apstndb
Copy link
Collaborator Author

apstndb commented Aug 24, 2024

I have prototyped another implementation with parser status
#185

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configuration for continuation prompt (like PS2 or PROMPT2 in some shells)
1 participant