Skip to content

Instantly share code, notes, and snippets.

@tyom
Created August 29, 2025 11:51
Show Gist options
  • Select an option

  • Save tyom/e7b2a25373ccea26671012f5b6333030 to your computer and use it in GitHub Desktop.

Select an option

Save tyom/e7b2a25373ccea26671012f5b6333030 to your computer and use it in GitHub Desktop.
Optional 1Password CLI wrapper for op
#!/usr/bin/env sh
# op: if 1Password CLI is installed, delegate to it;
# otherwise, run the command after `--` unchanged.
if command -v op >/dev/null 2>&1; then
exec op "$@"
fi
# Skip args until `--`, then run the remainder.
while [ "$#" -gt 0 ]; do
[ "$1" = "--" ] && shift && break
shift
done
if [ "$#" -eq 0 ]; then
echo "op: nothing to run (expected -- <cmd> ...)" >&2
exit 2
fi
exec "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment