mirror of
https://github.com/MezzalunaWM/Whetstone.git
synced 2026-03-07 19:49:53 -05:00
add help information
This commit is contained in:
parent
86177a190e
commit
721e6bfcb3
1 changed files with 19 additions and 0 deletions
19
src/main.zig
19
src/main.zig
|
|
@ -8,6 +8,18 @@ const gpa = std.heap.c_allocator;
|
||||||
|
|
||||||
var remote: Remote = undefined;
|
var remote: Remote = undefined;
|
||||||
|
|
||||||
|
const usage =
|
||||||
|
\\Usage: whet [options]
|
||||||
|
\\
|
||||||
|
\\ Sharpen your Mezzaluna via quick iterations.
|
||||||
|
\\
|
||||||
|
\\Options:
|
||||||
|
\\ -c, --code One shot sending code to Mezzaluna
|
||||||
|
\\ -f, --follow-log Follow the log as it grows
|
||||||
|
\\ -h, --help Print this help and exit
|
||||||
|
\\
|
||||||
|
;
|
||||||
|
|
||||||
fn loop(input: bool) !void {
|
fn loop(input: bool) !void {
|
||||||
var pollfds: [2]std.posix.pollfd = undefined;
|
var pollfds: [2]std.posix.pollfd = undefined;
|
||||||
|
|
||||||
|
|
@ -70,15 +82,22 @@ pub fn main() !void {
|
||||||
// long options
|
// long options
|
||||||
code: ?[]const u8 = null,
|
code: ?[]const u8 = null,
|
||||||
@"follow-log": bool = false,
|
@"follow-log": bool = false,
|
||||||
|
help: bool = false,
|
||||||
|
|
||||||
// short-hand options
|
// short-hand options
|
||||||
pub const shorthands = .{
|
pub const shorthands = .{
|
||||||
.c = "code",
|
.c = "code",
|
||||||
.f = "follow-log",
|
.f = "follow-log",
|
||||||
|
.h = "help",
|
||||||
};
|
};
|
||||||
}, gpa, .print) catch return;
|
}, gpa, .print) catch return;
|
||||||
defer options.deinit();
|
defer options.deinit();
|
||||||
|
|
||||||
|
if (options.options.help) {
|
||||||
|
try std.fs.File.stdout().writeAll(usage);
|
||||||
|
std.process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
// connect to the compositor
|
// connect to the compositor
|
||||||
remote = Remote.init();
|
remote = Remote.init();
|
||||||
defer remote.deinit();
|
defer remote.deinit();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue