diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-03-27 23:23:43 +0000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-03-27 23:23:43 +0000 |
| commit | 7519de4e56323230d06cfc64b00df52339eb2434 (patch) | |
| tree | 87712be5ef45a6913601e729c18a67c20fee9f09 /ms | |
Add modal-shell project with .agent/ config, mode stubs, ms dispatcher,
bare repo at /site/git.terst.org/repos/modal-shell.git, and ADR-001.
Diffstat (limited to 'ms')
| -rwxr-xr-x | ms | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# ms — modal shell dispatcher +# Usage: ms [mode] +# ms list available modes +# ms <mode> enter named mode +set -euo pipefail + +MODES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/modes" && pwd)" + +if [[ $# -eq 0 ]]; then + echo "Available modes:" + for f in "$MODES_DIR"/*.sh; do + [[ "$(basename "$f")" == "base.sh" ]] && continue + printf " %s\n" "$(basename "$f" .sh)" + done + exit 0 +fi + +mode="$1" +mode_file="$MODES_DIR/${mode}.sh" + +if [[ ! -f "$mode_file" ]]; then + echo "error: unknown mode '$mode'" >&2 + echo "Run 'ms' to list available modes." >&2 + exit 1 +fi + +exec bash "$mode_file" |
