Skip to content

Version 1.0.0#59

Merged
toniecrumley merged 111 commits intomainfrom
version-1-0
Jan 20, 2026
Merged

Version 1.0.0#59
toniecrumley merged 111 commits intomainfrom
version-1-0

Conversation

@toniecrumley
Copy link
Contributor

@toniecrumley toniecrumley commented Jan 13, 2026

Summary

This is the combined pull request for CAPTURE 1.0.0. Please refer to the CHANGELOG for a list of all changes. There is a corresponding branch for lasseignelab/project-template#14 that should be code reviewed as well.

Author Checklist

  • This repository has a Lasseigne Lab ruleset configured.
    See instructions here.
  • Only files relevant to this change are included; no temporary, generated,
    or unrelated files are part of this pull request. Use .gitignore to prevent
    irrelevant files from accidentally being included.
  • All automated tests have passed.
  • All automated code checks have passed. The "All checks have passed"
    message should show in the GitHub pull request status box above the
    "Merge pull request" button.
  • No merge conflicts exist. Merge conflicts are indicated by the "This
    branch has conflicts that must be resolved" message in the GitHub pull
    request status box above the "Merge pull request" button.
  • The README has been updated with documentation changes.
  • The command script help documentation in the commands directory
    has been updated if necessary.
  • The CHANGELOG has been updated with the planned version number.
  • The tab completion is up to date for all commands.
  • The project-template submodule reference is up to date.
  • Setup instructions have been provided.
  • Test instructions have been provided.
  • Cleanup instructions have been provided.
  • At least two reviewers have been requested to review this pull request.

Self/Peer Review Checklist (Coding Guidelines)

  • Meaningful variable and function names
  • File header comments
  • Function comments
  • In-line comments summarize logical sections of code by concisely explaining
    why, not what the code is doing. Avoid excessive or redundant commenting.
  • Confirm that the automated tests pass.
  • Confirm the code performs the intended functionality

Setup

Get the code for the pull request.

cd ~/bin/capture
git checkout main
git pull
git checkout version-1-0
git submodule update --init --recursive
source cap_completion.sh

Test

Run the automated test suite.

cd ~/bin/capture
tests/install
tests/run

Test manually in scratch:

cd $USER_SCRATCH
cap new --owner lasseignelab "$USER-testing"

cd "$USER-testing"

  • Spot test the features listed in the change log for Version 1.0.0 to verify that CAPTURE seems to work properly after merging.
  • Test that fundamental features in CAPTURE, not necessarily changed by Version 1.0.0, still work properly.

Cleanup

  • Remove the test directory from scratch:
cd "$USER_SCRATCH"
rm -rf "$USER-testing"

  • Delete the test repo from github.
  • Reset CAPTURE to the released version.
cap update

Initial version of the command with tests but not fully integrated
with the cap verify command.
Conflicts:
	README.md
	lib/environment.sh
Changes to my HPC environment broke npm.  In order to insulate the tests
from HPC changes, a test runner was created to use a docker container to
run the test suite.
Old git versions would name the default branch master. This is an
insensitive name so new versions of git use main as the default.
If a user has the old version of git we rename name master to main.
If they have a new version we get an error attempting to rename a
master branch that does not exist. To resolve the issue a check for
master existing needs to be added.
The jq, JSON query, command is not installed everywhere so it did
not work in the container used for testing. It also would not work
in a lot of linux installations. Therefore, it is being replaced by
grep and cut which are ubiquitous.
Output for CAPTURE verifications should be reproducable. As a result,
output that only serves as human readable help needed to be removed.
This commit adds an option for removing informational text so that
cap verify and cap_verify_md5 output will be clean and reproducible.
toniecrumley and others added 6 commits January 9, 2026 15:22
--file-name was confusing with --unzip because the actual final
filename did not match. --source-file-name clarifies that it is
not the final downloaded file name.
Add --source-file-name option to cap_data_download
@toniecrumley toniecrumley changed the title Version 1.0 Version 1.0.0 Jan 13, 2026
@github-actions
Copy link

github-actions bot commented Jan 13, 2026

⚠️MegaLinter analysis: Success with warnings

Descriptor Linter Files Fixed Errors Warnings Elapsed time
⚠️ BASH bash-exec 32 29 0 0.29s
✅ BASH shellcheck 32 0 0 1.15s
⚠️ BASH shfmt 32 23 0 0.02s
⚠️ MARKDOWN markdownlint 3 63 0 0.79s
✅ MARKDOWN markdown-table-formatter 3 0 0 0.28s

Detailed Issues

⚠️ BASH / bash-exec - 29 errors
Results of bash-exec linter (version 5.3.3)
See documentation on https://megalinter.io/9.3.0/descriptors/bash_bash_exec/
-----------------------------------------------

✅ [SUCCESS] cap
❌ [ERROR] cap_completion.sh
    Error: File:[cap_completion.sh] is not executable

❌ [ERROR] commands/env.sh
    Error: File:[commands/env.sh] is not executable

❌ [ERROR] commands/help.sh
    Error: File:[commands/help.sh] is not executable

❌ [ERROR] commands/md5.sh
    Error: File:[commands/md5.sh] is not executable

❌ [ERROR] commands/new.sh
    Error: File:[commands/new.sh] is not executable

❌ [ERROR] commands/run.sh
    Error: File:[commands/run.sh] is not executable

❌ [ERROR] commands/update.sh
    Error: File:[commands/update.sh] is not executable

❌ [ERROR] commands/verify.sh
    Error: File:[commands/verify.sh] is not executable

❌ [ERROR] commands/version.sh
    Error: File:[commands/version.sh] is not executable

❌ [ERROR] configure.sh
    Error: File:[configure.sh] is not executable

❌ [ERROR] install.sh
    Error: File:[install.sh] is not executable

❌ [ERROR] lib/environment.sh
    Error: File:[lib/environment.sh] is not executable

❌ [ERROR] lib/environment_functions.sh
    Error: File:[lib/environment_functions.sh] is not executable

❌ [ERROR] lib/functions.sh
    Error: File:[lib/functions.sh] is not executable

❌ [ERROR] lib/functions/cap_array_value.sh
    Error: File:[lib/functions/cap_array_value.sh] is not executable

❌ [ERROR] lib/functions/cap_container.sh
    Error: File:[lib/functions/cap_container.sh] is not executable

❌ [ERROR] lib/functions/cap_data_download.sh
    Error: File:[lib/functions/cap_data_download.sh] is not executable

❌ [ERROR] lib/functions/commands/cap_check_environment.sh
    Error: File:[lib/functions/commands/cap_check_environment.sh] is not executable

❌ [ERROR] lib/functions/commands/cap_root_required.sh
    Error: File:[lib/functions/commands/cap_root_required.sh] is not executable

❌ [ERROR] lib/functions/verify/cap_verify_append.sh
    Error: File:[lib/functions/verify/cap_verify_append.sh] is not executable

❌ [ERROR] lib/functions/verify/cap_verify_md5.sh
    Error: File:[lib/functions/verify/cap_verify_md5.sh] is not executable

❌ [ERROR] tests/fixtures/env/.caprc
    Error: File:[tests/fixtures/env/.caprc] is not executable

❌ [ERROR] tests/fixtures/run/array_job.sh
    Error: File:[tests/fixtures/run/array_job.sh] is not executable

❌ [ERROR] tests/fixtures/run/job.sh
    Error: File:[tests/fixtures/run/job.sh] is not executable

❌ [ERROR] tests/fixtures/verify/verifications/test_cap_verify_md5.sh
    Error: File:[tests/fixtures/verify/verifications/test_cap_verify_md5.sh] is not executable

❌ [ERROR] tests/fixtures/verify/verifications/test_dry_run.sh
    Error: File:[tests/fixtures/verify/verifications/test_dry_run.sh] is not executable

❌ [ERROR] tests/fixtures/verify/verifications/test_name.sh
    Error: File:[tests/fixtures/verify/verifications/test_name.sh] is not executable

❌ [ERROR] tests/fixtures/verify/verifications/test_output_file.sh
    Error: File:[tests/fixtures/verify/verifications/test_output_file.sh] is not executable

✅ [SUCCESS] tests/install
✅ [SUCCESS] tests/run
❌ [ERROR] tests/setup_suite.bash
    Error: File:[tests/setup_suite.bash] is not executable
