From 88e5acec9e3db6ff5a02f2454f7c9c758cb80bad Mon Sep 17 00:00:00 2001 From: array-in-a-matrix Date: Mon, 16 Jan 2023 16:28:36 -0500 Subject: [PATCH] run calculator from cmdline args --- src/main.nim | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main.nim b/src/main.nim index 0ed18bf..8b1e7e4 100644 --- a/src/main.nim +++ b/src/main.nim @@ -1,12 +1,17 @@ import strutils, os, procedures var operation: string +var argument: string + +if paramCount() > 0: + argument = toLowerAscii(paramStr(1)) + #? if command is "dot" or "cross" preform that operation -if paramStr(0).endsWith("/dot") or paramStr(0) == "dot": +if paramStr(0).endsWith("/dot") or paramStr(0) == "dot" or argument == "dot" or argument == "d": operation = "dot" dot() -elif paramStr(0).endsWith("/cross") or paramStr(0) == "cross": +elif paramStr(0).endsWith("/cross") or paramStr(0) == "cross" or argument == "cross" or argument == "c": operation = "cross" cross() else: