snuyanzin opened a new pull request, #17830:
URL: https://github.com/apache/flink/pull/17830

   ## What is the purpose of the change
   
   This PR is a part of FLIP-189 about prompt customization.
   
   There are left and right prompt which could be customized in the same way.
   Left prompt could be customized via `sql-client.display.prompt.pattern` 
property and right prompt via `sql-client.display.right-prompt.pattern`.
   There is a number of things which could be done: different datetime patterns 
(compatible with SimpleDateFormat), colors, styles, showing current database 
and catalog, showing specified current property's values.
   Examples:
   ```
   -- change left prompt to "my_prompt>"
   SET 'sql-client.display.prompt.pattern'='my_prompt>'; 
   
   
   -- show current database in prompt like "default_database prompt>"
   SET 'sql-client.display.prompt.pattern'='\d prompt>'; 
   
   
   -- show current catalog in prompt like "default_catalog prompt>"
   SET 'sql-client.display.prompt.pattern'='\c prompt>'; 
   
   
   -- show current timestamp in prompt like "2022-04-21 11:11:39.071 prompt>"
   SET 'sql-client.display.prompt.pattern'='\D prompt>'; 
   
   
   -- show property value like "localhost prompt>"
   SET 'sql-client.display.prompt.pattern'='\:taskmanager.host\: prompt>';
   
   
   -- apply style and colors
   SET 
'sql-client.display.prompt.pattern'='\[f-rgb:#aaaaaa,bold\]\:taskmanager.host\: 
\[f:g,underline\]prompt>';
   ```
   The same could be applied to right prompts.
   The whole range is covered in documentation with some examples at [1]
   Also there are some details at FLIP's page [2]
   
   [1]  
https://github.com/apache/flink/pull/17830/files#diff-c12a360080e42a64d69dd6c65fd8af77c0d6ef337fa7833c3a8b16b1759d1a11R237-R281
   [2] 
https://cwiki.apache.org/confluence/display/FLINK/FLIP-189%3A+SQL+Client+Usability+Improvements#FLIP189:SQLClientUsabilityImprovements-Supportedpromptoptions(bothforleftandrightprompts)
 
   
   ## Brief change log
   
   - Enable left and right prompt customization via properties
   - Enable styles, property values, datetime patterns compatible with 
SimpleDateFormat
   
   ## Verifying this change
   There is a class with tests
   `org.apache.flink.table.client.cli.PromptHandlerTest`
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (yes / **no**)
     - The public API, i.e., is any changed class annotated with 
`@Public(Evolving)`: (yes / **no**)
     - The serializers: (yes / **no** / don't know)
     - The runtime per-record code paths (performance sensitive): (yes / **no** 
/ don't know)
     - Anything that affects deployment or recovery: JobManager (and its 
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (yes / **no** / don't 
know)
     - The S3 file system connector: (yes / **no** / don't know)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (**yes** / no)
     - If yes, how is the feature documented? (not applicable / **docs** / 
JavaDocs / not documented)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to