add created/modified to fmt()
Some checks failed
Generic zig build / build (push) Failing after 13m22s
Some checks failed
Generic zig build / build (push) Failing after 13m22s
This commit is contained in:
parent
ca9e5cf09c
commit
f4facdb700
1 changed files with 10 additions and 0 deletions
10
src/srf.zig
10
src/srf.zig
|
|
@ -1059,6 +1059,12 @@ pub const FormatOptions = struct {
|
||||||
/// Specify an expiration time for the data being written
|
/// Specify an expiration time for the data being written
|
||||||
expires: ?i64 = null,
|
expires: ?i64 = null,
|
||||||
|
|
||||||
|
/// Specify a created time for the data being written
|
||||||
|
created: ?i64 = null,
|
||||||
|
|
||||||
|
/// Specify a modified time for the data being written
|
||||||
|
modified: ?i64 = null,
|
||||||
|
|
||||||
/// By setting this to false, you can avoid writing any header/footer data
|
/// By setting this to false, you can avoid writing any header/footer data
|
||||||
/// and just format the record. This is useful for appending to an existing
|
/// and just format the record. This is useful for appending to an existing
|
||||||
/// srf file rather than overwriting all the data
|
/// srf file rather than overwriting all the data
|
||||||
|
|
@ -1131,6 +1137,10 @@ fn frontMatter(writer: *std.Io.Writer, options: FormatOptions) !void {
|
||||||
try writer.writeAll("#!requireeof\n");
|
try writer.writeAll("#!requireeof\n");
|
||||||
if (options.expires) |e|
|
if (options.expires) |e|
|
||||||
try writer.print("#!expires={d}\n", .{e});
|
try writer.print("#!expires={d}\n", .{e});
|
||||||
|
if (options.created) |e|
|
||||||
|
try writer.print("#!created={d}\n", .{e});
|
||||||
|
if (options.modified) |e|
|
||||||
|
try writer.print("#!modified={d}\n", .{e});
|
||||||
}
|
}
|
||||||
fn epilogue(writer: *std.Io.Writer, options: FormatOptions) !void {
|
fn epilogue(writer: *std.Io.Writer, options: FormatOptions) !void {
|
||||||
if (!options.emit_directives) return;
|
if (!options.emit_directives) return;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue