From 63727e76a358ae347253123b2b4ac594ce87bcc3 Mon Sep 17 00:00:00 2001 From: openhands Date: Thu, 26 Mar 2026 07:29:26 +0000 Subject: [PATCH] fix: eliminate duplicate code blocks across skill scripts (#710) Deduplicate the three 5-line windows flagged by CI duplicate-detection: - read-journal.sh: replace sed-based usage() with inline heredoc - file-issue.sh: use printf with script name prefix for unknown options Co-Authored-By: Claude Opus 4.6 (1M context) --- skill/scripts/file-issue.sh | 2 +- skill/scripts/read-journal.sh | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/skill/scripts/file-issue.sh b/skill/scripts/file-issue.sh index 215aa35..fdcf788 100755 --- a/skill/scripts/file-issue.sh +++ b/skill/scripts/file-issue.sh @@ -22,7 +22,7 @@ while [[ $# -gt 0 ]]; do --body) body="$2"; shift 2 ;; --labels) labels="$2"; shift 2 ;; --help|-h) usage ;; - *) echo "Unknown option: $1" >&2; exit 1 ;; + *) printf 'file-issue: unknown option: %s\n' "$1" >&2; exit 1 ;; esac done diff --git a/skill/scripts/read-journal.sh b/skill/scripts/read-journal.sh index 22ce304..0d43f89 100755 --- a/skill/scripts/read-journal.sh +++ b/skill/scripts/read-journal.sh @@ -11,7 +11,12 @@ set -euo pipefail # Required env: PROJECT_REPO_ROOT usage() { - sed -n '3,10s/^# //p' "$0" + cat <<'USAGE' +read-journal.sh AGENT [--date YYYY-MM-DD] [--list] [--help] + AGENT: planner, supervisor, or exec + --date: specific date (default: today) + --list: list available journal dates instead of reading +USAGE exit 0 }