docs: add rivertile man page
This commit is contained in:
parent
e2c034b76a
commit
751760287c
3 changed files with 59 additions and 6 deletions
|
@ -217,6 +217,7 @@ const ScdocStep = struct {
|
|||
const scd_paths = [_][]const u8{
|
||||
"doc/river.1.scd",
|
||||
"doc/riverctl.1.scd",
|
||||
"doc/rivertile.1.scd",
|
||||
"doc/river-layouts.1.scd",
|
||||
};
|
||||
|
||||
|
|
38
doc/rivertile.1.scd
Normal file
38
doc/rivertile.1.scd
Normal file
|
@ -0,0 +1,38 @@
|
|||
RIVERTILE(1) "github.com/ifreund/river" "General Commands Manual"
|
||||
|
||||
# NAME
|
||||
|
||||
rivertile - tiled layout generator for river
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
*rivertile* *left*|*right*|*top*|*bottom* [args passed by river]
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
*rivertile* is a layout generator for river. It produces tiled layouts with
|
||||
split master/secondary stacks in four configurable orientations.
|
||||
|
||||
# OPTIONS
|
||||
|
||||
*left*
|
||||
Place the master stack on the left side of the output.
|
||||
|
||||
*right*
|
||||
Place the master stack on the right side of the output.
|
||||
|
||||
*top*
|
||||
Place the master stack at the top of the output.
|
||||
|
||||
*bottom*
|
||||
Place the master stack at the bottom of the output.
|
||||
|
||||
# EXAMPLE
|
||||
|
||||
Set river's layout to *rivertile*'s *left* layout using riverctl
|
||||
|
||||
riverctl layout rivertile left
|
||||
|
||||
# SEE ALSO
|
||||
|
||||
*river-layouts*(7), *river*(1), *riverctl*(1)
|
|
@ -45,13 +45,17 @@ const Orientation = enum {
|
|||
/// | | |
|
||||
/// +-----------------------+------------+
|
||||
pub fn main() !void {
|
||||
const args = std.os.argv;
|
||||
if (args.len != 7) printUsageAndExit();
|
||||
|
||||
// first arg must be left, right, top, or bottom
|
||||
const master_location = std.meta.stringToEnum(Orientation, std.mem.spanZ(std.os.argv[1])).?;
|
||||
const master_location = std.meta.stringToEnum(Orientation, std.mem.spanZ(args[1])) orelse
|
||||
printUsageAndExit();
|
||||
|
||||
// the other 5 are passed by river and described in river-layouts(7)
|
||||
const num_views = try std.fmt.parseInt(u32, std.mem.spanZ(std.os.argv[2]), 10);
|
||||
const master_count = try std.fmt.parseInt(u32, std.mem.spanZ(std.os.argv[3]), 10);
|
||||
const master_factor = try std.fmt.parseFloat(f64, std.mem.spanZ(std.os.argv[4]));
|
||||
const num_views = try std.fmt.parseInt(u32, std.mem.spanZ(args[2]), 10);
|
||||
const master_count = try std.fmt.parseInt(u32, std.mem.spanZ(args[3]), 10);
|
||||
const master_factor = try std.fmt.parseFloat(f64, std.mem.spanZ(args[4]));
|
||||
|
||||
const width_arg: u32 = switch (master_location) {
|
||||
.left, .right => 5,
|
||||
|
@ -59,8 +63,8 @@ pub fn main() !void {
|
|||
};
|
||||
const height_arg: u32 = if (width_arg == 5) 6 else 5;
|
||||
|
||||
const output_width = try std.fmt.parseInt(u32, std.mem.spanZ(std.os.argv[width_arg]), 10);
|
||||
const output_height = try std.fmt.parseInt(u32, std.mem.spanZ(std.os.argv[height_arg]), 10);
|
||||
const output_width = try std.fmt.parseInt(u32, std.mem.spanZ(args[width_arg]), 10);
|
||||
const output_height = try std.fmt.parseInt(u32, std.mem.spanZ(args[height_arg]), 10);
|
||||
|
||||
const secondary_count = num_views - master_count;
|
||||
|
||||
|
@ -126,3 +130,13 @@ pub fn main() !void {
|
|||
|
||||
try stdout_buf.flush();
|
||||
}
|
||||
|
||||
fn printUsageAndExit() noreturn {
|
||||
const usage: []const u8 =
|
||||
\\Usage: rivertile left|right|top|bottom [args passed by river]
|
||||
\\
|
||||
;
|
||||
|
||||
std.debug.warn(usage, .{});
|
||||
std.os.exit(1);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue