this repo has no description
0
fork

Configure Feed

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

add search option via program args

nnuuvv cbe11339 7b6a66f1

+45 -19
+1
gleam.toml
··· 20 20 shellout = ">= 1.7.0 and < 2.0.0" 21 21 html_parser = ">= 1.0.1 and < 2.0.0" 22 22 splitter = ">= 1.0.0 and < 2.0.0" 23 + argv = ">= 1.0.2 and < 2.0.0" 23 24 24 25 [dev-dependencies] 25 26 gleeunit = ">= 1.0.0 and < 2.0.0"
+2
manifest.toml
··· 2 2 # You typically do not need to edit this file 3 3 4 4 packages = [ 5 + { name = "argv", version = "1.0.2", build_tools = ["gleam"], requirements = [], otp_app = "argv", source = "hex", outer_checksum = "BA1FF0929525DEBA1CE67256E5ADF77A7CDDFE729E3E3F57A5BDCAA031DED09D" }, 5 6 { name = "certifi", version = "2.15.0", build_tools = ["rebar3"], requirements = [], otp_app = "certifi", source = "hex", outer_checksum = "B147ED22CE71D72EAFDAD94F055165C1C182F61A2FF49DF28BCC71D1D5B94A60" }, 6 7 { name = "gleam_erlang", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_erlang", source = "hex", outer_checksum = "F91CE62A2D011FA13341F3723DB7DB118541AAA5FE7311BD2716D018F01EF9E3" }, 7 8 { name = "gleam_hackney", version = "1.3.1", build_tools = ["gleam"], requirements = ["gleam_http", "gleam_stdlib", "hackney"], otp_app = "gleam_hackney", source = "hex", outer_checksum = "0449AADBEBF3E979509A4079EE34B92EEE4162C5A0DC94F3DA2787E4777F6B45" }, ··· 22 23 ] 23 24 24 25 [requirements] 26 + argv = { version = ">= 1.0.2 and < 2.0.0" } 25 27 gleam_hackney = { version = ">= 1.3.1 and < 2.0.0" } 26 28 gleam_http = { version = ">= 4.1.1 and < 5.0.0" } 27 29 gleam_httpc = { version = ">= 5.0.0 and < 6.0.0" }
+42 -19
src/condition_overload.gleam
··· 1 + import argv 1 2 import gleam/http/request 2 3 import gleam/httpc 3 4 import gleam/list ··· 9 10 import splitter 10 11 11 12 pub fn main() { 12 - use shell_result <- result.try( 13 - shellout.command( 14 - run: "curl", 15 - with: [ 16 - "https://wiki.warframe.com/w/Condition_Overload_(Mechanic)?action=edit&section=7", 17 - "--silent", 18 - ], 19 - in: ".", 20 - opt: [], 21 - ), 22 - ) 13 + let assert Ok(search) = 14 + argv.load().arguments 15 + |> list.first() 16 + as "search has to be supploed as argument" 17 + let search = string.lowercase(search) 18 + 19 + echo search 23 20 24 21 let _ = 25 - shell_result 26 - |> get_text_area() 27 - |> result.map(parse_text_area) 28 - |> result.unwrap([]) 29 - |> list.map(fn(x) { echo x }) 30 - //|> echo 22 + [ 23 + "https://wiki.warframe.com/w/Condition_Overload_(Mechanic)?action=edit&section=7", 24 + "https://wiki.warframe.com/w/Condition_Overload_(Mechanic)?action=edit&section=8", 25 + ] 26 + |> list.map(get_page_data) 27 + |> result.values() 28 + |> list.flatten() 29 + |> list.find(fn(item) { 30 + item.names 31 + |> list.any(fn(name) { 32 + let lower = string.lowercase(name) 33 + string.contains(lower, search) 34 + }) 35 + }) 36 + |> echo 37 + 38 + Nil 39 + } 40 + 41 + // do request and return Row if successful 42 + // 43 + fn get_page_data(url: String) -> Result(List(Row), Nil) { 44 + { 45 + use shell_result <- result.try( 46 + shellout.command(run: "curl", with: [url, "--silent"], in: ".", opt: []), 47 + ) 31 48 32 - Ok(Nil) 49 + Ok( 50 + shell_result 51 + |> get_text_area() 52 + |> result.map(parse_text_area) 53 + |> result.unwrap([]), 54 + ) 55 + } 56 + |> result.replace_error(Nil) 33 57 } 34 58 35 59 // discards the html and returns only the raw text from the textarea ··· 80 104 // |{{Weapon|Braton}}/{{Weapon|MK1-Braton|MK1}}/{{Weapon|Braton Prime|Prime}}/{{Weapon|Braton Vandal|Vandal}}||Incarnon Form AoE||AoE||74||70||95%||Adding||Listed values for Braton Prime with inactive Daring Reverie. Radial hit only receives CO bonus on target directly hit by bullet. AoE does not scale off multishot. 81 105 // 82 106 fn parse_line(line: String) -> Row { 83 - echo line 84 107 let #(names, rest) = parse_names(line, []) 85 108 86 109 let sep = splitter.new(["||"])