mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-18 09:46:07 +03:00
45 lines
1.2 KiB
Zig
45 lines
1.2 KiB
Zig
const std = @import("std");
|
|
const args = @import("args.zig");
|
|
const Action = @import("ghostty.zig").Action;
|
|
const Allocator = std.mem.Allocator;
|
|
const helpgen_actions = @import("../input/helpgen_actions.zig");
|
|
|
|
pub const Options = struct {
|
|
/// If `true`, print out documentation about the action associated with the
|
|
/// keybinds.
|
|
docs: bool = false,
|
|
|
|
pub fn deinit(self: Options) void {
|
|
_ = self;
|
|
}
|
|
|
|
/// Enables `-h` and `--help` to work.
|
|
pub fn help(self: Options) !void {
|
|
_ = self;
|
|
return Action.help_error;
|
|
}
|
|
};
|
|
|
|
/// The `list-actions` command is used to list all the available keybind
|
|
/// actions for Ghostty. These are distinct from the CLI Actions which can
|
|
/// be listed via `+help`
|
|
///
|
|
/// Flags:
|
|
///
|
|
/// * `--docs`: will print out the documentation for each action.
|
|
pub fn run(alloc: Allocator) !u8 {
|
|
var opts: Options = .{};
|
|
defer opts.deinit();
|
|
|
|
{
|
|
var iter = try args.argsIterator(alloc);
|
|
defer iter.deinit();
|
|
try args.parse(Options, alloc, &opts, &iter);
|
|
}
|
|
|
|
const stdout = std.io.getStdOut().writer();
|
|
try helpgen_actions.generate(stdout, .plaintext, opts.docs, std.heap.page_allocator);
|
|
|
|
return 0;
|
|
}
|