Skip to main content

Preview and confirm scripts before executing them.

Project description

hold-your-shell

hold-your-shell is a command line program (TUI) that previews shell scripts (or any shebang script) in a pager, and asks the user to confirm execution.

This single file program is written for Python 3.x and only uses the stdlib.

image

Install

Pip install:

pip install hold-your-shell

Manual install:

HY_BIN=~/.local/bin/hold-your-shell
mkdir -p $(dirname ${HY_BIN})

wget -O ${HY_BIN} https://raw.githubusercontent.com/EnigmaCurry/hold-your-shell/refs/heads/master/hold_your_shell/hold_your_shell.py

chmod +x ${HY_BIN}

Usage

  • Pipe any script to the stdin of hold-your-shell.
  • The script will be previewed on the first tab shown: Script Preview.
  • Press TAB to cycle through the other tabs, including Env Vars.
  • Use the up, down, PgUp, PgDown, j, or k keys to scroll the text.
  • Use the left, right, h, or l keys to select the action and press Enter to confirm.
    • Choose Yes to run the script.
    • Choose No to cancel and quit (default).
    • Choose Edit to open the script in your preferred $EDITOR, allowing you to customize it before running it.

Examples

Read from stdin

echo "whoami" | hold-your-shell
echo -e '#!/bin/python\nprint("Hello from Python!")' | hold-your-shell
cat <<'EOF' | hold-your-shell
echo "What is your name?"
read NAME
echo "Hello $NAME"
EOF
curl https://get.docker.com/ | hold-your-shell

Read from file

cat <<EOF > test.txt
#!/bin/env python
print("Hello from Python!")
EOF

hold-your-shell --consume test.txt

--consume will delete the input file immediately after it reads it.

Linger

echo whoami | hold-your-shell --linger

--linger will have the program remain running after completion of the script until a key is pressed.

Development

See DEVELOPMENT.md

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hold_your_shell-0.1.5.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hold_your_shell-0.1.5-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file hold_your_shell-0.1.5.tar.gz.

File metadata

  • Download URL: hold_your_shell-0.1.5.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for hold_your_shell-0.1.5.tar.gz
Algorithm Hash digest
SHA256 394e7e63a214cabc0d32d60f2459d651fcbcaa7a0cbf60650b0dc93e2cddbe6b
MD5 b70a63580fa0af4c37de5cf5f8fa9613
BLAKE2b-256 74b6bf9ad2dddb35518261da2d0bb1d84f5497354718b5ff776fc24c8a640f52

See more details on using hashes here.

Provenance

The following attestation bundles were made for hold_your_shell-0.1.5.tar.gz:

Publisher: publish.yml on EnigmaCurry/hold-your-shell

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hold_your_shell-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for hold_your_shell-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d33ff578c8684f448e266c90e0f7bdec5cfc8fdd062ed3871cf0c1ff40952161
MD5 26cf952b7afd31f3d6f26c95accb5423
BLAKE2b-256 cea742ad1462fae95591ae0d38b2ce367a1a9ea720618c38eda50a25c40909bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for hold_your_shell-0.1.5-py3-none-any.whl:

Publisher: publish.yml on EnigmaCurry/hold-your-shell

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page