Repository: axodotdev/cargo-dist (rust)

Issue:
Several tests fail due to shellcheck errors
Please let me know if I'm doing something weird, but I've just forked the repo to work on #343 and when running `cargo test`, 11 tests fail due to "shellcheck found issues".

The complete output is:

```
    Finished test [unoptimized + debuginfo] target(s) in 0.09s
     Running unittests src/lib.rs (target/debug/deps/cargo_dist-e075ef08add3d946)

running 2 tests
test tests::test_some_op ... ok
test backend::templates::test::ensure_known_templates ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running unittests src/main.rs (target/debug/deps/cargo_dist-83f93916721d2bea)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running tests/cli-tests.rs (target/debug/deps/cli_tests-96021c04cea934c8)

running 8 tests
test test_version ... ok
test test_short_help ... ok
test test_long_help ... ok
test test_markdown_help ... ok
test test_error_manifest ... ok
test test_lib_manifest ... ok
test test_lib_manifest_slash ... ok
test test_manifest ... ok

test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.11s

     Running tests/integration-tests.rs (target/debug/deps/integration_tests-e5c4b62402ee9b9c)

running 13 tests
test akaikatana_basic ... FAILED
test axolotlsay_basic ... FAILED
test env_path_invalid - should panic ... ok
test install_path_env_no_subdir ... FAILED
test install_path_cargo_home ... FAILED
test install_path_env_subdir ... FAILED
test install_path_env_subdir_space ... FAILED
test install_path_env_subdir_space_deeper ... FAILED
test install_path_home_subdir_deeper ... FAILED
test install_path_home_subdir_min ... FAILED
test install_path_home_subdir_space ... FAILED
test install_path_home_subdir_space_deeper ... FAILED
test install_path_invalid - should panic ... ok

failures:

---- akaikatana_basic stdout ----
getting tools...
repo already cloned, updating it...
loading Cargo.toml...
editing Cargo.toml...

[workspace.metadata.dist]
cargo-dist-version = "0.2.0-prerelease.2"
rust-toolchain-version = "1.67.1"
ci = ["github"]
installers = ["shell", "powershell", "homebrew"]
targets = ["x86_64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "aarch64-apple-darwin"]


writing Cargo.toml...
running cargo dist build -aglobal...
loading results...
shellchecking target/distrib/akaikatana-repack-installer.sh

In target/distrib/akaikatana-repack-installer.sh line 88:
                    continue
                    ^------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

For more information:
  https://www.shellcheck.net/wiki/SC2317 -- Command appears to be unreachable...

Error:   × shellcheck found issues


---- axolotlsay_basic stdout ----
repo already cloned, updating it...
loading Cargo.toml...
editing Cargo.toml...

[workspace.metadata.dist]
cargo-dist-version = "0.2.0-prerelease.2"
installers = ["shell", "powershell", "homebrew", "npm"]
targets = ["x86_64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "aarch64-apple-darwin"]
ci = ["github"]
unix-archive = ".tar.gz"
windows-archive = ".tar.gz"
scope = "@axodotdev"


writing Cargo.toml...
running cargo dist build -aglobal...
loading results...
shellchecking target/distrib/axolotlsay-installer.sh

In target/distrib/axolotlsay-installer.sh line 88:
                    continue
                    ^------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

For more information:
  https://www.shellcheck.net/wiki/SC2317 -- Command appears to be unreachable...

Error:   × shellcheck found issues


---- install_path_env_no_subdir stdout ----
loading Cargo.toml...
editing Cargo.toml...

[workspace.metadata.dist]
cargo-dist-version = "0.2.0-prerelease.2"
installers = ["shell", "powershell", "homebrew"]
targets = ["x86_64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "aarch64-apple-darwin"]
ci = ["github"]
install-path = "$MY_ENV_VAR/"
unix-archive = ".tar.gz"
windows-archive = ".tar.gz"


writing Cargo.toml...
running cargo dist build -aglobal...
loading results...
shellchecking target/distrib/axolotlsay-installer.sh

In target/distrib/axolotlsay-installer.sh line 88:
                    continue
                    ^------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

For more information:
  https://www.shellcheck.net/wiki/SC2317 -- Command appears to be unreachable...

Error:   × shellcheck found issues


---- install_path_cargo_home stdout ----
loading Cargo.toml...
editing Cargo.toml...

[workspace.metadata.dist]
cargo-dist-version = "0.2.0-prerelease.2"
installers = ["shell", "powershell", "homebrew"]
targets = ["x86_64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "aarch64-apple-darwin"]
ci = ["github"]
install-path = "CARGO_HOME"
unix-archive = ".tar.gz"
windows-archive = ".tar.gz"


writing Cargo.toml...
running cargo dist build -aglobal...
loading results...
shellchecking target/distrib/axolotlsay-installer.sh

In target/distrib/axolotlsay-installer.sh line 88:
                    continue
                    ^------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

For more information:
  https://www.shellcheck.net/wiki/SC2317 -- Command appears to be unreachable...

Error:   × shellcheck found issues


---- install_path_env_subdir stdout ----
loading Cargo.toml...
editing Cargo.toml...

[workspace.metadata.dist]
cargo-dist-version = "0.2.0-prerelease.2"
installers = ["shell", "powershell", "homebrew"]
targets = ["x86_64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "aarch64-apple-darwin"]
ci = ["github"]
install-path = "$MY_ENV_VAR/bin/"
unix-archive = ".tar.gz"
windows-archive = ".tar.gz"


writing Cargo.toml...
running cargo dist build -aglobal...
loading results...
shellchecking target/distrib/axolotlsay-installer.sh

In target/distrib/axolotlsay-installer.sh line 88:
                    continue
                    ^------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

For more information:
  https://www.shellcheck.net/wiki/SC2317 -- Command appears to be unreachable...

Error:   × shellcheck found issues


---- install_path_env_subdir_space stdout ----
loading Cargo.toml...
editing Cargo.toml...

[workspace.metadata.dist]
cargo-dist-version = "0.2.0-prerelease.2"
installers = ["shell", "powershell", "homebrew"]
targets = ["x86_64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "aarch64-apple-darwin"]
ci = ["github"]
install-path = "$MY_ENV_VAR/My Axolotlsay Documents"
unix-archive = ".tar.gz"
windows-archive = ".tar.gz"


writing Cargo.toml...
running cargo dist build -aglobal...
loading results...
shellchecking target/distrib/axolotlsay-installer.sh

In target/distrib/axolotlsay-installer.sh line 88:
                    continue
                    ^------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

For more information:
  https://www.shellcheck.net/wiki/SC2317 -- Command appears to be unreachable...

Error:   × shellcheck found issues


---- install_path_env_subdir_space_deeper stdout ----
loading Cargo.toml...
editing Cargo.toml...

[workspace.metadata.dist]
cargo-dist-version = "0.2.0-prerelease.2"
installers = ["shell", "powershell", "homebrew"]
targets = ["x86_64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "aarch64-apple-darwin"]
ci = ["github"]
install-path = "$MY_ENV_VAR/My Axolotlsay Documents/bin"
unix-archive = ".tar.gz"
windows-archive = ".tar.gz"


writing Cargo.toml...
running cargo dist build -aglobal...
loading results...
shellchecking target/distrib/axolotlsay-installer.sh

In target/distrib/axolotlsay-installer.sh line 88:
                    continue
                    ^------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

For more information:
  https://www.shellcheck.net/wiki/SC2317 -- Command appears to be unreachable...

Error:   × shellcheck found issues


---- install_path_home_subdir_deeper stdout ----
loading Cargo.toml...
editing Cargo.toml...

[workspace.metadata.dist]
cargo-dist-version = "0.2.0-prerelease.2"
installers = ["shell", "powershell", "homebrew"]
targets = ["x86_64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "aarch64-apple-darwin"]
ci = ["github"]
install-path = "~/.axolotlsay/bins"
unix-archive = ".tar.gz"
windows-archive = ".tar.gz"


writing Cargo.toml...
running cargo dist build -aglobal...
loading results...
shellchecking target/distrib/axolotlsay-installer.sh

In target/distrib/axolotlsay-installer.sh line 88:
                    continue
                    ^------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

For more information:
  https://www.shellcheck.net/wiki/SC2317 -- Command appears to be unreachable...

Error:   × shellcheck found issues


---- install_path_home_subdir_min stdout ----
loading Cargo.toml...
editing Cargo.toml...

[workspace.metadata.dist]
cargo-dist-version = "0.2.0-prerelease.2"
installers = ["shell", "powershell", "homebrew"]
targets = ["x86_64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "aarch64-apple-darwin"]
ci = ["github"]
install-path = "~/.axolotlsay/"
unix-archive = ".tar.gz"
windows-archive = ".tar.gz"


writing Cargo.toml...
running cargo dist build -aglobal...
loading results...
shellchecking target/distrib/axolotlsay-installer.sh

In target/distrib/axolotlsay-installer.sh line 88:
                    continue
                    ^------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

For more information:
  https://www.shellcheck.net/wiki/SC2317 -- Command appears to be unreachable...

Error:   × shellcheck found issues


---- install_path_home_subdir_space stdout ----
loading Cargo.toml...
editing Cargo.toml...

[workspace.metadata.dist]
cargo-dist-version = "0.2.0-prerelease.2"
installers = ["shell", "powershell", "homebrew"]
targets = ["x86_64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "aarch64-apple-darwin"]
ci = ["github"]
install-path = "~/My Axolotlsay Documents"
unix-archive = ".tar.gz"
windows-archive = ".tar.gz"


writing Cargo.toml...
running cargo dist build -aglobal...
loading results...
shellchecking target/distrib/axolotlsay-installer.sh

In target/distrib/axolotlsay-installer.sh line 88:
                    continue
                    ^------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

For more information:
  https://www.shellcheck.net/wiki/SC2317 -- Command appears to be unreachable...

Error:   × shellcheck found issues


---- install_path_home_subdir_space_deeper stdout ----
loading Cargo.toml...
editing Cargo.toml...

[workspace.metadata.dist]
cargo-dist-version = "0.2.0-prerelease.2"
installers = ["shell", "powershell", "homebrew"]
targets = ["x86_64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "aarch64-apple-darwin"]
ci = ["github"]
install-path = "~/My Axolotlsay Documents/bin/"
unix-archive = ".tar.gz"
windows-archive = ".tar.gz"


writing Cargo.toml...
running cargo dist build -aglobal...
loading results...
shellchecking target/distrib/axolotlsay-installer.sh

In target/distrib/axolotlsay-installer.sh line 88:
                    continue
                    ^------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

For more information:
  https://www.shellcheck.net/wiki/SC2317 -- Command appears to be unreachable...

Error:   × shellcheck found issues



failures:
    akaikatana_basic
    axolotlsay_basic
    install_path_cargo_home
    install_path_env_no_subdir
    install_path_env_subdir
    install_path_env_subdir_space
    install_path_env_subdir_space_deeper
    install_path_home_subdir_deeper
    install_path_home_subdir_min
    install_path_home_subdir_space
    install_path_home_subdir_space_deeper

test result: FAILED. 2 passed; 11 failed; 0 ignored; 0 measured; 0 filtered out; finished in 5.48s

error: test failed, to rerun pass `-p cargo-dist --test integration-tests`
```

