Repository: envio-cli/envio (language: rust)

Issue:
Invalid setenv.sh generated
Hi there!

I started using envio for around 10 profiles and got this bug.

**Describe the bug**

Sometimes, calling `envio load` will alter setenv.sh in a way that the end of the file is invalid.
So when I reload my shell, an error pops out.

Example:
```bash
# file start skipped

    if [ $? -ne 0 ]; then
        echo "Failed to load environment variables from temp file"
        exit 1
    fi

    rm "$TMP_FILE"
fi
"
fi
```

**To Reproduce**
Steps to reproduce the behavior, without reloading my shell:
1. `envio unload`
2. `envio load xxxxxxxxxxxxx` 
3. `envio load yyyyyyyyyyyyyyyyyy`
4. `envio load xxxxxxxxxxxxx`
5. setenv.sh has now invalid content at the end (`"` and `fi`)

**Expected behavior**
envio does generate a valid script on each `load`

**Device (please complete the following information):**
 - OS: macOS 14.3.1 (23D60) on Apple M1 MacBook Air 2020
 - Shell: GNU bash, version 3.2.57(1)-release (arm64-apple-darwin23)
 - CLI Version: 0.5.1




Discussion / hints:

Fix patch:
diff --git a/src/lib.rs b/src/lib.rs
index 300e721..f3df93b 100755
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -598,6 +598,7 @@ pub fn create_shellscript(profile: &str) {
 
     let mut file = if let Ok(e) = std::fs::OpenOptions::new()
         .write(true)
+        .truncate(true)
         .append(false)
         .open(shellscript_path)
     {


Test patch: