|
|
|
@ -8,8 +8,6 @@ mod menu;
|
|
|
|
|
mod types;
|
|
|
|
|
mod ui;
|
|
|
|
|
|
|
|
|
|
use gopher::Type;
|
|
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
let args: Vec<String> = std::env::args().collect();
|
|
|
|
|
if args.len() < 2 {
|
|
|
|
@ -21,19 +19,30 @@ fn main() {
|
|
|
|
|
let port = args.get(2).unwrap_or(&port);
|
|
|
|
|
let selector = "/".to_string();
|
|
|
|
|
let selector = args.get(3).unwrap_or(&selector);
|
|
|
|
|
if host == "--version" || host == "-v" || host == "-version" {
|
|
|
|
|
print_version();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if host == "--help" || host == "-h" || host == "-help" {
|
|
|
|
|
print_usage();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
let mut ui = ui::UI::new();
|
|
|
|
|
let url = format!("{}:{}/1/{}", host, port, selector);
|
|
|
|
|
let url = format!("{}:{}{}", host, port, selector); // TODO: url on cmdline
|
|
|
|
|
ui.load(url);
|
|
|
|
|
ui.run();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn print_version() {
|
|
|
|
|
println!("\x1b[93;1mphetch v0.0.1-dev\x1b[m");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn print_usage() {
|
|
|
|
|
println!("\x1B[93;1musage:\x1B[0m phetch <gopher-url> # Show GopherHole at URL");
|
|
|
|
|
println!(" phetch -raw <gopher-url> # Print raw Gopher response.");
|
|
|
|
|
println!(" phetch -help # Show this screen.");
|
|
|
|
|
println!(" phetch -version # Show phetch version.");
|
|
|
|
|
println!(
|
|
|
|
|
"\x1B[93;1mUsage:\x1B[0m
|
|
|
|
|
phetch <gopher-url> # Show GopherHole at URL
|
|
|
|
|
phetch -raw <gopher-url> # Print raw Gopher response.
|
|
|
|
|
phetch -help # Show this screen.
|
|
|
|
|
phetch -version # Show phetch version."
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|