You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
phetch/src/main.rs

40 lines
855 B
Rust

5 years ago
#![allow(unused_must_use)]
5 years ago
#![allow(unused_imports)]
5 years ago
extern crate termion;
5 years ago
use std::collections::HashMap;
use std::io::{stdin, stdout, Read, Write};
5 years ago
use std::net::TcpStream;
use termion::event::Key;
use termion::input::TermRead;
use termion::raw::IntoRawMode;
5 years ago
mod page;
mod types;
5 years ago
mod ui;
use ui::*;
5 years ago
5 years ago
fn main() {
5 years ago
let args: Vec<String> = std::env::args().collect();
if args.len() < 2 {
usage();
return;
}
5 years ago
let host = args.get(1).unwrap();
let port = String::from("70");
let selector = String::from("/");
let port = args.get(2).unwrap_or(&port);
let selector = args.get(3).unwrap_or(&selector);
5 years ago
if host == "--help" || host == "-h" || host == "-help" {
usage();
return;
}
5 years ago
}
5 years ago
fn usage() {
println!("\x1B[93;1musage:\x1B[0m ");
println!("\t$ phetch host [port [selector]]");
}