cli: add +boo command

Add a `+boo` command to show the animation from the website. The data
for the frames is compressed during the build process. This build step
was added to the SharedDeps object because it is used in both
libghostty and in binaries.

The compression is done as follows:
- All files are concatenated together using \x01 as a combining byte
- The files are compressed to a cached build file
- A zig file is written to stdout which `@embedFile`s the compressed
  file and exposes it to the importer
- A new anonymous module "framedata" is added in the SharedDeps object

Any file can import framedata and access the compressed bytes via
`framedata.compressed`. In the `boo` command, we decompress the file and
split it into frames for use in the animation.

The overall addition to the binary size is 348k.
This commit is contained in:
Tim Culverhouse
2025-01-08 20:58:50 -06:00
committed by Mitchell Hashimoto
parent 1121ea9d6c
commit 9cb297202b
247 changed files with 10194 additions and 9 deletions

View File

@@ -13,6 +13,7 @@ const show_config = @import("show_config.zig");
const validate_config = @import("validate_config.zig");
const crash_report = @import("crash_report.zig");
const show_face = @import("show_face.zig");
const boo = @import("boo.zig");
/// Special commands that can be invoked via CLI flags. These are all
/// invoked by using `+<action>` as a CLI flag. The only exception is
@@ -51,6 +52,9 @@ pub const Action = enum {
// List, (eventually) view, and (eventually) send crash reports.
@"crash-report",
// Boo!
boo,
pub const Error = error{
/// Multiple actions were detected. You can specify at most one
/// action on the CLI otherwise the behavior desired is ambiguous.
@@ -151,6 +155,7 @@ pub const Action = enum {
.@"validate-config" => try validate_config.run(alloc),
.@"crash-report" => try crash_report.run(alloc),
.@"show-face" => try show_face.run(alloc),
.boo => try boo.run(alloc),
};
}
@@ -186,6 +191,7 @@ pub const Action = enum {
.@"validate-config" => validate_config.Options,
.@"crash-report" => crash_report.Options,
.@"show-face" => show_face.Options,
.boo => boo.Options,
};
}
}