From 1076c9b34af5b185d35ca33a14dbf0fd718ed988 Mon Sep 17 00:00:00 2001 From: Julian Hurst Date: Thu, 31 Oct 2024 21:32:03 +0100 Subject: Add version flag and update README.md --- README.md | 3 ++- distamp.ha | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e0905e7..fe28c52 100644 --- a/README.md +++ b/README.md @@ -6,12 +6,13 @@ Creates discord format relative timestamps, i.e.: `` ./distamp: discord relative timestamp generator - Usage: ./distamp [-h] [-a ] [-d ] [-w ] m[:s] + Usage: ./distamp [-hv] [-a ] [-d ] [-w ] m[:s] -h: print this help text -a : Absolute date (this option is exclusive, any other options will be ignored) -d : Number of days -w : Number of weeks + -v: Print version Where m is number of minutes from now and s is number of seconds from now diff --git a/distamp.ha b/distamp.ha index 7de623a..19c3226 100644 --- a/distamp.ha +++ b/distamp.ha @@ -9,12 +9,17 @@ use getopt; type parseerror = !strconv::error; +def MAJOR = 2; +def MINOR = 0; +def PATCH = 0; + export fn main() void = { const cmd = getopt::parse(os::args, "discord relative timestamp generator", ('a', "date", "Absolute date (this option is exclusive, any other options will be ignored)"), ('d', "days", "Number of days"), ('w', "weeks", "Number of weeks"), + ('v', "Print version"), "m[:s]", ); defer getopt::finish(&cmd); @@ -57,6 +62,9 @@ export fn main() void = { case let e: parseerror => fmt::fatal(strerror(e)); }; + case 'v' => + fmt::printfln("{}.{}.{}-{}_{}", MAJOR, MINOR, PATCH, os::sysname(), os::arch_name(os::architecture()))!; + return; case => abort(); }; }; -- cgit v1.2.3