Merge pull request #1363 from jcollie/list-keybinds-docs

Add option to include docs when listing keybinds.
This commit is contained in:
Mitchell Hashimoto
2024-01-26 09:02:49 -08:00
committed by GitHub
2 changed files with 34 additions and 6 deletions

View File

@@ -7,15 +7,19 @@ const configpkg = @import("../config.zig");
const Config = configpkg.Config;
pub const Options = struct {
/// If true, print out the default keybinds instead of the ones
/// configured in the config file.
/// If `true`, print out the default keybinds instead of the ones configured
/// in the config file.
default: bool = false,
/// If `true`, print out documenation about the action associated with the
/// keybinds.
docs: bool = false,
pub fn deinit(self: Options) void {
_ = self;
}
/// Enables "-h" and "--help" to work.
/// Enables `-h` and `--help` to work.
pub fn help(self: Options) !void {
_ = self;
return Action.help_error;
@@ -46,7 +50,7 @@ pub fn run(alloc: Allocator) !u8 {
defer config.deinit();
const stdout = std.io.getStdOut().writer();
try config.keybind.formatEntry(configpkg.entryFormatter("keybind", stdout));
try config.keybind.formatEntryDocs(opts.docs, configpkg.entryFormatter("keybind", stdout));
return 0;
}