markdown · 2780 bytes Raw Blame History

Shell Profiles

Profiles tell bensch how to interact with a specific shell. They live in profiles/ as YAML files.

Profile Fields

name: bash                              # Internal identifier
display_name: "GNU Bash"                # Human-readable name

prompt_pattern: '\$ '                   # Regex to detect the shell prompt
prompt_set_command: "PS1='$ '"          # Command to set a known prompt
mode_reset_command: "set -o emacs"      # Reset to known editing mode

rc_disable:                             # How to skip rc file loading
  flags: ["--norc", "--noprofile"]      # CLI flags
  env:                                  # Environment variables
    BASH_ENV: ""

test_mode_env:                          # Extra env for cleaner test output
  FORTSH_MINIMAL_ECHO: "1"             # (shell-specific, only if needed)

history_disable:                        # Prevent history file interference
  env:
    HISTFILE: /dev/null

capabilities:                           # What features the shell supports
  readline: true
  vi_mode: true
  job_control: true
  command_completion: true
  programmable_completion: true
  coproc: true
  arrays: true
  associative_arrays: true

suites:                                 # Suite selection overrides
  skip:                                 # Suites to skip for this shell
    - "interactive/editing"
  extra:                                # Extra suites to include
    - "builtins/extended/fortsh"

Creating a Profile for a New Shell

  1. Copy profiles/generic.yaml to profiles/myshell.yaml
  2. Set the prompt_pattern to match your shell's default prompt
  3. Set prompt_set_command to a command that forces a known prompt
  4. Set mode_reset_command if the shell supports emacs/vi modes
  5. Configure rc_disable with the appropriate flags or env vars
  6. Set capabilities truthfully — tests will be skipped for missing capabilities
  7. Add any test_mode_env your shell supports for cleaner test output

Auto-Detection

When --profile is not specified, bensch detects the profile from the binary name:

Binary Profile
bash* bash
zsh* zsh
dash* dash
ksh*, mksh*, pdksh* ksh
fortsh* fortsh
anything else generic

Capability Flags

Capabilities determine which test suites run:

Capability Required For
readline Line editing, history navigation tests
vi_mode Vi editing mode tests
job_control Signal and background job tests
command_completion Tab completion tests
programmable_completion complete/compgen builtin tests
coproc Coprocess tests
arrays Indexed array tests
associative_arrays Associative array tests
View source
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 |