September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 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