common: use -h instead of -help

This doesn't really matter that much as unrecognized options will still
trigger a help message to be printed, but -h is much more standard so
lets make the predictable choice here while sticking to only single '-'
flags.
This commit is contained in:
Isaac Freund 2021-11-01 00:34:15 +01:00
parent 4cee1fb881
commit f2cf4b9455
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11
6 changed files with 12 additions and 12 deletions

View File

@ -20,7 +20,7 @@ utility may be used to communicate with river over these protocols.
# OPTIONS # OPTIONS
*-help* *-h*
Print a help message and exit. Print a help message and exit.
*-version* *-version*

View File

@ -15,7 +15,7 @@ over the Wayland protocol.
# OPTIONS # OPTIONS
*-help* *-h*
Print a help message and exit. Print a help message and exit.
*-version* *-version*

View File

@ -17,7 +17,7 @@ modified while rivertile is running with the help of *riverctl*(1).
# OPTIONS # OPTIONS
*-help* *-h*
Print a help message and exit. Print a help message and exit.
*-version* *-version*

View File

@ -31,7 +31,7 @@ const Server = @import("Server.zig");
const usage: []const u8 = const usage: []const u8 =
\\usage: river [options] \\usage: river [options]
\\ \\
\\ -help Print this help message and exit. \\ -h Print this help message and exit.
\\ -version Print the version number and exit. \\ -version Print the version number and exit.
\\ -c <command> Run `sh -c <command>` on startup. \\ -c <command> Run `sh -c <command>` on startup.
\\ -log-level <level> Set the log level to error, warning, info, or debug. \\ -log-level <level> Set the log level to error, warning, info, or debug.
@ -44,7 +44,7 @@ pub fn main() anyerror!void {
// This line is here because of https://github.com/ziglang/zig/issues/7807 // This line is here because of https://github.com/ziglang/zig/issues/7807
const argv: [][*:0]const u8 = os.argv; const argv: [][*:0]const u8 = os.argv;
const result = flags.parse(argv[1..], &[_]flags.Flag{ const result = flags.parse(argv[1..], &[_]flags.Flag{
.{ .name = "-help", .kind = .boolean }, .{ .name = "-h", .kind = .boolean },
.{ .name = "-version", .kind = .boolean }, .{ .name = "-version", .kind = .boolean },
.{ .name = "-c", .kind = .arg }, .{ .name = "-c", .kind = .arg },
.{ .name = "-log-level", .kind = .arg }, .{ .name = "-log-level", .kind = .arg },
@ -52,7 +52,7 @@ pub fn main() anyerror!void {
try io.getStdErr().writeAll(usage); try io.getStdErr().writeAll(usage);
os.exit(1); os.exit(1);
}; };
if (result.boolFlag("-help")) { if (result.boolFlag("-h")) {
try io.getStdOut().writeAll(usage); try io.getStdOut().writeAll(usage);
os.exit(0); os.exit(0);
} }

View File

@ -30,7 +30,7 @@ const flags = @import("flags");
const usage = const usage =
\\usage: riverctl [options] <command> \\usage: riverctl [options] <command>
\\ \\
\\ -help Print this help message and exit. \\ -h Print this help message and exit.
\\ -version Print the version number and exit. \\ -version Print the version number and exit.
\\ \\
\\Complete documentation of the recognized commands may be found in \\Complete documentation of the recognized commands may be found in
@ -67,13 +67,13 @@ fn _main() !void {
// This line is here because of https://github.com/ziglang/zig/issues/7807 // This line is here because of https://github.com/ziglang/zig/issues/7807
const argv: [][*:0]const u8 = os.argv; const argv: [][*:0]const u8 = os.argv;
const result = flags.parse(argv[1..], &[_]flags.Flag{ const result = flags.parse(argv[1..], &[_]flags.Flag{
.{ .name = "-help", .kind = .boolean }, .{ .name = "-h", .kind = .boolean },
.{ .name = "-version", .kind = .boolean }, .{ .name = "-version", .kind = .boolean },
}) catch { }) catch {
try io.getStdErr().writeAll(usage); try io.getStdErr().writeAll(usage);
os.exit(1); os.exit(1);
}; };
if (result.boolFlag("-help")) { if (result.boolFlag("-h")) {
try io.getStdOut().writeAll(usage); try io.getStdOut().writeAll(usage);
os.exit(0); os.exit(0);
} }

View File

@ -51,7 +51,7 @@ const flags = @import("flags");
const usage = const usage =
\\usage: rivertile [options] \\usage: rivertile [options]
\\ \\
\\ -help Print this help message and exit. \\ -h Print this help message and exit.
\\ -version Print the version number and exit. \\ -version Print the version number and exit.
\\ -view-padding Set the padding around views in pixels. (Default 6) \\ -view-padding Set the padding around views in pixels. (Default 6)
\\ -outer-padding Set the padding around the edge of the layout area in \\ -outer-padding Set the padding around the edge of the layout area in
@ -314,7 +314,7 @@ pub fn main() !void {
// https://github.com/ziglang/zig/issues/7807 // https://github.com/ziglang/zig/issues/7807
const argv: [][*:0]const u8 = os.argv; const argv: [][*:0]const u8 = os.argv;
const result = flags.parse(argv[1..], &[_]flags.Flag{ const result = flags.parse(argv[1..], &[_]flags.Flag{
.{ .name = "-help", .kind = .boolean }, .{ .name = "-h", .kind = .boolean },
.{ .name = "-version", .kind = .boolean }, .{ .name = "-version", .kind = .boolean },
.{ .name = "-view-padding", .kind = .arg }, .{ .name = "-view-padding", .kind = .arg },
.{ .name = "-outer-padding", .kind = .arg }, .{ .name = "-outer-padding", .kind = .arg },
@ -325,7 +325,7 @@ pub fn main() !void {
try std.io.getStdErr().writeAll(usage); try std.io.getStdErr().writeAll(usage);
os.exit(1); os.exit(1);
}; };
if (result.boolFlag("-help")) { if (result.boolFlag("-h")) {
try std.io.getStdOut().writeAll(usage); try std.io.getStdOut().writeAll(usage);
os.exit(0); os.exit(0);
} }