⚠️ MARKDOWN / markdownlint - 63 errors
.github/pull_request_template.md:1 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "## Summary"]
.github/pull_request_template.md:6:21 error MD059/descriptive-link-text Link text should be descriptive [Context: "[here]"]
.github/pull_request_template.md:38 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
.github/pull_request_template.md:51 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
.github/pull_request_template.md:58 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
.github/pull_request_template.md:63 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
.github/pull_request_template.md:69 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
.github/pull_request_template.md:76 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
CHANGELOG.md:1 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "## CAPTURE 1.0.0 (January 16, ..."]
README.md:1 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "CAPTURE"]
README.md:28 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:33 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:38 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:46 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:55 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:74 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:78 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:129 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:181 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:195 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:207 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:225 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:247 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:281 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:303 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:346 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:387 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:391 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:419 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:438 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:447 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:451 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:461 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:472 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:477 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:486 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:515 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:524 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:534 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:556 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:578 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:583:72 error MD026/no-trailing-punctuation Trailing punctuation in heading [Punctuation: ':']
README.md:587 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:594 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:613 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:617 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:630 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:649 error MD024/no-duplicate-heading Multiple headings with the same content [Context: "Examples for a verification na..."]
README.md:649:72 error MD026/no-trailing-punctuation Trailing punctuation in heading [Punctuation: ':']
README.md:652 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:656 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:663 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:667 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:672 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:676 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:697 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:710 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:715 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:724 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:728 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:734 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:741 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
README.md:746 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
⚠️ BASH / shfmt - 23 errors
diff cap.orig cap
--- cap.orig
+++ cap
@@ -10,14 +10,14 @@
 
 # Load commands
 for file in "$CAP_INSTALL_PATH"/commands/*.sh; do
-    # shellcheck disable=SC1090
-    source "$file"
+	# shellcheck disable=SC1090
+	source "$file"
 done
 
 # Check if a parameter was provided
 if [ "$#" -eq 0 ]; then
-    cap_help
-    exit 1
+	cap_help
+	exit 1
 fi
 
 # Retrieve the function name from the first parameter
@@ -25,14 +25,14 @@
 namespaced_name="cap_$function_name"
 
 # Check if the function exists
-if declare -f "$namespaced_name" > /dev/null; then
-    # Extract parameters starting from the 2nd one
-    params=("${@:2}")
-
-    # Call the function with the extracted parameters
-    $namespaced_name "${params[@]}"
+if declare -f "$namespaced_name" >/dev/null; then
+	# Extract parameters starting from the 2nd one
+	params=("${@:2}")
+
+	# Call the function with the extracted parameters
+	$namespaced_name "${params[@]}"
 else
-    echo "Unknown command: $function_name"
-    echo "Usage: $0 {md5|sha256}"
-    exit 1
+	echo "Unknown command: $function_name"
+	echo "Usage: $0 {md5|sha256}"
+	exit 1
 fi
diff cap_completion.sh.orig cap_completion.sh
--- cap_completion.sh.orig
+++ cap_completion.sh
@@ -2,33 +2,33 @@
 
 # Function to handle tab completion for CAPTURE
 _cap_completion() {
-  local current subcommand subcommands
-  current="${COMP_WORDS[COMP_CWORD]}"
-  subcommand="${COMP_WORDS[1]}"
-  subcommands="env help md5 new run update verify version"
-
-  if [[ "${COMP_CWORD}" -eq 1 ]]; then
-    # Show the cap subcommand list.
-    mapfile -t COMPREPLY < <(compgen -W "${subcommands}" -- "${current}")
-  else
-    case "$subcommand" in
-      "help")
-        # Show the cap subcommand list.
-        if [[ "${COMP_CWORD}" == 2 ]]; then
-          mapfile -t COMPREPLY < <(compgen -W "${subcommands}" -- "${current}")
-        fi
-        ;;
-      "md5"|"run"|"verify")
-        # Tab compete with file and directory names.
-        compopt -o default -o plusdirs
-        ;;
-      *)
-        # Don't tab complete.
-        COMPREPLY=()
-    esac
-  fi
+	local current subcommand subcommands
+	current="${COMP_WORDS[COMP_CWORD]}"
+	subcommand="${COMP_WORDS[1]}"
+	subcommands="env help md5 new run update verify version"
+
+	if [[ "${COMP_CWORD}" -eq 1 ]]; then
+		# Show the cap subcommand list.
+		mapfile -t COMPREPLY < <(compgen -W "${subcommands}" -- "${current}")
+	else
+		case "$subcommand" in
+		"help")
+			# Show the cap subcommand list.
+			if [[ "${COMP_CWORD}" == 2 ]]; then
+				mapfile -t COMPREPLY < <(compgen -W "${subcommands}" -- "${current}")
+			fi
+			;;
+		"md5" | "run" | "verify")
+			# Tab compete with file and directory names.
+			compopt -o default -o plusdirs
+			;;
+		*)
+			# Don't tab complete.
+			COMPREPLY=()
+			;;
+		esac
+	fi
 }
 
 # Register the completion function for "mytool"
 complete -F _cap_completion cap
-
diff commands/env.sh.orig commands/env.sh
--- commands/env.sh.orig
+++ commands/env.sh
@@ -1,16 +1,16 @@
 #!/bin/bash
 
 cap_env_description() {
-  cat <<EOF
+	cat <<EOF
   Displays CAPTURE environment variables.
 EOF
 }
 
 cap_env_help() {
-  cap_env_description
-  echo
-
-  cat <<EOF
+	cap_env_description
+	echo
+
+	cat <<EOF
   The "env" command displays a list of all the CAPTURE environment variables
   along with their values. File and path values are displayed with full
   paths. This command must be executed from the project root directory.
@@ -40,69 +40,71 @@
 }
 
 cap_env() {
-  cap_root_required "env"
-  cap_env_parse_commandline_parameters "$@"
-
-  # Snapshot the incoming environment variables. The cap_env_before
-  # variable is created before the first snapshot so it will be in
-  # the before and after snapshots. Otherwise, it shows up in the
-  # cap_env_diff below.
-  local cap_env_before=""
-  cap_env_before="$(cap_env_snapshot)"
-
-  # Load the CAPTURE environment.
-  if [ -n "$environment_override" ]; then
-    CAP_ENVIRONMENT="$environment_override"
-  fi
-  source "$CAP_INSTALL_PATH/lib/environment.sh"
-  if [ -n "$environment_override" ]; then
-    CAP_ENVIRONMENT="$environment_override"
-  fi
-  cap_check_environment "$CAP_ENVIRONMENT"
-
-  # Snapshot after the CAPTURE environment as loaded.
-  cap_env_after="$(cap_env_snapshot)"
-
-  # Determine list of variables created during environment loading.
-  cap_env_diff="$(
-    comm -13 \
-      <(printf '%s\n' "$cap_env_before") \
-      <(printf '%s\n' "$cap_env_after")
-  )"
-
-  # Display CAPTURE environment variables.
-  echo
-  for v in $cap_env_diff; do
-    printf '%s=%q\n' "$v" "${!v}"
-  done
-  echo
+	cap_root_required "env"
+	cap_env_parse_commandline_parameters "$@"
+
+	# Snapshot the incoming environment variables. The cap_env_before
+	# variable is created before the first snapshot so it will be in
+	# the before and after snapshots. Otherwise, it shows up in the
+	# cap_env_diff below.
+	local cap_env_before=""
+	cap_env_before="$(cap_env_snapshot)"
+
+	# Load the CAPTURE environment.
+	if [ -n "$environment_override" ]; then
+		CAP_ENVIRONMENT="$environment_override"
+	fi
+	source "$CAP_INSTALL_PATH/lib/environment.sh"
+	if [ -n "$environment_override" ]; then
+		CAP_ENVIRONMENT="$environment_override"
+	fi
+	cap_check_environment "$CAP_ENVIRONMENT"
+
+	# Snapshot after the CAPTURE environment as loaded.
+	cap_env_after="$(cap_env_snapshot)"
+
+	# Determine list of variables created during environment loading.
+	cap_env_diff="$(
+		comm -13 \
+			<(printf '%s\n' "$cap_env_before") \
+			<(printf '%s\n' "$cap_env_after")
+	)"
+
+	# Display CAPTURE environment variables.
+	echo
+	for v in $cap_env_diff; do
+		printf '%s=%q\n' "$v" "${!v}"
+	done
+	echo
 }
 
 cap_env_parse_commandline_parameters() {
-  # Define the named commandline options
-  if ! OPTIONS=$(getopt -o e: --long environment: -- "$@"); then
-    echo "Use the 'cap help env' command for detailed help."
-    exit 1
-  fi
-  eval set -- "$OPTIONS"
-
-  # Set default values for the named parameters
-  environment_override=""
-
-  # Parse the optional named command line options
-  while true; do
-    case "$1" in
-      -e|--environment)
-        environment_override=$2
-        shift 2 ;;
-      --)
-        shift
-        break;;
-    esac
-  done
+	# Define the named commandline options
+	if ! OPTIONS=$(getopt -o e: --long environment: -- "$@"); then
+		echo "Use the 'cap help env' command for detailed help."
+		exit 1
+	fi
+	eval set -- "$OPTIONS"
+
+	# Set default values for the named parameters
+	environment_override=""
+
+	# Parse the optional named command line options
+	while true; do
+		case "$1" in
+		-e | --environment)
+			environment_override=$2
+			shift 2
+			;;
+		--)
+			shift
+			break
+			;;
+		esac
+	done
 }
 
 # Snapshot current environment variables.
 cap_env_snapshot() {
-  compgen -v | sort
+	compgen -v | sort
 }
diff commands/help.sh.orig commands/help.sh
--- commands/help.sh.orig
+++ commands/help.sh
@@ -1,16 +1,16 @@
 #!/bin/bash
 
 cap_help_description() {
-  cat <<EOF
+	cat <<EOF
   Shows help for the cap command line tool.
 EOF
 }
 
 cap_help_help() {
-  cap_help_description
-  echo
-
-  cat <<EOF
+	cap_help_description
+	echo
+
+	cat <<EOF
   The "help" command will display help for all the commands available for the
   cap command.
 
@@ -32,11 +32,11 @@
 }
 
 cap_help() {
-  echo
-
-  # Check if a parameter was provided
-  if [ "$#" -eq 0 ]; then
-    cat <<EOF
+	echo
+
+	# Check if a parameter was provided
+	if [ "$#" -eq 0 ]; then
+		cat <<EOF
   Usage: cap COMMAND ...
 
   Commands:
@@ -45,36 +45,36 @@
   COMMAND
 EOF
 
-    # Directory containing the scripts
-    CAP_COMMANDS_DIR="$CAP_INSTALL_PATH"/commands
-
-    {
-      # Loop through each script file in the directory
-      for script in "$CAP_COMMANDS_DIR"/*.sh; do
-        # Get the base name of the script (e.g., md5 for md5.sh)
-        script_name=$(basename "$script" .sh)
-
-        # Construct the function name
-        description_function="cap_${script_name}_description"
-
-        # Check if the function exists
-        if declare -f "$description_function" > /dev/null; then
-          printf '    %s:' "$script_name"
-
-          # Call the function
-          "$description_function"
-        else
-          echo "    Error:  Function $description_function not found in $script"
-        fi
-      done
-    } | column -t -s ':'
-  else
-    # Retrieve the command name from the first parameter
-    command_name=$1
-    # Construct the function name
-    help_function="cap_${command_name}_help"
-    # Call the function
-    "$help_function" | less -FX
-  fi
-  echo
+		# Directory containing the scripts
+		CAP_COMMANDS_DIR="$CAP_INSTALL_PATH"/commands
+
+		{
+			# Loop through each script file in the directory
+			for script in "$CAP_COMMANDS_DIR"/*.sh; do
+				# Get the base name of the script (e.g., md5 for md5.sh)
+				script_name=$(basename "$script" .sh)
+
+				# Construct the function name
+				description_function="cap_${script_name}_description"
+
+				# Check if the function exists
+				if declare -f "$description_function" >/dev/null; then
+					printf '    %s:' "$script_name"
+
+					# Call the function
+					"$description_function"
+				else
+					echo "    Error:  Function $description_function not found in $script"
+				fi
+			done
+		} | column -t -s ':'
+	else
+		# Retrieve the command name from the first parameter
+		command_name=$1
+		# Construct the function name
+		help_function="cap_${command_name}_help"
+		# Call the function
+		"$help_function" | less -FX
+	fi
+	echo
 }
diff commands/md5.sh.orig commands/md5.sh
--- commands/md5.sh.orig
+++ commands/md5.sh
@@ -1,16 +1,16 @@
 #!/bin/bash
 
 cap_md5_description() {
-  cat <<EOF
+	cat <<EOF
   Calculates a combined MD5 checksum for one or more files.
 EOF
 }
 
 cap_md5_help() {
-  cap_md5_description
-  echo
-
-  cat <<EOF
+	cap_md5_description
+	echo
+
+	cat <<EOF
   The "md5" command produces an MD5 checksum for each file specified and a
   combined MD5 checksum for all the files. The purpose of this command is to
   determine whether files downloaded or created are complete and accurate. If
@@ -99,21 +99,21 @@
 }
 
 cap_md5() {
-  cap_md5_parse_commandline_parameters "$@"
-
-  # Submit to slurm or run immediately
-  case "$slurm" in
-    batch)
-      # Create a temporary script and run it as a Slurm batch job.
-      current_path=$(pwd)
-      if [[ "$output_file" == "" ]]; then
-        output_file='cap-md5-%j.out'
-      fi
-
-      # Prepare a temporary script for running the command in Slurm.
-      # The temporary file was introduced to make the code testable by BATS.
-      temp_batch_script=$(mktemp)
-      cat <<EOF > "$temp_batch_script"
+	cap_md5_parse_commandline_parameters "$@"
+
+	# Submit to slurm or run immediately
+	case "$slurm" in
+	batch)
+		# Create a temporary script and run it as a Slurm batch job.
+		current_path=$(pwd)
+		if [[ "$output_file" == "" ]]; then
+			output_file='cap-md5-%j.out'
+		fi
+
+		# Prepare a temporary script for running the command in Slurm.
+		# The temporary file was introduced to make the code testable by BATS.
+		temp_batch_script=$(mktemp)
+		cat <<EOF >"$temp_batch_script"
 #!/bin/bash
 
 #################################### SLURM ####################################
@@ -127,62 +127,62 @@
 
 cap md5 $slurm_args "${md5_files[@]}"
 EOF
-      if [[ "$output_files_only" == "false" ]]; then
-        cat <<EOF >> "$temp_batch_script"
+		if [[ "$output_files_only" == "false" ]]; then
+			cat <<EOF >>"$temp_batch_script"
 echo "Ran from: $current_path"
 EOF
-      fi
-      sbatch "$temp_batch_script"
-
-      ;;
-    run)
-      # Prepare a temporary script for running the command in Slurm.
-      # The temporary file was introduced to make the code testable by BATS.
-      temp_run_script=$(mktemp)
-      cat <<EOF > "$temp_run_script"
+		fi
+		sbatch "$temp_batch_script"
+
+		;;
+	run)
+		# Prepare a temporary script for running the command in Slurm.
+		# The temporary file was introduced to make the code testable by BATS.
+		temp_run_script=$(mktemp)
+		cat <<EOF >"$temp_run_script"
 cap md5 $slurm_args ${md5_files[@]}
 EOF
 
-      srun \
-        --job-name=cap-md5 \
-        --ntasks=1 \
-        --cpus-per-task=1 \
-        --mem=32G \
-        --output="${output_file:-/dev/stdout}" \
-        --input="$temp_run_script" \
-        --export=ALL \
-        bash
-      ;;
-    *)
-      local temp_output_file
-      temp_output_file=$(mktemp)
-      {
-        if [[ "$dry_run" == "true" ]]; then
-          # shellcheck disable=SC2068
-          find -H -L ${md5_files[@]} "${ignore_filter[@]}" \( "${select_filter[@]}" \) -type f ! -path '*/\.*' | sort
-        else
-          # Compute checksums for all files
-          [[ "$output_files_only" == "false" ]] && echo -e '\nFiles included:'
-          checksums=$(cap_md5_find)
-          echo "$checksums"
-
-          # Compute single checksum based on the checksums of all files
-          if [[ "$output_files_only" == "false" ]]; then
-            echo -e '\nCombined MD5 checksum:'
-            echo "$checksums" | cut -d ' ' -f1 | md5sum | cut -d ' ' -f1
-            echo
-          fi
-        fi
-      } > "$temp_output_file"
-      if [[ "$normalize" == "true" && "$dry_run" == "false" ]]; then
-        cap_md5_normalize "$temp_output_file"
-   

(Truncated to 13333 characters out of 79728)

See detailed reports in MegaLinter artifacts

You could have the same capabilities but better runtime performances if you use a MegaLinter flavor:

Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)

  • Documentation: Custom Flavors
  • Command: npx mega-linter-runner@9.3.0 --custom-flavor-setup --custom-flavor-linters BASH_EXEC,BASH_SHELLCHECK,BASH_SHFMT,MARKDOWN_MARKDOWNLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER

MegaLinter is graciously provided by OX Security

Copy link
Contributor

@tchowton tchowton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the tests passed. I tried different combinations of the commands and helper functions, and they all worked.

@toniecrumley
Copy link
Contributor Author

All of the tests passed. I tried different combinations of the commands and helper functions, and they all worked.

@tchowton, please approve the project-template pull request as well.

@toniecrumley toniecrumley merged commit 87fd9fb into main Jan 20, 2026
2 checks passed
@toniecrumley toniecrumley deleted the version-1-0 branch January 20, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants