Skip to content

Instantly share code, notes, and snippets.

@abdulwahidgul24085
Created May 11, 2026 16:08
Show Gist options
  • Select an option

  • Save abdulwahidgul24085/c789ca54dee74948399d2c9889704e1a to your computer and use it in GitHub Desktop.

Select an option

Save abdulwahidgul24085/c789ca54dee74948399d2c9889704e1a to your computer and use it in GitHub Desktop.
pis zsh helper for concise terminal command summaries/code
# Minimal pi command/code helper
pis() {
local model="opencode/big-pickle"
local mode="summary_code"
local system_prompt=""
local query=()
if [[ "$1" == "--help" || "$1" == "-h" || $# -eq 0 ]]; then
cat <<'EOF'
Usage:
pis [-c|-s] [--model MODEL|-m MODEL] "request"
Flags:
-c Code only: return only the minimal code example.
-s Summary only: return only a very brief summary.
Default:
Returns a very brief summary and a minimal code example.
Default model:
opencode/big-pickle
Examples:
pis "how to connect scp with ssh_config"
pis -c "how to connect scp with ssh_config"
pis -s "how to connect scp with ssh_config"
pis --model openai/gpt-4o "how to connect scp with ssh_config"
pis -m anthropic/claude-sonnet-4-5 -c "tar a directory"
Change/list models:
pi --list-models
pi --model openai/gpt-4o
Interactive model switching:
pi
/model
Scoped model cycling:
pi --models "opencode/*,openai/gpt-4o"
# then use Ctrl+P inside pi
EOF
return 0
fi
while [[ $# -gt 0 ]]; do
case "$1" in
-c)
mode="code"
shift
;;
-s)
mode="summary"
shift
;;
--model|-m)
model="$2"
shift 2
;;
--)
shift
query+=("$@")
break
;;
*)
query+=("$1")
shift
;;
esac
done
case "$mode" in
code)
system_prompt="You answer terminal-command questions. Prefer local docs: man <command>, <command> --help, or shell help for builtins. Do not invent flags. Return only the minimal command/code example. No summary. No extra explanation."
;;
summary)
system_prompt="You answer terminal-command questions. Prefer local docs: man <command>, <command> --help, or shell help for builtins. Do not invent flags. Return only a very brief summary. No code. No extra explanation."
;;
*)
system_prompt="You answer terminal-command questions. Prefer local docs: man <command>, <command> --help, or shell help for builtins. Do not invent flags. Return only a very brief summary and a minimal command example. No extra explanation."
;;
esac
pi --model "$model" \
--system-prompt "$system_prompt" \
-p "${query[*]}"
}
@abdulwahidgul24085

Copy link
Copy Markdown
Author

Example

~ pis -s "How does devcontainers work in vscode?"
Dev Containers (formerly Remote - Containers) in VS Code let you define and use a Docker container as your full development environment. Here's the gist:

  1. Configuration: You place a .devcontainer/devcontainer.json file in your project, specifying a base image (e.g., mcr.microsoft.com/devcontainers/python), a Dockerfile, or a Docker Compose file. You can also list VS Code extensions, settings, post-create commands, forwarded ports, etc.

  2. Opening: VS Code's Dev Containers extension (or the built-in "Reopen in Container" command) builds/launches the container, mounts your project folder into it, and starts the VS Code Server inside the container.

  3. Experience: You get a full VS Code UI, but the editor, terminal, debugger, language servers, and extensions all run inside the container. The file system, tools, and dependencies are isolated from your host machine.

  4. Benefits: Teams get identical dev environments, no "works on my machine" issues, dependencies stay sandboxed, and you can use any Linux-based toolchain regardless of your host OS.

  5. Under the hood: It uses Docker (or Podman) under the hood. The container runs persistently until you close the window or rebuild. Settings, env vars, and mounts are all defined in devcontainer.json.

That's essentially it – a containerized, reproducible, portable dev environment powered by VS Code's remote server architecture.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment