AtlatestRepositorysigil-doc
1
#lang sigil/doc/book2
@chapter["Change the Question" authors: '("David Wilson")]4
@section["Turn a Script into a Tool" id: "script-into-tool"]6
@p {7
The first version in @ref ["first-script"] {the first script} answers one8
fixed question. A practical tool becomes more valuable when its user can choose9
the question without editing source code.10
}12
@code["sigil"]13
(define state14
(if (null? (command-line))15
"TODO"16
(car (command-line))))17
@end code19
Keeping this decision near the program boundary leaves parsing, counting, and20
reporting as ordinary reusable functions. The command line selects policy; the21
rest of the script remains simple data transformation.23
@end section25
@section["Craft the Interface" id: "craft-the-interface"]27
An interface is more than argument parsing. It includes useful defaults, clear28
failure messages, and output that composes well with other tools. Sigil lets us29
add those pieces without changing languages or abandoning the compact Scheme30
core that made the first script pleasant to write.32
Prefer one obvious default before adding flags. A tool that does something33
useful with no ceremony is easier to learn and easier to automate.35
@end section36
@end chapter