# fedform

> Terminal form manager hosting multiple fields in a single process.
> Reads a form definition, renders labels and editable fields, manages navigation, outputs all values.
> More information: `python3 fedform.py --help`.

- Run a form from a definition file:

`python3 fedform.py {{path/to/form.def}}`

- Output field values as eval-safe shell assignments:

`eval "$(python3 fedform.py {{form.def}} -o shell 2>/dev/null)"`

- Pre-populate fields from a JSON values file:

`python3 fedform.py {{form.def}} --values {{saved.json}} -o json`

- Use a JSON definition instead of line-oriented format:

`python3 fedform.py {{form.json}} -j -o json`

- Start focus on a specific field:

`python3 fedform.py {{form.def}} -f {{field_name}}`

- Custom exit keys (only ESC cancels):

`python3 fedform.py {{form.def}} -e ESC`

- Draw on the main screen and leave the final layout in place on exit:

`python3 fedform.py {{form.def}} --no-restore`

Form definition snippets — colors, validation, locked fields, field types, screen commands:

```
DEF SAY    cyan,default
DEF COLOR  yellow,blue
DEF FOCUS  bright-white,blue

PUSH
CLS

@1,2  SAY "Customer Entry"
@3,5  SAY "First Name:"
@3,18 GET first_name LINE 25 60 --required COLOR green,default FOCUS bright-white,green
@5,5  SAY "Age:"
@5,18 GET age MASK int:3 --range 18:120
@7,5  SAY "ID:"
@7,18 GET id LINE 10 10 -v "0001" LOCKED
@9,5  SAY "Color:"
@9,18 GET pick LIST 20 4 -i "Red|Green|Blue" SELECT bright-white,red
@14,5 SAY "Plan:"
@14,18 GET plan RADIO 20 -i "Free|Pro|Enterprise" -v "Pro"

CURSOR 22,0
POP
```

Validation tokens (line-oriented or JSON): `--required`, `--range MIN:MAX`, `--in v1|v2`, `--regex PATTERN`.
