diff --git a/tests/.gitignore b/tests/.gitignore index 8884830..3fc833b 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -1,4 +1,7 @@ +# Ignore all files without extensions in any directory * -!*.nim -!*.nims -!cli/ +!*/ +!*.* + +# Don't ignore .gitignore file +!.gitignore diff --git a/tests/cli/.gitignore b/tests/cli/.gitignore deleted file mode 100644 index d48e1b0..0000000 --- a/tests/cli/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -* -!refs/* -!*.nim -!*.nims diff --git a/tests/cli/clis/config.nims b/tests/cli/clis/config.nims new file mode 100644 index 0000000..459dfc9 --- /dev/null +++ b/tests/cli/clis/config.nims @@ -0,0 +1 @@ +switch("path", "$projectDir/../../../src") diff --git a/tests/cli/clis/enumFlag.nim b/tests/cli/clis/enumFlag.nim new file mode 100644 index 0000000..adad2f4 --- /dev/null +++ b/tests/cli/clis/enumFlag.nim @@ -0,0 +1,17 @@ +import std/[strformat] +import hwylterm, hwylterm/hwylcli + +type + Color = enum + red, blue, green + +# TODO: color should be a required flag by default? + +hwylCli: + name "enumFlag" + flags: + color: + T Color + run: + echo fmt"{color=}" + assert args.len == 0 diff --git a/tests/cli/clis/posFirst.nim b/tests/cli/clis/posFirst.nim new file mode 100644 index 0000000..0dc9e95 --- /dev/null +++ b/tests/cli/clis/posFirst.nim @@ -0,0 +1,12 @@ +import std/[strformat] +import hwylterm, hwylterm/hwylcli + +hwylCli: + name "positionals" + args: + first seq[string] + second string + third string + run: + echo fmt"{first=}, {second=}, {third=}" + echo fmt"{args=}" diff --git a/tests/cli/clis/posLast.nim b/tests/cli/clis/posLast.nim new file mode 100644 index 0000000..beb61ed --- /dev/null +++ b/tests/cli/clis/posLast.nim @@ -0,0 +1,12 @@ +import std/[strformat] +import hwylterm, hwylterm/hwylcli + +hwylCli: + name "posLast" + args: + first string + second string + third seq[string] + run: + echo fmt"{first=}, {second=}, {third=}" + assert args.len == 0 diff --git a/tests/cli/clis/posLastExact.nim b/tests/cli/clis/posLastExact.nim new file mode 100644 index 0000000..027a6b2 --- /dev/null +++ b/tests/cli/clis/posLastExact.nim @@ -0,0 +1,13 @@ +import std/[strformat] +import hwylterm, hwylterm/hwylcli + +hwylCli: + name "posLast" + settings: ExactArgs + args: + first string + second string + third seq[string] + run: + echo fmt"{first=}, {second=}, {third=}" + assert args.len == 0 diff --git a/tests/cli/clis/posNoMulti.nim b/tests/cli/clis/posNoMulti.nim new file mode 100644 index 0000000..bba4c45 --- /dev/null +++ b/tests/cli/clis/posNoMulti.nim @@ -0,0 +1,13 @@ +import std/[strformat] +import hwylterm, hwylterm/hwylcli + +hwylCli: + name "positionals" + settings: ExactArgs + args: + first int + second string + third string + run: + echo fmt"{first=}, {second=}, {third=}" + assert args.len == 0