Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

19
Task/Menu/Jq/menu-1.jq Normal file
View file

@ -0,0 +1,19 @@
def choice:
def read(prompt; max):
def __read__:
prompt,
( input as $input
| if ($input|type) == "number" and 0 < $input and $input <= max then $input
else __read__
end);
__read__;
if length == 0 then ""
else
. as $in
| ("Enter your choice:\n" +
(reduce range(0; length) as $i (""; . + "\($i + 1): \($in[$i])\n")) ) as $prompt
| read($prompt; length) as $read
| if ($read|type) == "string" then $read
else "Thank you for selecting \($in[$read-1])" end
end ;

1
Task/Menu/Jq/menu-2.jq Normal file
View file

@ -0,0 +1 @@
["fee fie", "huff and puff", "mirror mirror", "tick tock"] | choice

16
Task/Menu/Jq/menu-3.jq Normal file
View file

@ -0,0 +1,16 @@
$ jq -n -r -f Menu.jq
Enter your choice:
1: fee fie
2: huff and puff
3: mirror mirror
4: tick tock
5
Enter your choice:
1: fee fie
2: huff and puff
3: mirror mirror
4: tick tock
1
Thank you for selecting fee fie