code: deduplicate command include code

This commit is contained in:
Isaac Freund 2020-07-15 12:54:36 +02:00
parent 2b2b78dd4d
commit 1389b4a850
No known key found for this signature in database
GPG key ID: 86DED400DDFD7A11

View file

@ -19,35 +19,6 @@ const std = @import("std");
const Seat = @import("Seat.zig"); const Seat = @import("Seat.zig");
const impl = struct {
const backgroundColor = @import("command/config.zig").backgroundColor;
const borderColorFocused = @import("command/config.zig").borderColorFocused;
const borderColorUnfocused = @import("command/config.zig").borderColorUnfocused;
const borderWidth = @import("command/config.zig").borderWidth;
const close = @import("command/close.zig").close;
const declareMode = @import("command/declare_mode.zig").declareMode;
const enterMode = @import("command/enter_mode.zig").enterMode;
const exit = @import("command/exit.zig").exit;
const focusOutput = @import("command/focus_output.zig").focusOutput;
const focusView = @import("command/focus_view.zig").focusView;
const layout = @import("command/layout.zig").layout;
const map = @import("command/map.zig").map;
const modMasterCount = @import("command/mod_master_count.zig").modMasterCount;
const modMasterFactor = @import("command/mod_master_factor.zig").modMasterFactor;
const outerPadding = @import("command/config.zig").outerPadding;
const sendToOutput = @import("command/send_to_output.zig").sendToOutput;
const setFocusedTags = @import("command/tags.zig").setFocusedTags;
const setViewTags = @import("command/tags.zig").setViewTags;
const spawn = @import("command/spawn.zig").spawn;
const toggleFloat = @import("command/toggle_float.zig").toggleFloat;
const toggleFocusedTags = @import("command/tags.zig").toggleFocusedTags;
const toggleFullscreen = @import("command/toggle_fullscreen.zig").toggleFullscreen;
const toggleViewTags = @import("command/tags.zig").toggleViewTags;
const viewPadding = @import("command/config.zig").viewPadding;
const xcursorTheme = @import("command/xcursor_theme.zig").xcursorTheme;
const zoom = @import("command/zoom.zig").zoom;
};
pub const Direction = enum { pub const Direction = enum {
Next, Next,
Prev, Prev,
@ -68,32 +39,32 @@ const str_to_impl_fn = [_]struct {
name: []const u8, name: []const u8,
impl: fn (*std.mem.Allocator, *Seat, []const []const u8, *?[]const u8) Error!void, impl: fn (*std.mem.Allocator, *Seat, []const []const u8, *?[]const u8) Error!void,
}{ }{
.{ .name = "background-color", .impl = impl.backgroundColor }, .{ .name = "background-color", .impl = @import("command/config.zig").backgroundColor },
.{ .name = "border-color-focused", .impl = impl.borderColorFocused }, .{ .name = "border-color-focused", .impl = @import("command/config.zig").borderColorFocused },
.{ .name = "border-color-unfocused", .impl = impl.borderColorUnfocused }, .{ .name = "border-color-unfocused", .impl = @import("command/config.zig").borderColorUnfocused },
.{ .name = "border-width", .impl = impl.borderWidth }, .{ .name = "border-width", .impl = @import("command/config.zig").borderWidth },
.{ .name = "close", .impl = impl.close }, .{ .name = "close", .impl = @import("command/close.zig").close },
.{ .name = "declare-mode", .impl = impl.declareMode }, .{ .name = "declare-mode", .impl = @import("command/declare_mode.zig").declareMode },
.{ .name = "enter-mode", .impl = impl.enterMode }, .{ .name = "enter-mode", .impl = @import("command/enter_mode.zig").enterMode },
.{ .name = "exit", .impl = impl.exit }, .{ .name = "exit", .impl = @import("command/exit.zig").exit },
.{ .name = "focus-output", .impl = impl.focusOutput }, .{ .name = "focus-output", .impl = @import("command/focus_output.zig").focusOutput },
.{ .name = "focus-view", .impl = impl.focusView }, .{ .name = "focus-view", .impl = @import("command/focus_view.zig").focusView },
.{ .name = "layout", .impl = impl.layout }, .{ .name = "layout", .impl = @import("command/layout.zig").layout },
.{ .name = "map", .impl = impl.map }, .{ .name = "map", .impl = @import("command/map.zig").map },
.{ .name = "mod-master-count", .impl = impl.modMasterCount }, .{ .name = "mod-master-count", .impl = @import("command/mod_master_count.zig").modMasterCount },
.{ .name = "mod-master-factor", .impl = impl.modMasterFactor }, .{ .name = "mod-master-factor", .impl = @import("command/mod_master_factor.zig").modMasterFactor },
.{ .name = "outer-padding", .impl = impl.outerPadding }, .{ .name = "outer-padding", .impl = @import("command/config.zig").outerPadding },
.{ .name = "send-to-output", .impl = impl.sendToOutput }, .{ .name = "send-to-output", .impl = @import("command/send_to_output.zig").sendToOutput },
.{ .name = "set-focused-tags", .impl = impl.setFocusedTags }, .{ .name = "set-focused-tags", .impl = @import("command/tags.zig").setFocusedTags },
.{ .name = "set-view-tags", .impl = impl.setViewTags }, .{ .name = "set-view-tags", .impl = @import("command/tags.zig").setViewTags },
.{ .name = "spawn", .impl = impl.spawn }, .{ .name = "spawn", .impl = @import("command/spawn.zig").spawn },
.{ .name = "toggle-float", .impl = impl.toggleFloat }, .{ .name = "toggle-float", .impl = @import("command/toggle_float.zig").toggleFloat },
.{ .name = "toggle-focused-tags", .impl = impl.toggleFocusedTags }, .{ .name = "toggle-focused-tags", .impl = @import("command/tags.zig").toggleFocusedTags },
.{ .name = "toggle-fullscreen", .impl = impl.toggleFullscreen }, .{ .name = "toggle-fullscreen", .impl = @import("command/toggle_fullscreen.zig").toggleFullscreen },
.{ .name = "toggle-view-tags", .impl = impl.toggleViewTags }, .{ .name = "toggle-view-tags", .impl = @import("command/tags.zig").toggleViewTags },
.{ .name = "view-padding", .impl = impl.viewPadding }, .{ .name = "view-padding", .impl = @import("command/config.zig").viewPadding },
.{ .name = "xcursor-theme", .impl = impl.xcursorTheme }, .{ .name = "xcursor-theme", .impl = @import("command/xcursor_theme.zig").xcursorTheme },
.{ .name = "zoom", .impl = impl.zoom }, .{ .name = "zoom", .impl = @import("command/zoom.zig").zoom },
}; };
// zig fmt: on // zig fmt: on