Skip to content

Check goo script arguments to prevent data loss.#1487

Merged
omsai merged 2 commits intoswcarpentry:mainfrom
tkphd:goostats
Aug 18, 2025
Merged

Check goo script arguments to prevent data loss.#1487
omsai merged 2 commits intoswcarpentry:mainfrom
tkphd:goostats

Conversation

@tkphd
Copy link
Contributor

@tkphd tkphd commented Apr 23, 2025

Often, the Instructor and Learners will run goostats.sh without arguments. The resulting usage message unhelpfully requests two files -- without warning that the second will be written into!

This PR updates both "goo" scripts to check file arguments for existence before continuing.

goostats.sh: If $1 is absent, or $2 is present, exit 2 (invalid arguments).

goodiff.sh: If $1 or $2 is absent, exit 2 (invalid arguments).

"Usage" also updated to use $0 rather than hard-coding the script names.

@github-actions
Copy link

github-actions bot commented Apr 23, 2025

Thank you!

Thank you for your pull request 😃

🤖 This automated message can help you check the rendered files in your submission for clarity. If you have any questions, please feel free to open an issue in {sandpaper}.

If you have files that automatically render output (e.g. R Markdown), then you should check for the following:

  • 🎯 correct output
  • 🖼️ correct figures
  • ❓ new warnings
  • ‼️ new errors

Rendered Changes

🔍 Inspect the changes: https://github.com/swcarpentry/shell-novice/compare/md-outputs..md-outputs-PR-1487

The following changes were observed in the rendered markdown documents:

 data/shell-lesson-data.zip | Bin 460289 -> 460520 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)
What does this mean?

If you have source files that require output and figures to be generated (e.g. R Markdown), then it is important to make sure the generated figures and output are reproducible.

This output provides a way for you to inspect the output in a diff-friendly manner so that it's easy to see the changes that occur due to new software versions or randomisation.

⏱️ Updated at 2025-08-18 11:46:51 +0000

@bkmgit
Copy link
Contributor

bkmgit commented Apr 23, 2025

Thanks for this. Any reason for changing the return code to 0 from 1 when the incorrect number of arguments are given?

github-actions bot pushed a commit that referenced this pull request Apr 23, 2025
@bkmgit bkmgit self-assigned this May 21, 2025
Co-authored-by: Benson Muite <bkmgit@users.noreply.github.com>
github-actions bot pushed a commit that referenced this pull request Aug 18, 2025
@omsai omsai merged commit fe72161 into swcarpentry:main Aug 18, 2025
3 checks passed
github-actions bot pushed a commit that referenced this pull request Aug 18, 2025
Auto-generated via `{sandpaper}`
Source  : fe72161
Branch  : main
Author  : Trevor Keller <trevor.keller@gmail.com>
Time    : 2025-08-18 11:47:26 +0000
Message : Check goo script arguments to prevent data loss. (#1487)

* Check goo script arguments to prevent data loss.

* Invalid arguments triggering a usage message should return an error code

Co-authored-by: Pariksheet Nanda <pan79@pitt.edu>
Co-authored-by: Benson Muite <bkmgit@users.noreply.github.com>
github-actions bot pushed a commit that referenced this pull request Aug 18, 2025
Auto-generated via `{sandpaper}`
Source  : 2f4e620
Branch  : md-outputs
Author  : GitHub Actions <actions@github.com>
Time    : 2025-08-18 11:48:09 +0000
Message : markdown source builds

Auto-generated via `{sandpaper}`
Source  : fe72161
Branch  : main
Author  : Trevor Keller <trevor.keller@gmail.com>
Time    : 2025-08-18 11:47:26 +0000
Message : Check goo script arguments to prevent data loss. (#1487)

* Check goo script arguments to prevent data loss.

* Invalid arguments triggering a usage message should return an error code

Co-authored-by: Pariksheet Nanda <pan79@pitt.edu>
Co-authored-by: Benson Muite <bkmgit@users.noreply.github.com>
github-actions bot pushed a commit that referenced this pull request Aug 19, 2025
Auto-generated via `{sandpaper}`
Source  : 2f4e620
Branch  : md-outputs
Author  : GitHub Actions <actions@github.com>
Time    : 2025-08-18 11:48:09 +0000
Message : markdown source builds

Auto-generated via `{sandpaper}`
Source  : fe72161
Branch  : main
Author  : Trevor Keller <trevor.keller@gmail.com>
Time    : 2025-08-18 11:47:26 +0000
Message : Check goo script arguments to prevent data loss. (#1487)

* Check goo script arguments to prevent data loss.

* Invalid arguments triggering a usage message should return an error code

Co-authored-by: Pariksheet Nanda <pan79@pitt.edu>
Co-authored-by: Benson Muite <bkmgit@users.noreply.github.com>
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