Skip to content

Commit e8b359a

Browse files
committed
Handle review comment and provide option to try colorize and autocomplete
1 parent 879fd86 commit e8b359a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

hbase-shell/src/main/ruby/jar-bootstrap.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@
6868
-h | --help This help.
6969
-n | --noninteractive Do not run within an IRB session and exit with non-zero
7070
status on first error.
71+
-c | --colorize Enable colorized output.
72+
-a | --autocomplete Enable auto-completion.
7173
--top-level-defs Compatibility flag to export HBase shell commands onto
7274
Ruby's main object
7375
-Dkey=value Pass hbase-*.xml Configuration overrides. For example, to
@@ -105,6 +107,8 @@ def add_to_configuration(c, arg)
105107
['--help', '-h', GetoptLong::NO_ARGUMENT],
106108
['--debug', '-d', GetoptLong::NO_ARGUMENT],
107109
['--noninteractive', '-n', GetoptLong::NO_ARGUMENT],
110+
['--colorize', '-c', GetoptLong::NO_ARGUMENT],
111+
['--autocomplete', '-a', GetoptLong::NO_ARGUMENT],
108112
['--top-level-defs', GetoptLong::NO_ARGUMENT],
109113
['-D', GetoptLong::REQUIRED_ARGUMENT],
110114
['--return-values', '-r', GetoptLong::NO_ARGUMENT]
@@ -115,6 +119,8 @@ def add_to_configuration(c, arg)
115119
log_level = 'ERROR'
116120
@shell_debug = false
117121
interactive = true
122+
colorize = false
123+
autocomplete = false
118124
full_backtrace = false
119125
top_level_definitions = false
120126

@@ -132,6 +138,10 @@ def add_to_configuration(c, arg)
132138
puts 'Setting DEBUG log level...'
133139
when '--noninteractive'
134140
interactive = false
141+
when '--colorize'
142+
colorize = true
143+
when '--autocomplete'
144+
autocomplete = true
135145
when '--return-values'
136146
warn '[INFO] the -r | --return-values option is ignored. we always behave '\
137147
'as though it was given.'
@@ -213,6 +223,8 @@ def debug?
213223
IRB.conf[:AP_NAME] = 'hbase'
214224
IRB.conf[:PROMPT_MODE] = :CUSTOM
215225
IRB.conf[:BACK_TRACE_LIMIT] = 0 unless full_backtrace
226+
IRB.conf[:USE_AUTOCOMPLETE] = autocomplete
227+
IRB.conf[:USE_COLORIZE] = colorize
216228

217229
# Create a workspace we'll use across sessions.
218230
workspace = @shell.get_workspace

0 commit comments

Comments
 (0)