mnpoonia commented on code in PR #8703:
URL: https://github.com/apache/hbase/pull/8703#discussion_r4121895902
##########
bin/hbase:
##########
@@ -174,6 +187,50 @@ add_size_suffix() {
fi
}
+# Resolve a script under bin/: keep paths that already contain a slash,
otherwise
+# look in HBASE_HOME/bin. Sets RESOLVED_BIN_SCRIPT or exits.
+resolve_bin_script() {
+ local name="$1"
+ local kind="$2"
+ if [[ "$name" == */* ]]; then
+ RESOLVED_BIN_SCRIPT="$name"
+ else
+ RESOLVED_BIN_SCRIPT="${HBASE_HOME}/bin/${name}"
+ fi
+ if [ ! -f "$RESOLVED_BIN_SCRIPT" ]; then
+ echo "${kind} not found: $RESOLVED_BIN_SCRIPT"
+ exit 1
+ fi
+}
+
+# Populate JSHELL_ARGS for both interactive `jshell` and `*.jsh` script
dispatch.
+# Shared so the two paths cannot drift. Honors HBASE_JSHELL_ARGS when set;
otherwise
+# DEFAULT + PRINTING + optional hbase_startup.jsh. Defaults to --execution
local
+# unless the user already passed --execution / --execution=<spec>.
+init_jshell_args() {
+ if [ -n "${HBASE_JSHELL_ARGS}" ]; then
+ read -r -a JSHELL_ARGS <<< "${HBASE_JSHELL_ARGS}"
Review Comment:
Documented in 6cd8aa3e68: `HBASE_JSHELL_ARGS` is split on whitespace the
same way `HBASE_OPTS` is, so an argument value (e.g. a `--startup` file path)
cannot contain spaces. Considered supporting quoted values via `eval`-based
array parsing, but decided to defer that behavior change to a follow-up rather
than introduce `eval` on an env var into `bin/hbase` — happy to revisit if you
feel the quoting support is worth it here.
##########
bin/hbase:
##########
@@ -94,6 +105,8 @@ show_usage() {
echo " clean Run the HBase clean up script"
fi
echo " jshell Run a jshell with HBase on the classpath"
+ echo " script.jsh Run a JShell script non-interactively (args via
HBASE_JSH_ARG_N)"
Review Comment:
Moved these in 6cd8aa3e68 — now sit right next to `CLASSNAME` at the end of
the command list, and reworded to `<path>.jsh` / `<path>.java`
(bracket-placeholder form matching `CLASSNAME`/`<options>`/`<command>`
elsewhere in the usage text) instead of the literal-looking `script.jsh` /
`Script.java`.
--
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]