3.3 KiB
iganaq OCaml
This is the OCaml implementation of the iganaq prototype. See the root README for the general description.
Configuration parser
Grammar v0.2:
assignment = { space }, key, { space }, equal, [ space ], value
key = letter, { letter | digit | "_" }, equal
value = valuable, { " " | valuable }, break
valuable = ( letter | digit | "_" | "-" | "~" | "/" ), { valuable }
equal = "="
break = "\n"
space = " " | "\t"
Written using the ISO 14977 EBNF Notation https://www.cl.cam.ac.uk/~mgk25/iso-14977.pdf. In this grammar, digit implies decimal digit.
Spaces between the key and the = operator are lexed but meaningless. Spaces between the = operator and the first non-space character of the value are lexed and considered as part of the value. Spaces before the key and between the value and the newline are not lexed.
- Note: non-terminals
keyandvalueare ambiguous.- Resolved by specifying what character terminates each
See also:
Task list
-
Comparison of BNF notations: https://www.cs.man.ac.uk/~pjj/bnf/ebnf.html
-
W3C ABNF Notation: https://www.w3.org/Notation.html
-
IETF RFC 5234 ABNF Notation (replaces 4234, 2234): https://www.rfc-editor.org/rfc/rfc5234
-
Spec requirements integration test coverage
- Add log function
- Output begins with
[log] - Only prints if
DEBUGis set
- Output begins with
- Add interactive pkg tests (INS v0 B2.5)
- Get su command from
$XDG_CONFIG_HOME/tori/tori.conf- Default to
su -c - Validation
- Valid path or in
PATH - Executability
trueexits with status 0 (see note 3)
- Valid path or in
- Default to
- Add logging
- Logs only if DEBUG is set
- Print each command executed, not just package names
- Case with no packages provided
- Prints a message
- MUST NOT run any system commands
- Get su command from
- Unrecognized command: exit code 1
- Command
user: print the output ofwhoami - Command
os: print the OS name- log the contents of /etc/os-release
- Add log function
-
Refactorings
- Simplify and analyze
System.File - Simplify Reader
- Simplify and analyze
-
Additionals
- Create interface files
- Expand unit tests coverage
- Try out doc generation
-
Check out
Notes
- INS = Iganaq Napkin Spec: https://brew.bsd.cafe/tori/iganaq#specification
- INS v0 B2.5 "MUST NOT run any system commands" is only testable if we wrap command execution properly in e.g. a list containing all executed commands and ensure no command is ever executed without being appended to it
- INS v0 A3.4 "running 'true' with exit code 0" requires the user to input their password every time. This should be dropped from the spec instead
- INS v0.1 changes requirement B2.3 to "MUST print the OS name and MUST log contents of /etc/os-release" in order to make the logging function testable without user input
- As per item 3 above, INS v0.2 drops "run 'true' with exit code 0" from A3.4