NihalJain commented on PR #6127:
URL: https://github.com/apache/hbase/pull/6127#issuecomment-2260461031

   Hi Nick thanks for taking time to review this PR.
   
   
   > Re: autocomplete and colors, can we disable them by default and document 
how to reenable them for the brave?
   
   I can think of two approaches to implement same:
   1. Expose flags in hbase shell to allow colorize and auto-complete. 
Something like below:
   ```
   cmdline_help = <<HERE # HERE document output as shell usage
   Usage: shell [OPTIONS] [SCRIPTFILE [ARGUMENTS]]
   
    -d | --debug            Set DEBUG log levels.
    -h | --help             This help.
    -n | --noninteractive   Do not run within an IRB session and exit with 
non-zero
                            status on first error.
    --top-level-defs        Compatibility flag to export HBase shell commands 
onto
                            Ruby's main object
    -Dkey=value             Pass hbase-*.xml Configuration overrides. For 
example, to
                            use an alternate zookeeper ensemble, pass:
                              -Dhbase.zookeeper.quorum=zookeeper.example.org
                            For faster fail, pass the below and vary the values:
                              -Dhbase.client.retries.number=7
                              -Dhbase.ipc.client.connect.max.retries=3
    -c | --colorize         Enable colorize
    -a | --autocomplete     Enable autocomplete
   HERE
   
   ```
   2. Or, let user set their preferences via .irbrc file and we respect that. 
For example, if user explicitly sets these features to be enabled, override and 
ignore our default setting in code
   ```
   # Load .irbrc
   require 'irb'
   irbrc = "#{ENV['HOME']}/.irbrc"
   if File.exist?(irbrc)
     load irbrc
   end
   
   # Check and set :USE_AUTOCOMPLETE
   unless IRB.conf.key?(:USE_AUTOCOMPLETE)
     IRB.conf[:USE_AUTOCOMPLETE] = false
   end
   
   # Check and set :USE_COLORIZE
   unless IRB.conf.key?(:USE_COLORIZE)
     IRB.conf[:USE_COLORIZE] = false
   end
   ```
   > Should this PR also update all the internal rb scripts to use java_import 
as appropriate?
   
   I have tried ruby scripts like `get-active-master.rb`, 
`replication/copy_tables_desc.rb`, `draining_servers.rb` to check they work 
even after this change. Also I had done a quick check with following command: 
`grep -rnw './' -e '^import' --include '*.rb'`. Thankfully we have no usage of 
import, and we use use java_import everywhere.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to