feat: add metadata to all commands

This commit is contained in:
CJ van den Berg 2024-09-17 22:58:35 +02:00
parent bdd16f43fb
commit d75dcd7b84
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
13 changed files with 221 additions and 6 deletions

View file

@ -572,25 +572,30 @@ const cmds_ = struct {
const Ctx = command.Context;
const Result = command.Result;
pub fn @"w"(self: *Self, _: Ctx) Result {
pub fn w(self: *Self, _: Ctx) Result {
try self.cmd("save_file", .{});
}
pub const w_meta = .{ .description = "w (write file)" };
pub fn @"q"(self: *Self, _: Ctx) Result {
pub fn q(self: *Self, _: Ctx) Result {
try self.cmd("quit", .{});
}
pub const q_meta = .{ .description = "w (quit)" };
pub fn @"q!"(self: *Self, _: Ctx) Result {
try self.cmd("quit_without_saving", .{});
}
pub const @"q!_meta" = .{ .description = "q! (quit without saving)" };
pub fn @"wq"(self: *Self, _: Ctx) Result {
pub fn wq(self: *Self, _: Ctx) Result {
try self.cmd("save_file", .{});
try self.cmd("quit", .{});
}
pub const wq_meta = .{ .description = "wq (write file and quit)" };
pub fn @"wq!"(self: *Self, _: Ctx) Result {
self.cmd("save_file", .{}) catch {};
try self.cmd("quit_without_saving", .{});
}
pub const @"wq!_meta" = .{ .description = "wq! (write file and quit without saving)" };
};