2
0
mirror of https://github.com/xvxx/phetch synced 2024-11-10 13:10:54 +00:00

start screen

This commit is contained in:
dvkt 2019-12-19 19:54:08 -08:00
parent fb025ddfcf
commit 6c2d94f186
6 changed files with 44 additions and 22 deletions

View File

@ -22,13 +22,12 @@
## usage ## usage
phetch # Launch and show start page.
phetch <gopher-url> # Show Gopherhole at URL phetch <gopher-url> # Show Gopherhole at URL
phetch -r <gopher-url> # Print raw Gopher response. phetch -r <gopher-url> # Print raw Gopher response.
phetch -h # Show this screen. phetch -h # Show this screen.
phetch -v # Show phetch version. phetch -v # Show phetch version.
Once you've launched `phetch`, use `Ctrl-H` to view the on-line help.
## installation ## installation
Binaries for Linux and Mac are available at https://github.com/dvkt/phetch/releases: Binaries for Linux and Mac are available at https://github.com/dvkt/phetch/releases:
@ -54,18 +53,11 @@ Just unzip/untar the `phetch` program into your $PATH and get going!
### basics ### basics
- [ ] download to ~/Downloads - [ ] download to ~/Downloads
gopher://zaibatsu.circumlunar.space/1/~cardboard64/ gopher://zaibatsu.circumlunar.space/1/~cardboard64/
- [ ] save history to file
- [ ] load history from file
- [ ] load most recent URL when opening without args
- [ ] ipv6 - [ ] ipv6
- [ ] flesh out help - [ ] flesh out help
### bonus ### bugs
- [ ] TLS - [ ] `open` for irc links
- [ ] fuzzy find search links - [ ] gopher lawn is truncate
- https://github.com/stewart/rff
- https://github.com/Schlechtwetterfront/fuzzy-rs
- [ ] detect SIGWINCH
- https://github.com/BurntSushi/chan-signal
## screenies ## screenies

View File

@ -5,7 +5,7 @@ use std::net::TcpStream;
use std::net::ToSocketAddrs; use std::net::ToSocketAddrs;
use std::time::Duration; use std::time::Duration;
pub const TCP_TIMEOUT_IN_SECS: u64 = 4; pub const TCP_TIMEOUT_IN_SECS: u64 = 8;
pub const TCP_TIMEOUT_DURATION: Duration = Duration::from_secs(TCP_TIMEOUT_IN_SECS); pub const TCP_TIMEOUT_DURATION: Duration = Duration::from_secs(TCP_TIMEOUT_IN_SECS);
#[derive(Copy, Clone, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]

View File

@ -3,10 +3,34 @@ pub fn lookup(name: &str) -> Option<&str> {
"" | "/" | "help" => Some(HELP), "" | "/" | "help" => Some(HELP),
"types" => Some(TYPES), "types" => Some(TYPES),
"nav" => Some(NAV), "nav" => Some(NAV),
"home" => Some(HOME),
_ => None, _ => None,
} }
} }
pub const HOME: &str = "
i
i
i / / /
i ___ (___ ___ (___ ___ (___
i| )| )|___)| | | )
i|__/ | / |__ |__ |__ | /
i|
i
i~ the quick lil gopher client ~
i
7search gopher /v2/vs gopher.floodgap.com
i
1welcome to gopherspace /gopher gopher.floodgap.com
1gopher lawn /lawn bitreich.org
i
i ~ * ~
i
1phetch help (ctrl+h) / help
hphetch homepage URL:https://github.com/dvkt/phetch
i
";
pub const HELP: &str = " pub const HELP: &str = "
i i
i i
@ -26,9 +50,9 @@ ipage up scroll page up
ipage down scroll page down ipage down scroll page down
i i
ictrl-g go to gopher url ictrl-g go to gopher url
ictrl-u show current gopher url ictrl-u show gopher url
ictrl-y copy url to clipboard ictrl-y copy url to clipboard
ictrl-r view raw version of page ictrl-r view raw source
ictrl-w toggle wide mode ictrl-w toggle wide mode
i i
i ~ * ~ i ~ * ~
@ -122,4 +146,7 @@ i
+Mirrors +Mirrors
TTelnet3270 TTelnet3270
i i
hGopher is RFC 1436
hGopher is RFC 1436 /html/rfc1436 help
i https://tools.ietf.org/html/rfc1436
"; ";

View File

@ -12,12 +12,11 @@ use ui::UI;
fn main() { fn main() {
let args: Vec<String> = std::env::args().collect(); let args: Vec<String> = std::env::args().collect();
if args.len() < 2 { let url = if args.len() < 2 {
print_usage(); "gopher://help/1/home"
return; } else {
} args.get(1).unwrap()
};
let url = args.get(1).unwrap();
if url == "--raw" || url == "-r" || url == "-raw" { if url == "--raw" || url == "-r" || url == "-raw" {
if args.len() > 2 { if args.len() > 2 {
@ -67,6 +66,7 @@ fn print_version() {
fn print_usage() { fn print_usage() {
println!( println!(
"\x1B[93;1mUsage:\x1B[0m "\x1B[93;1mUsage:\x1B[0m
phetch # Launch and show start page.
phetch <gopher-url> # Open Gopherhole at URL. phetch <gopher-url> # Open Gopherhole at URL.
phetch -r, --raw <gopher-url> # Print raw Gopher response. phetch -r, --raw <gopher-url> # Print raw Gopher response.
phetch -h, --help # Show this screen. phetch -h, --help # Show this screen.

View File

@ -1,4 +1,3 @@
use ui;
use ui::{Action, Key, View, MAX_COLS, SCROLL_LINES}; use ui::{Action, Key, View, MAX_COLS, SCROLL_LINES};
pub struct Text { pub struct Text {

View File

@ -204,6 +204,10 @@ impl UI {
let dotdir = dotdir.unwrap(); let dotdir = dotdir.unwrap();
let mut out = String::new(); let mut out = String::new();
for page in &self.pages { for page in &self.pages {
let url = page.url();
if url.starts_with("gopher://help/") {
continue;
}
out.push_str(&page.url()); out.push_str(&page.url());
out.push('\n'); out.push('\n');
} }