This seems to be due to the lone `continue` here: https://github.com/axodotdev/cargo-dist/blob/2c0f30bc3c628f285542d44cef778f0c8e17e19f/cargo-dist/templates/installer/installer.sh.j2#L96

(In fact the only `continue` in the entire file!)

The `err` function called just before it calls `exit 1`, so indeed the `continue` will never be reached: https://github.com/axodotdev/cargo-dist/blob/2c0f30bc3c628f285542d44cef778f0c8e17e19f/cargo-dist/templates/installer/installer.sh.j2#L659-L668

Removing that `continue` makes shellcheck happy and the tests pass. I can make a PR for removing it if that sounds good!

Pull request:
fix: unreachable code in installer.sh template
shellcheck rule SC2317:
https://www.shellcheck.net/wiki/SC2317

This was introduced in shellcheck 0.9.0 which explains why it wasn't seen in CI because it uses shellcheck 0.8.0 (because that's what's packaged in Ubuntu 22.04).

Fixes #344 (issue also has some more shellcheck details)

Incidentally this PR also includes some whitespace cleanup that my editor decided to perform. Let me know if that is undesired and I'll revert those!

Also, I'm not sure what `assertion_line` is or why it was removed in the updated insta snapshots?

Patch:
diff --git a/cargo-dist/templates/installer/installer.sh.j2 b/cargo-dist/templates/installer/installer.sh.j2
index 82c8f5e4..ccdb0c7a 100644
--- a/cargo-dist/templates/installer/installer.sh.j2
+++ b/cargo-dist/templates/installer/installer.sh.j2
@@ -93,7 +93,6 @@ download_binary_and_run_installer() {
                 OPTIND=1
                 if [ "${arg%%--*}" = "" ]; then
                     err "unknown option $arg"
-                    continue
                 fi
                 while getopts :hvq sub_arg "$arg"; do
                     case "$sub_arg" in
@@ -155,7 +154,7 @@ download_binary_and_run_installer() {
     say_verbose "  to $_file" 1>&2
 
     ensure mkdir -p "$_dir"
-    
+
     if ! downloader "$_url" "$_file"; then
       say "failed to download $_url"
       say "this may be a standard network error, but it may also indicate"
@@ -329,7 +328,7 @@ add_install_dir_to_path() {
         local _pretty_line="source \"$_env_script_path_expr\""
 
         # Add the env script if it doesn't already exist
-        if [ ! -f "$_env_script_path" ]; then 
+        if [ ! -f "$_env_script_path" ]; then
             say_verbose "creating $_env_script_path"
             write_env_script "$_install_dir_expr" "$_env_script_path"
         else
@@ -346,10 +345,10 @@ add_install_dir_to_path() {
         # We search for both kinds of line here just to do the right thing in more cases.
         if ! grep -F "$_robust_line" "$_rcfile" > /dev/null 2>/dev/null && \
            ! grep -F "$_pretty_line" "$_rcfile" > /dev/null 2>/dev/null
-        then 
+        then
             # If the script now exists, add the line to source it to the rcfile
             # (This will also create the rcfile if it doesn't exist)
-            if [ -f "$_env_script_path" ]; then 
+            if [ -f "$_env_script_path" ]; then
                 say_verbose "adding $_robust_line to $_rcfile"
                 ensure echo "$_robust_line" >> "$_rcfile"
                 say ""


Test patch:
diff --git a/cargo-dist/tests/snapshots/akaikatana_basic.snap b/cargo-dist/tests/snapshots/akaikatana_basic.snap
index e89ad531..013e2f70 100644
--- a/cargo-dist/tests/snapshots/akaikatana_basic.snap
+++ b/cargo-dist/tests/snapshots/akaikatana_basic.snap
@@ -90,7 +90,6 @@ download_binary_and_run_installer() {
                 OPTIND=1
                 if [ "${arg%%--*}" = "" ]; then
                     err "unknown option $arg"
-                    continue
                 fi
                 while getopts :hvq sub_arg "$arg"; do
                     case "$sub_arg" in
@@ -162,7 +161,7 @@ download_binary_and_run_installer() {
     say_verbose "  to $_file" 1>&2
 
     ensure mkdir -p "$_dir"
-    
+
     if ! downloader "$_url" "$_file"; then
       say "failed to download $_url"
       say "this may be a standard network error, but it may also indicate"
@@ -312,7 +311,7 @@ add_install_dir_to_path() {
         local _pretty_line="source \"$_env_script_path_expr\""
 
         # Add the env script if it doesn't already exist
-        if [ ! -f "$_env_script_path" ]; then 
+        if [ ! -f "$_env_script_path" ]; then
             say_verbose "creating $_env_script_path"
             write_env_script "$_install_dir_expr" "$_env_script_path"
         else
@@ -329,10 +328,10 @@ add_install_dir_to_path() {
         # We search for both kinds of line here just to do the right thing in more cases.
         if ! grep -F "$_robust_line" "$_rcfile" > /dev/null 2>/dev/null && \
            ! grep -F "$_pretty_line" "$_rcfile" > /dev/null 2>/dev/null
-        then 
+        then
             # If the script now exists, add the line to source it to the rcfile
             # (This will also create the rcfile if it doesn't exist)
-            if [ -f "$_env_script_path" ]; then 
+            if [ -f "$_env_script_path" ]; then
                 say_verbose "adding $_robust_line to $_rcfile"
                 ensure echo "$_robust_line" >> "$_rcfile"
                 say ""
diff --git a/cargo-dist/tests/snapshots/axolotlsay_basic.snap b/cargo-dist/tests/snapshots/axolotlsay_basic.snap
index 33aaca90..df128e5b 100644
--- a/cargo-dist/tests/snapshots/axolotlsay_basic.snap
+++ b/cargo-dist/tests/snapshots/axolotlsay_basic.snap
@@ -90,7 +90,6 @@ download_binary_and_run_installer() {
                 OPTIND=1
                 if [ "${arg%%--*}" = "" ]; then
                     err "unknown option $arg"
-                    continue
                 fi
                 while getopts :hvq sub_arg "$arg"; do
                     case "$sub_arg" in
@@ -162,7 +161,7 @@ download_binary_and_run_installer() {
     say_verbose "  to $_file" 1>&2
 
     ensure mkdir -p "$_dir"
-    
+
     if ! downloader "$_url" "$_file"; then
       say "failed to download $_url"
       say "this may be a standard network error, but it may also indicate"
@@ -312,7 +311,7 @@ add_install_dir_to_path() {
         local _pretty_line="source \"$_env_script_path_expr\""
 
         # Add the env script if it doesn't already exist
-        if [ ! -f "$_env_script_path" ]; then 
+        if [ ! -f "$_env_script_path" ]; then
             say_verbose "creating $_env_script_path"
             write_env_script "$_install_dir_expr" "$_env_script_path"
         else
@@ -329,10 +328,10 @@ add_install_dir_to_path() {
         # We search for both kinds of line here just to do the right thing in more cases.
         if ! grep -F "$_robust_line" "$_rcfile" > /dev/null 2>/dev/null && \
            ! grep -F "$_pretty_line" "$_rcfile" > /dev/null 2>/dev/null
-        then 
+        then
             # If the script now exists, add the line to source it to the rcfile
             # (This will also create the rcfile if it doesn't exist)
-            if [ -f "$_env_script_path" ]; then 
+            if [ -f "$_env_script_path" ]; then
                 say_verbose "adding $_robust_line to $_rcfile"
                 ensure echo "$_robust_line" >> "$_rcfile"
                 say ""
@@ -2290,4 +2289,3 @@ jobs:
         run: |
           gh release edit ${{ github.ref_name }} --draft=false
 
-
diff --git a/cargo-dist/tests/snapshots/install_path_cargo_home.snap b/cargo-dist/tests/snapshots/install_path_cargo_home.snap
index 5761720b..345d1fd8 100644
--- a/cargo-dist/tests/snapshots/install_path_cargo_home.snap
+++ b/cargo-dist/tests/snapshots/install_path_cargo_home.snap
@@ -1,6 +1,5 @@
 ---
 source: cargo-dist/tests/gallery/dist.rs
-assertion_line: 486
 expression: self.payload
 ---
 ================ installer.sh ================
@@ -91,7 +90,6 @@ download_binary_and_run_installer() {
                 OPTIND=1
                 if [ "${arg%%--*}" = "" ]; then
                     err "unknown option $arg"
-                    continue
                 fi
                 while getopts :hvq sub_arg "$arg"; do
                     case "$sub_arg" in
@@ -163,7 +161,7 @@ download_binary_and_run_installer() {
     say_verbose "  to $_file" 1>&2
 
     ensure mkdir -p "$_dir"
-    
+
     if ! downloader "$_url" "$_file"; then
       say "failed to download $_url"
       say "this may be a standard network error, but it may also indicate"
@@ -313,7 +311,7 @@ add_install_dir_to_path() {
         local _pretty_line="source \"$_env_script_path_expr\""
 
         # Add the env script if it doesn't already exist
-        if [ ! -f "$_env_script_path" ]; then 
+        if [ ! -f "$_env_script_path" ]; then
             say_verbose "creating $_env_script_path"
             write_env_script "$_install_dir_expr" "$_env_script_path"
         else
@@ -330,10 +328,10 @@ add_install_dir_to_path() {
         # We search for both kinds of line here just to do the right thing in more cases.
         if ! grep -F "$_robust_line" "$_rcfile" > /dev/null 2>/dev/null && \
            ! grep -F "$_pretty_line" "$_rcfile" > /dev/null 2>/dev/null
-        then 
+        then
             # If the script now exists, add the line to source it to the rcfile
             # (This will also create the rcfile if it doesn't exist)
-            if [ -f "$_env_script_path" ]; then 
+            if [ -f "$_env_script_path" ]; then
                 say_verbose "adding $_robust_line to $_rcfile"
                 ensure echo "$_robust_line" >> "$_rcfile"
                 say ""
diff --git a/cargo-dist/tests/snapshots/install_path_env_no_subdir.snap b/cargo-dist/tests/snapshots/install_path_env_no_subdir.snap
index 1fe4c1f4..17e18797 100644
--- a/cargo-dist/tests/snapshots/install_path_env_no_subdir.snap
+++ b/cargo-dist/tests/snapshots/install_path_env_no_subdir.snap
@@ -1,6 +1,5 @@
 ---
 source: cargo-dist/tests/gallery/dist.rs
-assertion_line: 486
 expression: self.payload
 ---
 ================ installer.sh ================
@@ -91,7 +90,6 @@ download_binary_and_run_installer() {
                 OPTIND=1
                 if [ "${arg%%--*}" = "" ]; then
                     err "unknown option $arg"
-                    continue
                 fi
                 while getopts :hvq sub_arg "$arg"; do
                     case "$sub_arg" in
@@ -163,7 +161,7 @@ download_binary_and_run_installer() {
     say_verbose "  to $_file" 1>&2
 
     ensure mkdir -p "$_dir"
-    
+
     if ! downloader "$_url" "$_file"; then
       say "failed to download $_url"
       say "this may be a standard network error, but it may also indicate"
@@ -296,7 +294,7 @@ add_install_dir_to_path() {
         local _pretty_line="source \"$_env_script_path_expr\""
 
         # Add the env script if it doesn't already exist
-        if [ ! -f "$_env_script_path" ]; then 
+        if [ ! -f "$_env_script_path" ]; then
             say_verbose "creating $_env_script_path"
             write_env_script "$_install_dir_expr" "$_env_script_path"
         else
@@ -313,10 +311,10 @@ add_install_dir_to_path() {
         # We search for both kinds of line here just to do the right thing in more cases.
         if ! grep -F "$_robust_line" "$_rcfile" > /dev/null 2>/dev/null && \
            ! grep -F "$_pretty_line" "$_rcfile" > /dev/null 2>/dev/null
-        then 
+        then
             # If the script now exists, add the line to source it to the rcfile
             # (This will also create the rcfile if it doesn't exist)
-            if [ -f "$_env_script_path" ]; then 
+            if [ -f "$_env_script_path" ]; then
                 say_verbose "adding $_robust_line to $_rcfile"
                 ensure echo "$_robust_line" >> "$_rcfile"
                 say ""
diff --git a/cargo-dist/tests/snapshots/install_path_env_subdir.snap b/cargo-dist/tests/snapshots/install_path_env_subdir.snap
index e5a6bf04..cf8b144e 100644
--- a/cargo-dist/tests/snapshots/install_path_env_subdir.snap
+++ b/cargo-dist/tests/snapshots/install_path_env_subdir.snap
@@ -1,6 +1,5 @@
 ---
 source: cargo-dist/tests/gallery/dist.rs
-assertion_line: 486
 expression: self.payload
 ---
 ================ installer.sh ================
@@ -91,7 +90,6 @@ download_binary_and_run_installer() {
                 OPTIND=1
                 if [ "${arg%%--*}" = "" ]; then
                     err "unknown option $arg"
-                    continue
                 fi
                 while getopts :hvq sub_arg "$arg"; do
                     case "$sub_arg" in
@@ -163,7 +161,7 @@ download_binary_and_run_installer() {
     say_verbose "  to $_file" 1>&2
 
     ensure mkdir -p "$_dir"
-    
+
     if ! downloader "$_url" "$_file"; then
       say "failed to download $_url"
       say "this may be a standard network error, but it may also indicate"
@@ -296,7 +294,7 @@ add_install_dir_to_path() {
         local _pretty_line="source \"$_env_script_path_expr\""
 
         # Add the env script if it doesn't already exist
-        if [ ! -f "$_env_script_path" ]; then 
+        if [ ! -f "$_env_script_path" ]; then
             say_verbose "creating $_env_script_path"
             write_env_script "$_install_dir_expr" "$_env_script_path"
         else
@@ -313,10 +311,10 @@ add_install_dir_to_path() {
         # We search for both kinds of line here just to do the right thing in more cases.
         if ! grep -F "$_robust_line" "$_rcfile" > /dev/null 2>/dev/null && \
            ! grep -F "$_pretty_line" "$_rcfile" > /dev/null 2>/dev/null
-        then 
+        then
             # If the script now exists, add the line to source it to the rcfile
             # (This will also create the rcfile if it doesn't exist)
-            if [ -f "$_env_script_path" ]; then 
+            if [ -f "$_env_script_path" ]; then
                 say_verbose "adding $_robust_line to $_rcfile"
                 ensure echo "$_robust_line" >> "$_rcfile"
                 say ""
diff --git a/cargo-dist/tests/snapshots/install_path_env_subdir_space.snap b/cargo-dist/tests/snapshots/install_path_env_subdir_space.snap
index 73c1cd21..7c5f2b98 100644
--- a/cargo-dist/tests/snapshots/install_path_env_subdir_space.snap
+++ b/cargo-dist/tests/snapshots/install_path_env_subdir_space.snap
@@ -1,6 +1,5 @@
 ---
 source: cargo-dist/tests/gallery/dist.rs
-assertion_line: 486
 expression: self.payload
 ---
 ================ installer.sh ================
@@ -91,7 +90,6 @@ download_binary_and_run_installer() {
                 OPTIND=1
                 if [ "${arg%%--*}" = "" ]; then
                     err "unknown option $arg"
-                    continue
                 fi
                 while getopts :hvq sub_arg "$arg"; do
                     case "$sub_arg" in
@@ -163,7 +161,7 @@ download_binary_and_run_installer() {
     say_verbose "  to $_file" 1>&2
 
     ensure mkdir -p "$_dir"
-    
+
     if ! downloader "$_url" "$_file"; then
       say "failed to download $_url"
       say "this may be a standard network error, but it may also indicate"
@@ -296,7 +294,7 @@ add_install_dir_to_path() {
         local _pretty_line="source \"$_env_script_path_expr\""
 
         # Add the env script if it doesn't already exist
-        if [ ! -f "$_env_script_path" ]; then 
+        if [ ! -f "$_env_script_path" ]; then
             say_verbose "creating $_env_script_path"
             write_env_script "$_install_dir_expr" "$_env_script_path"
         else
@@ -313,10 +311,10 @@ add_install_dir_to_path() {
         # We search for both kinds of line here just to do the right thing in more cases.
         if ! grep -F "$_robust_line" "$_rcfile" > /dev/null 2>/dev/null && \
            ! grep -F "$_pretty_line" "$_rcfile" > /dev/null 2>/dev/null
-        then 
+        then
             # If the script now exists, add the line to source it to the rcfile
             # (This will also create the rcfile if it doesn't exist)
-            if [ -f "$_env_script_path" ]; then 
+            if [ -f "$_env_script_path" ]; then
                 say_verbose "adding $_robust_line to $_rcfile"
                 ensure echo "$_robust_line" >> "$_rcfile"
                 say ""
diff --git a/cargo-dist/tests/snapshots/install_path_env_subdir_space_deeper.snap b/cargo-dist/tests/snapshots/install_path_env_subdir_space_deeper.snap
index 751b54b9..c78dd4d2 100644
--- a/cargo-dist/tests/snapshots/install_path_env_subdir_space_deeper.snap
+++ b/cargo-dist/tests/snapshots/install_path_env_subdir_space_deeper.snap
@@ -1,6 +1,5 @@
 ---
 source: cargo-dist/tests/gallery/dist.rs
-assertion_line: 486
 expression: self.payload
 ---
 ================ installer.sh ================
@@ -91,7 +90,6 @@ download_binary_and_run_installer() {
                 OPTIND=1
                 if [ "${arg%%--*}" = "" ]; then
                     err "unknown option $arg"
-                    continue
                 fi
                 while getopts :hvq sub_arg "$arg"; do
                     case "$sub_arg" in
@@ -163,7 +161,7 @@ download_binary_and_run_installer() {
     say_verbose "  to $_file" 1>&2
 
     ensure mkdir -p "$_dir"
-    
+
     if ! downloader "$_url" "$_file"; then
       say "failed to download $_url"
       say "this may be a standard network error, but it may also indicate"
@@ -296,7 +294,7 @@ add_install_dir_to_path() {
         local _pretty_line="source \"$_env_script_path_expr\""
 
         # Add the env script if it doesn't already exist
-        if [ ! -f "$_env_script_path" ]; then 
+        if [ ! -f "$_env_script_path" ]; then
             say_verbose "creating $_env_script_path"
             write_env_script "$_install_dir_expr" "$_env_script_path"
         else
@@ -313,10 +311,10 @@ add_install_dir_to_path() {
         # We search for both kinds of line here just to do the right thing in more cases.
         if ! grep -F "$_robust_line" "$_rcfile" > /dev/null 2>/dev/null && \
            ! grep -F "$_pretty_line" "$_rcfile" > /dev/null 2>/dev/null
-        then 
+        then
             # If the script now exists, add the line to source it to the rcfile
             # (This will also create the rcfile if it doesn't exist)
-            if [ -f "$_env_script_path" ]; then 
+            if [ -f "$_env_script_path" ]; then
                 say_verbose "adding $_robust_line to $_rcfile"
                 ensure echo "$_robust_line" >> "$_rcfile"
                 say ""
diff --git a/cargo-dist/tests/snapshots/install_path_home_subdir_deeper.snap b/cargo-dist/tests/snapshots/install_path_home_subdir_deeper.snap
index a887d9b7..3c4d4f91 100644
--- a/cargo-dist/tests/snapshots/install_path_home_subdir_deeper.snap
+++ b/cargo-dist/tests/snapshots/install_path_home_subdir_deeper.snap
@@ -1,6 +1,5 @@
 ---
 source: cargo-dist/tests/gallery/dist.rs
-assertion_line: 486
 expression: self.payload
 ---
 ================ installer.sh ================
@@ -91,7 +90,6 @@ download_binary_and_run_installer() {
                 OPTIND=1
                 if [ "${arg%%--*}" = "" ]; then
                     err "unknown option $arg"
-                    continue
                 fi
                 while getopts :hvq sub_arg "$arg"; do
                     case "$sub_arg" in
@@ -163,7 +161,7 @@ download_binary_and_run_installer() {
     say_verbose "  to $_file" 1>&2
 
     ensure mkdir -p "$_dir"
-    
+
     if ! downloader "$_url" "$_file"; then
       say "failed to download $_url"
       say "this may be a standard network error, but it may also indicate"
@@ -296,7 +294,7 @@ add_install_dir_to_path() {
         local _pretty_line="source \"$_env_script_path_expr\""
 
         # Add the env script if it doesn't already exist
-        if [ ! -f "$_env_script_path" ]; then 
+        if [ ! -f "$_env_script_path" ]; then
             say_verbose "creating $_env_script_path"
             write_env_script "$_install_dir_expr" "$_env_script_path"
         else
@@ -313,10 +311,10 @@ add_install_dir_to_path() {
         # We search for both kinds of line here just to do the right thing in more cases.
         if ! grep -F "$_robust_line" "$_rcfile" > /dev/null 2>/dev/null && \
            ! grep -F "$_pretty_line" "$_rcfile" > /dev/null 2>/dev/null
-        then 
+        then
             # If the script now exists, add the line to source it to the rcfile
             # (This will also create the rcfile if it doesn't exist)
-            if [ -f "$_env_script_path" ]; then 
+            if [ -f "$_env_script_path" ]; then
                 say_verbose "adding $_robust_line to $_rcfile"
                 ensure echo "$_robust_line" >> "$_rcfile"
                 say ""
diff --git a/cargo-dist/tests/snapshots/install_path_home_subdir_min.snap b/cargo-dist/tests/snapshots/install_path_home_subdir_min.snap
index 7288d80a..cfa2452c 100644
--- a/cargo-dist/tests/snapshots/install_path_home_subdir_min.snap
+++ b/cargo-dist/tests/snapshots/install_path_home_subdir_min.snap
@@ -1,6 +1,5 @@
 ---
 source: cargo-dist/tests/gallery/dist.rs
-assertion_line: 486
 expression: self.payload
 ---
 ================ installer.sh ================
@@ -91,7 +90,6 @@ download_binary_and_run_installer() {
                 OPTIND=1
                 if [ "${arg%%--*}" = "" ]; then
                     err "unknown option $arg"
-                    continue
                 fi
                 while getopts :hvq sub_arg "$arg"; do
                     case "$sub_arg" in
@@ -163,7 +161,7 @@ download_binary_and_run_installer() {
     say_verbose "  to $_file" 1>&2
 
     ensure mkdir -p "$_dir"
-    
+
     if ! downloader "$_url" "$_file"; then
       say "failed to download $_url"
       say "this may be a standard network error, but it may also indicate"
@@ -296,7 +294,7 @@ add_install_dir_to_path() {
         local _pretty_line="source \"$_env_script_path_expr\""
 
         # Add the env script if it doesn't already exist
-        if [ ! -f "$_env_script_path" ]; then 
+        if [ ! -f "$_env_script_path" ]; then
             say_verbose "creating $_env_script_path"
             write_env_script "$_install_dir_expr" "$_env_script_path"
         else
@@ -313,10 +311,10 @@ add_install_dir_to_path() {
         # We search for both kinds of line here just to do the right thing in more cases.
         if ! grep -F "$_robust_line" "$_rcfile" > /dev/null 2>/dev/null && \
            ! grep -F "$_pretty_line" "$_rcfile" > /dev/null 2>/dev/null
-        then 
+        then
             # If the script now exists, add the line to source it to the rcfile
             # (This will also create the rcfile if it doesn't exist)
-            if [ -f "$_env_script_path" ]; then 
+            if [ -f "$_env_script_path" ]; then
                 say_verbose "adding $_robust_line to $_rcfile"
                 ensure echo "$_robust_line" >> "$_rcfile"
                 say ""
diff --git a/cargo-dist/tests/snapshots/install_path_home_subdir_space.snap b/cargo-dist/tests/snapshots/install_path_home_subdir_space.snap
index e2e3d21b..afc03ee9 100644
--- a/cargo-dist/tests/snapshots/install_path_home_subdir_space.snap
+++ b/cargo-dist/tests/snapshots/install_path_home_subdir_space.snap
@@ -1,6 +1,5 @@
 ---
 source: cargo-dist/tests/gallery/dist.rs
-assertion_line: 486
 expression: self.payload
 ---
 ================ installer.sh ================
@@ -91,7 +90,6 @@ download_binary_and_run_installer() {
                 OPTIND=1
                 if [ "${arg%%--*}" = "" ]; then
                     err "unknown option $arg"
-                    continue
                 fi
                 while getopts :hvq sub_arg "$arg"; do
                     case "$sub_arg" in
@@ -163,7 +161,7 @@ download_binary_and_run_installer() {
     say_verbose "  to $_file" 1>&2
 
     ensure mkdir -p "$_dir"
-    
+
     if ! downloader "$_url" "$_file"; then
       say "failed to download $_url"
       say "this may be a standard network error, but it may also indicate"
@@ -296,7 +294,7 @@ add_install_dir_to_path() {
         local _pretty_line="source \"$_env_script_path_expr\""
 
         # Add the env script if it doesn't already exist
-        if [ ! -f "$_env_script_path" ]; then 
+        if [ ! -f "$_env_script_path" ]; then
             say_verbose "creating $_env_script_path"
             write_env_script "$_install_dir_expr" "$_env_script_path"
         else
@@ -313,10 +311,10 @@ add_install_dir_to_path() {
         # We search for both kinds of line here just to do the right thing in more cases.
         if ! grep -F "$_robust_line" "$_rcfile" > /dev/null 2>/dev/null && \
            ! grep -F "$_pretty_line" "$_rcfile" > /dev/null 2>/dev/null
-        then 
+        then
             # If the script now exists, add the line to source it to the rcfile
             # (This will also create the rcfile if it doesn't exist)
-            if [ -f "$_env_script_path" ]; then 
+            if [ -f "$_env_script_path" ]; then
                 say_verbose "adding $_robust_line to $_rcfile"
                 ensure echo "$_robust_line" >> "$_rcfile"
                 say ""
diff --git a/cargo-dist/tests/snapshots/install_path_home_subdir_space_deeper.snap b/cargo-dist/tests/snapshots/install_path_home_subdir_space_deeper.snap
index b1e3bc16..b129dc6c 100644
--- a/cargo-dist/tests/snapshots/install_path_home_subdir_space_deeper.snap
+++ b/cargo-dist/tests/snapshots/install_path_home_subdir_space_deeper.snap
@@ -1,6 +1,5 @@
 ---
 source: cargo-dist/tests/gallery/dist.rs
-assertion_line: 486
 expression: self.payload
 ---
 ================ installer.sh ================
@@ -91,7 +90,6 @@ download_binary_and_run_installer() {
                 OPTIND=1
                 if [ "${arg%%--*}" = "" ]; then
                     err "unknown option $arg"
-                    continue
                 fi
                 while getopts :hvq sub_arg "$arg"; do
                     case "$sub_arg" in
@@ -163,7 +161,7 @@ download_binary_and_run_installer() {
     say_verbose "  to $_file" 1>&2
 
     ensure mkdir -p "$_dir"
-    
+
     if ! downloader "$_url" "$_file"; then
       say "failed to download $_url"
       say "this may be a standard network error, but it may also indicate"
@@ -296,7 +294,7 @@ add_install_dir_to_path() {
         local _pretty_line="source \"$_env_script_path_expr\""
 
         # Add the env script if it doesn't already exist
-        if [ ! -f "$_env_script_path" ]; then 
+        if [ ! -f "$_env_script_path" ]; then
             say_verbose "creating $_env_script_path"
             write_env_script "$_install_dir_expr" "$_env_script_path"
         else
@@ -313,10 +311,10 @@ add_install_dir_to_path() {
         # We search for both kinds of line here just to do the right thing in more cases.
         if ! grep -F "$_robust_line" "$_rcfile" > /dev/null 2>/dev/null && \
            ! grep -F "$_pretty_line" "$_rcfile" > /dev/null 2>/dev/null
-        then 
+        then
             # If the script now exists, add the line to source it to the rcfile
             # (This will also create the rcfile if it doesn't exist)
-            if [ -f "$_env_script_path" ]; then 
+            if [ -f "$_env_script_path" ]; then
                 say_verbose "adding $_robust_line to $_rcfile"
                 ensure echo "$_robust_line" >> "$_rcfile"
                 say ""