markdown · 2337 bytes Raw Blame History

fgof-lineedit

Fortran-native line editing helpers for interactive CLI tools.

fgof-lineedit is intended to be a small, standalone library that gives Fortran shells, REPLs, and interactive CLIs a friendlier editing surface than raw terminal reads.

It is part of the FortranGoingOnForty lib-modules catalog, but it is intended to stand on its own as a normal fpm package.

Current v1 target:

  • editable line buffer and cursor model
  • prompt handling and rendered line state
  • history navigation and history storage hooks
  • completion and key-handling integration points
  • clean boundaries with future fgof-termios and fgof-keys

Future scope:

  • richer readline-style editing commands
  • completion engines and menu UIs
  • prompt widgets and multi-line editing

Status

Initial scaffold is in place.

Implemented today:

  • public fgof_lineedit and fgof_lineedit_types modules
  • line editor and prompt-state types
  • prompt constructor and basic reset helper
  • smoke-test coverage and CI wiring

Still to implement:

  • editable buffer operations
  • history and completion hooks
  • terminal integration and redraw behavior

Why Use It

  • line editing is repeatedly hand-built in shells, REPLs, and text tools
  • the Fortran ecosystem still lacks an obvious small default package here
  • it is meant to compose cleanly with fgof-pty, future fgof-termios, and future fgof-keys

Public API Shape

Primary modules:

  • fgof_lineedit
  • fgof_lineedit_types

Public types:

  • lineedit_state
  • prompt_spec

Current public procedures:

  • default_prompt
  • init_lineedit
  • reset_lineedit

Quick Start

program demo_lineedit
  use fgof_lineedit, only : default_prompt, init_lineedit, lineedit_state
  implicit none

  type(lineedit_state) :: editor

  call init_lineedit(editor, default_prompt("> "))
  print "(A)", editor%prompt%text
end program demo_lineedit

Build And Test

fpm test

That is the baseline verification command locally and in CI.

Supported Platforms

  • macOS
  • Linux

Boundaries

  • intended to stay independently versioned and releasable
  • focused on editing state and library ergonomics, not full shell implementation
  • terminal-mode control should stay in a future companion package

License

MIT

View source
1 # fgof-lineedit
2
3 Fortran-native line editing helpers for interactive CLI tools.
4
5 `fgof-lineedit` is intended to be a small, standalone library that gives Fortran shells, REPLs, and interactive CLIs a friendlier editing surface than raw terminal reads.
6
7 It is part of the [FortranGoingOnForty lib-modules](https://github.com/FortranGoingOnForty/lib-modules) catalog, but it is intended to stand on its own as a normal `fpm` package.
8
9 Current v1 target:
10
11 - editable line buffer and cursor model
12 - prompt handling and rendered line state
13 - history navigation and history storage hooks
14 - completion and key-handling integration points
15 - clean boundaries with future `fgof-termios` and `fgof-keys`
16
17 Future scope:
18
19 - richer readline-style editing commands
20 - completion engines and menu UIs
21 - prompt widgets and multi-line editing
22
23 ## Status
24
25 Initial scaffold is in place.
26
27 Implemented today:
28
29 - public `fgof_lineedit` and `fgof_lineedit_types` modules
30 - line editor and prompt-state types
31 - prompt constructor and basic reset helper
32 - smoke-test coverage and CI wiring
33
34 Still to implement:
35
36 - editable buffer operations
37 - history and completion hooks
38 - terminal integration and redraw behavior
39
40 ## Why Use It
41
42 - line editing is repeatedly hand-built in shells, REPLs, and text tools
43 - the Fortran ecosystem still lacks an obvious small default package here
44 - it is meant to compose cleanly with `fgof-pty`, future `fgof-termios`, and future `fgof-keys`
45
46 ## Public API Shape
47
48 Primary modules:
49
50 - `fgof_lineedit`
51 - `fgof_lineedit_types`
52
53 Public types:
54
55 - `lineedit_state`
56 - `prompt_spec`
57
58 Current public procedures:
59
60 - `default_prompt`
61 - `init_lineedit`
62 - `reset_lineedit`
63
64 ## Quick Start
65
66 ```fortran
67 program demo_lineedit
68 use fgof_lineedit, only : default_prompt, init_lineedit, lineedit_state
69 implicit none
70
71 type(lineedit_state) :: editor
72
73 call init_lineedit(editor, default_prompt("> "))
74 print "(A)", editor%prompt%text
75 end program demo_lineedit
76 ```
77
78 ## Build And Test
79
80 ```bash
81 fpm test
82 ```
83
84 That is the baseline verification command locally and in CI.
85
86 ## Supported Platforms
87
88 - macOS
89 - Linux
90
91 ## Boundaries
92
93 - intended to stay independently versioned and releasable
94 - focused on editing state and library ergonomics, not full shell implementation
95 - terminal-mode control should stay in a future companion package
96
97 ## License
98
99 MIT