This is an automated email from the ASF dual-hosted git repository.
wenjin272 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/flink-agents.git
The following commit(s) were added to refs/heads/main by this push:
new 3070ee21 [hotfix] Add help handling to build script (#995)
3070ee21 is described below
commit 3070ee21d70d43d34bebd64944b232f1474bea4a
Author: kaiwangleo <[email protected]>
AuthorDate: Fri Aug 14 20:57:30 2026 +0800
[hotfix] Add help handling to build script (#995)
Generated-by: OpenAI Codex Desktop 26.803.41515 (GPT-5.6 Sol)
---------
Co-authored-by: Leo Wang <[email protected]>
---
tools/build.sh | 17 ++++++++++++
tools/test/integration/build_help.bats | 47 ++++++++++++++++++++++++++++++++++
2 files changed, 64 insertions(+)
diff --git a/tools/build.sh b/tools/build.sh
index a06ad01f..e0531bf0 100755
--- a/tools/build.sh
+++ b/tools/build.sh
@@ -17,6 +17,19 @@
set -e
+show_help() {
+ cat <<EOF
+Build Flink Agents Java and Python artifacts
+
+Usage: $0 [options]
+
+Options:
+ -j, --java Build only Java artifacts
+ -p, --python Build only Python artifacts
+ -h, --help Display this help message
+EOF
+}
+
# Parse command-line arguments
build_java=true
build_python=true
@@ -28,6 +41,10 @@ while [[ "$#" -gt 0 ]]; do
-j|--java)
build_python=false
;;
+ -h|--help)
+ show_help
+ exit 0
+ ;;
*)
echo "Error: Unknown option '$1'" >&2
show_help
diff --git a/tools/test/integration/build_help.bats
b/tools/test/integration/build_help.bats
new file mode 100644
index 00000000..d4a4abeb
--- /dev/null
+++ b/tools/test/integration/build_help.bats
@@ -0,0 +1,47 @@
+#!/usr/bin/env bats
+
+################################################################################
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################
+
+BUILD_SCRIPT="${BATS_TEST_DIRNAME}/../../build.sh"
+
+@test "build --help prints usage and exits 0" {
+ run bash "$BUILD_SCRIPT" --help
+
+ [ "$status" -eq 0 ]
+ [[ "$output" == *"Build Flink Agents Java and Python artifacts"* ]]
+ [[ "$output" == *"Usage:"* ]]
+ [[ "$output" == *"--java"* ]]
+ [[ "$output" == *"--python"* ]]
+}
+
+@test "build -h prints usage and exits 0" {
+ run bash "$BUILD_SCRIPT" -h
+
+ [ "$status" -eq 0 ]
+ [[ "$output" == *"Usage:"* ]]
+}
+
+@test "build rejects an unknown option with usage" {
+ run bash "$BUILD_SCRIPT" --no-such-option
+
+ [ "$status" -eq 1 ]
+ [[ "$output" == *"Error: Unknown option '--no-such-option'"* ]]
+ [[ "$output" == *"Usage:"* ]]
+ [[ "$output" != *"show_help: command not found"* ]]
+}