From 10b4c8adf142f06fc184b4e813e3888f66d9c080 Mon Sep 17 00:00:00 2001 From: dvkt Date: Sat, 4 Jan 2020 11:40:30 -0800 Subject: [PATCH] -l to quick connect to a local gopher server --- README.md | 1 + src/main.rs | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 857eee2..f4c3c1b 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ the gophersphere. phetch launch and show start page phetch open gopher url phetch -r, --raw print raw gopher response + phetch -l, --local connect to 127.0.0.1:7070 phetch -h, --help show this screen phetch -v, --version show phetch version diff --git a/src/main.rs b/src/main.rs index a6c6715..dcdfa23 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,7 +7,7 @@ fn main() { fn run() -> i32 { let args: Vec = std::env::args().collect(); - let url = if args.len() < 2 { + let mut url = if args.len() < 2 { "gopher://phetch/1/home" } else { args.get(1).unwrap() @@ -24,6 +24,10 @@ fn run() -> i32 { } } + if url == "--local" || url == "-l" || url == "-local" { + url = "gopher://127.0.0.1:7070"; + } + if url == "--version" || url == "-v" || url == "-version" { print_version(); return 0; @@ -59,6 +63,7 @@ fn print_usage() { phetch launch and show start page phetch open gopherhole at url phetch -r, --raw print raw gopher response + phetch -l, --local connect to 127.0.0.1:7070 phetch -h, --help show this screen phetch -v, --version show phetch version