This commit is contained in:
array-in-a-matrix 2023-01-16 20:21:53 -05:00
parent 612a15fd5e
commit 4004ecb9e0

View file

@ -1,31 +1,22 @@
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" or argument == "dot" or argument == "d":
operation = "dot"
dot()
let args = [paramStr(0).splitPath.tail, paramStr(0), argument]
elif paramStr(0).endsWith("/cross") or paramStr(0) == "cross" or argument == "cross" or argument == "c":
operation = "cross"
if "dot" in args or "d" in args:
dot()
elif "cross" in args or "c" in args:
cross()
else:
echo "Would you like to preform the dot or cross product?"
operation = toLowerAscii(readLine(stdin))
case operation:
of "dot":
case toLowerAscii(readLine(stdin)):
of "dot", "d":
dot()
of "d":
dot()
of "cross":
cross()
of "c":
of "cross", "c":
cross()
else:
quit "Invalid operation!", QuitFailure