this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

swap to gleam run instead of build so gleam.main.mjs generates

nnuuvv d2fdb55f 9bdad5d7

+34 -32
+1 -1
.forgejo/workflows/publish.yml
··· 17 17 run: git clone --branch ${{ forge.ref_name }} ${{ forge.server_url }}/${{ forge.repository }}.git 18 18 19 19 - name: Run gleam build 20 - run: cd condition_overload && gleam build 20 + run: cd condition_overload && gleam run 21 21 22 22 - name: Display build artifacts 23 23 run: ls ./condition_overload/build/dev/javascript/
+33 -31
src/condition_overload.gleam
··· 11 11 import splitter 12 12 13 13 pub fn main() { 14 - let assert Ok(search) = 14 + use search <- result.try( 15 15 argv.load().arguments 16 - |> list.reduce(fn(acc, x) { acc <> " " <> x }) 17 - as "search has to be supplied as argument" 16 + |> list.reduce(fn(acc, x) { acc <> " " <> x }), 17 + ) 18 18 let search = string.lowercase(search) 19 19 20 - [ 21 - "https://wiki.warframe.com/w/Condition_Overload_%28Mechanic%29?action=edit&section=7", 22 - "https://wiki.warframe.com/w/Condition_Overload_%28Mechanic%29?action=edit&section=8", 23 - ] 24 - |> list.map(get_gun_page_data) 25 - |> promise.await_list() 26 - |> promise.map(result.values) 27 - |> promise.map(list.flatten) 28 - |> promise.map( 29 - list.filter(_, fn(item) { 30 - item.names 31 - |> list.any(fn(name) { 32 - let lower = string.lowercase(name) 33 - string.contains(lower, search) 34 - }) 20 + Ok( 21 + [ 22 + "https://wiki.warframe.com/w/Condition_Overload_%28Mechanic%29?action=edit&section=7", 23 + "https://wiki.warframe.com/w/Condition_Overload_%28Mechanic%29?action=edit&section=8", 24 + ] 25 + |> list.map(get_gun_page_data) 26 + |> promise.await_list() 27 + |> promise.map(result.values) 28 + |> promise.map(list.flatten) 29 + |> promise.map( 30 + list.filter(_, fn(item) { 31 + item.names 32 + |> list.any(fn(name) { 33 + let lower = string.lowercase(name) 34 + string.contains(lower, search) 35 + }) 36 + }), 37 + ) 38 + |> promise.map(fn(rows) { 39 + case list.length(rows) { 40 + 0 -> io.println("\"" <> search <> "\" could not be found") 41 + _ -> { 42 + rows 43 + |> list.take(4) 44 + |> list.map(fn(x) { format_row(x) }) 45 + |> list.reduce(fn(acc, x) { acc <> " || " <> x }) 46 + |> result.map(io.println) 47 + |> result.unwrap_both() 48 + } 49 + } 35 50 }), 36 51 ) 37 - |> promise.map(fn(rows) { 38 - case list.length(rows) { 39 - 0 -> io.println("\"" <> search <> "\" could not be found") 40 - _ -> { 41 - rows 42 - |> list.take(4) 43 - |> list.map(fn(x) { format_row(x) }) 44 - |> list.reduce(fn(acc, x) { acc <> " || " <> x }) 45 - |> result.map(io.println) 46 - |> result.unwrap_both() 47 - } 48 - } 49 - }) 50 52 } 51 53 52 54 // format row into human readable string