.gl syntax
A .gl file is a line-oriented script executed by gapline run. Each non-empty, non-comment line is a directive: either a session control (feed, save) or one of the main gapline commands without the -f flag.
Grammar
Section titled “Grammar”script := (line "\n")*line := comment | blank | directive [comment]comment := "#" <any char>*blank := /[ \t]*/directive := session_directive | command_directive
session_directive := "feed" path | "save" [path]
command_directive := "validate" validate_args | "read" crud_target read_args | "create" crud_target create_args | "update" crud_target update_args | "delete" crud_target delete_argsValues that contain whitespace can be double-quoted ("Gare du Nord"). Escape sequences inside quotes are not processed — the content is taken verbatim until the closing quote.
Directives
Section titled “Directives”feed <path>
Section titled “feed <path>”Loads a GTFS archive or directory into memory. Must be the first non-comment directive in the file.
feed ./data/gtfs.zipfeed /absolute/path/to/gtfs/Only one feed directive is allowed per script — the session is single-tenant.
save [path]
Section titled “save [path]”Writes the current in-memory feed back to disk atomically. Without an argument, save rewrites the path passed to feed; with an argument, it writes to that path (leaving the source untouched).
save # Overwrite the source feed.save ./data/gtfs-patched.zipsave is not implicit. A script with no save directive exits without persisting anything — the point is that .gl scripts are safe to re-run.
validate [--format FORMAT] [-o PATH]
Section titled “validate [--format FORMAT] [-o PATH]”Runs the full validation suite against the in-memory feed.
validatevalidate --format jsonvalidate --format json -o report.jsonFlags accepted: --format, -o / --output.
--min-severity and --disable-rule are not accepted inside a .gl script — pin them in gapline.toml instead. The batch runner reads the same config chain as the top-level CLI.
read <target> [-w QUERY] [--format FORMAT] [-o PATH]
Section titled “read <target> [-w QUERY] [--format FORMAT] [-o PATH]”Reads records from a GTFS file in memory.
read stopsread stops -w "stop_name LIKE Gare%"read routes --format csv -o routes.csvFlags accepted: -w / --where, --format, -o / --output.
create <target> -s KEY=VALUE [KEY=VALUE...] [--confirm]
Section titled “create <target> -s KEY=VALUE [KEY=VALUE...] [--confirm]”Inserts a new record into a GTFS file.
create stops -s stop_id=NEW_01 stop_name="Place du marché" stop_lat=45.5017 stop_lon=-73.5673 --confirm-s / --set is required. Everything after -s until the next flag is consumed as KEY=VALUE pairs.
Inside a script, --confirm is generally required — there is no interactive prompt on a non-TTY runner.
update <target> -w QUERY -s KEY=VALUE [KEY=VALUE...] [--confirm] [--cascade]
Section titled “update <target> -w QUERY -s KEY=VALUE [KEY=VALUE...] [--confirm] [--cascade]”Updates every record matching -w.
update stops -w "stop_id=S01" -s stop_name="Gare Centrale" --confirmupdate stops -w "stop_id=S01" -s stop_id=STOP_MAIN --cascade --confirmBoth -w / --where and -s / --set are required. --cascade is needed when -s rewrites a primary key.
delete <target> [-w QUERY] [--confirm]
Section titled “delete <target> [-w QUERY] [--confirm]”Removes every record matching -w. In scripts, --confirm is required — the script runner cannot prompt interactively.
delete trips -w "route_id=OLD_LINE" --confirmComments
Section titled “Comments”Lines starting with # are comments. # can also appear at the end of a directive line — everything from # to the end of the line is ignored (tokens inside a double-quoted string are not affected).
feed ./data/gtfs.zip # Loads once.
# Block comment between directives.validate --format json -o report.json # Snapshot.Execution semantics
Section titled “Execution semantics”.gl scripts are linear and stop-on-error:
- Directives execute in source order.
- The first failure aborts the script with a non-zero exit code.
- Nothing is persisted unless a
savedirective succeeded earlier in the run.
See concepts / .gl session model for the rationale.
What .gl does not support
Section titled “What .gl does not support”- Variables, substitution, interpolation. Paths and values are literal.
- Control flow. No
if, no loops, no try/catch. - Nested scripts.
runis not a directive — a.glfile cannot call another. - Sub-commands beyond the ones listed above.
rulesandcompletionare CLI-only.
Minimal example
Section titled “Minimal example”feed ./data/gtfs.zipvalidatesaveRealistic example
Section titled “Realistic example”feed ./data/gtfs.zip
delete trips --where "route_id=OLD_LINE" --confirmdelete routes --where "route_id=OLD_LINE" --confirmupdate routes --where "route_type=700" --set route_type=3 --confirm
validate --format json -o reports/weekly.json
save ./data/gtfs-patched.zipSee also
Section titled “See also”gapline run— the command that executes a script.- Concepts /
.glsession model — in-memory lifecycle andsavesemantics. - Guides / Writing
.glscripts — walkthrough from scratch.