@@ -0,0 +1,80 @@ |
| 1 | +# Shell Profiles |
| 2 | + |
| 3 | +Profiles tell bensch how to interact with a specific shell. They live in `profiles/` as YAML files. |
| 4 | + |
| 5 | +## Profile Fields |
| 6 | + |
| 7 | +```yaml |
| 8 | +name: bash # Internal identifier |
| 9 | +display_name: "GNU Bash" # Human-readable name |
| 10 | + |
| 11 | +prompt_pattern: '\$ ' # Regex to detect the shell prompt |
| 12 | +prompt_set_command: "PS1='$ '" # Command to set a known prompt |
| 13 | +mode_reset_command: "set -o emacs" # Reset to known editing mode |
| 14 | + |
| 15 | +rc_disable: # How to skip rc file loading |
| 16 | + flags: ["--norc", "--noprofile"] # CLI flags |
| 17 | + env: # Environment variables |
| 18 | + BASH_ENV: "" |
| 19 | + |
| 20 | +test_mode_env: # Extra env for cleaner test output |
| 21 | + FORTSH_MINIMAL_ECHO: "1" # (shell-specific, only if needed) |
| 22 | + |
| 23 | +history_disable: # Prevent history file interference |
| 24 | + env: |
| 25 | + HISTFILE: /dev/null |
| 26 | + |
| 27 | +capabilities: # What features the shell supports |
| 28 | + readline: true |
| 29 | + vi_mode: true |
| 30 | + job_control: true |
| 31 | + command_completion: true |
| 32 | + programmable_completion: true |
| 33 | + coproc: true |
| 34 | + arrays: true |
| 35 | + associative_arrays: true |
| 36 | + |
| 37 | +suites: # Suite selection overrides |
| 38 | + skip: # Suites to skip for this shell |
| 39 | + - "interactive/editing" |
| 40 | + extra: # Extra suites to include |
| 41 | + - "builtins/extended/fortsh" |
| 42 | +``` |
| 43 | + |
| 44 | +## Creating a Profile for a New Shell |
| 45 | + |
| 46 | +1. Copy `profiles/generic.yaml` to `profiles/myshell.yaml` |
| 47 | +2. Set the `prompt_pattern` to match your shell's default prompt |
| 48 | +3. Set `prompt_set_command` to a command that forces a known prompt |
| 49 | +4. Set `mode_reset_command` if the shell supports emacs/vi modes |
| 50 | +5. Configure `rc_disable` with the appropriate flags or env vars |
| 51 | +6. Set `capabilities` truthfully — tests will be skipped for missing capabilities |
| 52 | +7. Add any `test_mode_env` your shell supports for cleaner test output |
| 53 | + |
| 54 | +## Auto-Detection |
| 55 | + |
| 56 | +When `--profile` is not specified, bensch detects the profile from the binary name: |
| 57 | + |
| 58 | +| Binary | Profile | |
| 59 | +|--------|---------| |
| 60 | +| `bash*` | bash | |
| 61 | +| `zsh*` | zsh | |
| 62 | +| `dash*` | dash | |
| 63 | +| `ksh*`, `mksh*`, `pdksh*` | ksh | |
| 64 | +| `fortsh*` | fortsh | |
| 65 | +| anything else | generic | |
| 66 | + |
| 67 | +## Capability Flags |
| 68 | + |
| 69 | +Capabilities determine which test suites run: |
| 70 | + |
| 71 | +| Capability | Required For | |
| 72 | +|------------|-------------| |
| 73 | +| `readline` | Line editing, history navigation tests | |
| 74 | +| `vi_mode` | Vi editing mode tests | |
| 75 | +| `job_control` | Signal and background job tests | |
| 76 | +| `command_completion` | Tab completion tests | |
| 77 | +| `programmable_completion` | `complete`/`compgen` builtin tests | |
| 78 | +| `coproc` | Coprocess tests | |
| 79 | +| `arrays` | Indexed array tests | |
| 80 | +| `associative_arrays` | Associative array tests | |