From e8cc8cd7db6d887d744e45347d1e6da9dc32e3c6 Mon Sep 17 00:00:00 2001 From: elioat Date: Sat, 10 Dec 2022 20:18:07 -0500 Subject: teeny tiny cli user interface --- src/catalogue.lil | 21 ++++++++++------- src/tmp.lil | 67 ++++++++++++++++++++++++++++++------------------------- 2 files changed, 49 insertions(+), 39 deletions(-) (limited to 'src') diff --git a/src/catalogue.lil b/src/catalogue.lil index b3eb8ba..f30dc3c 100644 --- a/src/catalogue.lil +++ b/src/catalogue.lil @@ -18,13 +18,18 @@ on entry d t do # TODO protect against wget fails end -# read in a csv, and store in memory as a table -catalogue:load_db[csv_db] +if args[2] do + url:args[2] + # read in a csv, and store in memory as a table + catalogue:load_db[csv_db] -# add a row to the table stored in memory -row.url:"https://tenforward.social" -row:table row -catalogue:entry[row catalogue] + # add a row to the table stored in memory + row.url:url + row:table row + catalogue:entry[row catalogue] -# write the updated data to csv -save_db[catalogue csv_db] + # write the updated data to csv + save_db[catalogue csv_db] +else + print["\n please pass a url as an argument\n"] +end \ No newline at end of file diff --git a/src/tmp.lil b/src/tmp.lil index 5ad150e..60fbb53 100644 --- a/src/tmp.lil +++ b/src/tmp.lil @@ -6,54 +6,54 @@ # I'm not 100% certain what I'm going to build with these features, yet, but # I will use this as a space to explore what lil has to offer. -people.name:"Alice","Sam","Thomas","Sara","Walter" -people.age:25,28,40,34,43 -people.job:"Chef","Sous Chef","Baker","Front of house","Baker" -people:table people +# people.name:"Alice","Sam","Thomas","Sara","Walter" +# people.age:25,28,40,34,43 +# people.job:"Chef","Sous Chef","Baker","Front of house","Baker" +# people:table people -t:select from people +# t:select from people -show[t] +# show[t] -s:select where ("S%m" parse name) from people +# s:select where ("S%m" parse name) from people -show[s] +# show[s] -d:select where ("Baker" = job) from people +# d:select where ("Baker" = job) from people -show[d] +# show[d] -a:select name where ("Alice" = name) from people +# a:select name where ("Alice" = name) from people -show[a] +# show[a] -w:update job:"Amazing Chef" where job = "Chef" from people +# w:update job:"Amazing Chef" where job = "Chef" from people -Show[w] +# Show[w] -l:insert name:"John" job:"Critic" age:32 into people +# l:insert name:"John" job:"Critic" age:32 into people -show[l] +# show[l] -# save:writecsv[l "sis" ","] # where sis formats the column type, here string integer string -- the other option is boolean. +# # save:writecsv[l "sis" ","] # where sis formats the column type, here string integer string -- the other option is boolean. -# write["test.csv" save] +# # write["test.csv" save] -on cons x y do - x,y -end +# on cons x y do +# x,y +# end -breakfast: insert food:("Eggs","Pancakes","Grapefruit") quantity:(3,4,1) tasty:(1,1,0) into 0 # NOTE, 0 here could also be the name of the variable, so, in this example, breakfast +# breakfast: insert food:("Eggs","Pancakes","Grapefruit") quantity:(3,4,1) tasty:(1,1,0) into 0 # NOTE, 0 here could also be the name of the variable, so, in this example, breakfast -show[breakfast] +# show[breakfast] -needle: "apple" -haystack: ("frog","apple","chicken","toadstool","apple","rice","fish") +# needle: "apple" +# haystack: ("frog","apple","chicken","toadstool","apple","rice","fish") -filter:count needle take haystack -spread_conforming:sum needle = haystack -print[filter] -print[spread_conforming] +# filter:count needle take haystack +# spread_conforming:sum needle = haystack +# print[filter] +# print[spread_conforming] # spent a good bit of time playing with lil and reviewing the docs. I am now @@ -92,8 +92,6 @@ print[spread_conforming] # t: insert food:("Eggs","Pancakes","Grapefruit") quantity:(3,4,1) tasty:(1,1,0) into 0 - - # validate that I can write a table to disk and read it back in # show[catalogue] # out:writecsv[catalogue] @@ -106,3 +104,10 @@ print[spread_conforming] # HUGE SUCCESS! +if args[2] do + url:args[2] + print[url] +else + print["\n please pass a url as an argument\n"] +end + -- cgit 1.4.1-2-gfad0