mirror of
https://github.com/xvxx/phetch
synced 2024-11-10 13:10:54 +00:00
'res
This commit is contained in:
parent
0bbaaa54f8
commit
4cd9dced3d
21
src/main.rs
21
src/main.rs
@ -9,6 +9,14 @@ use termion::event::Key;
|
|||||||
use termion::input::TermRead;
|
use termion::input::TermRead;
|
||||||
use termion::raw::IntoRawMode;
|
use termion::raw::IntoRawMode;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
struct Link<'res> {
|
||||||
|
name: &'res str,
|
||||||
|
host: &'res str,
|
||||||
|
port: &'res str,
|
||||||
|
selector: &'res str,
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let response = phetch("phkt.io", 70, "/links");
|
let response = phetch("phkt.io", 70, "/links");
|
||||||
let links = parse(&response);
|
let links = parse(&response);
|
||||||
@ -17,15 +25,7 @@ fn main() {
|
|||||||
user_input();
|
user_input();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
fn parse<'res>(response: &'res str) -> Vec<Link> {
|
||||||
struct Link<'a> {
|
|
||||||
name: &'a str,
|
|
||||||
host: &'a str,
|
|
||||||
port: &'a str,
|
|
||||||
selector: &'a str,
|
|
||||||
}
|
|
||||||
|
|
||||||
fn parse<'a>(response: &'a str) -> Vec<Link> {
|
|
||||||
let mut links: Vec<Link> = Vec::new();
|
let mut links: Vec<Link> = Vec::new();
|
||||||
let mut start = true;
|
let mut start = true;
|
||||||
let mut is_link = false;
|
let mut is_link = false;
|
||||||
@ -128,8 +128,7 @@ fn phetch(host: &str, port: i8, selector: &str) -> String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn render(buf: &str) {
|
fn render(buf: &str) {
|
||||||
let mut clear = "\x1B[2J\x1B[H";
|
let clear = ""; //"\x1B[2J\x1B[H";
|
||||||
clear = "";
|
|
||||||
print!("{}{}", clear, draw(buf));
|
print!("{}{}", clear, draw(buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user