FEATURE: h8 kubectl exec --script for multi-line commands
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
## Problem
Multi-line shell commands through `exec` are nearly impossible due to quote escaping hell. During the Grist migration, every attempt to run more than one command failed silently:
```bash
# Broken — quotes inside quotes, \$ escaping, shebangs
h8 kubectl exec pod -- sh -c '
mv /persist/home.sqlite3 /persist/home.sqlite3.bak
tar xzf /persist/backup.tar.gz -C /persist
chown grist:grist /persist/*
'
```
Ended up having to copy a script file via `kubectl cp` first, then exec it, then rm it — 3 commands where 1 should work.
## Proposal
```bash
h8 app exec grist --script '
mv /persist/home.sqlite3 /persist/home.sqlite3.bak
tar xzf /persist/backup.tar.gz -C /persist
chown grist:grist /persist/*
'
```
Implementation: write the script to a temp file, `kubectl cp` it to the pod, `kubectl exec pod -- sh /tmp/h8-script`, then `kubectl exec pod -- rm /tmp/h8-script`. All transparent to the user.
Stderr from the script should be forwarded, and exit code from the script should be the exit code of the h8 command.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.