#gopher #tui #terminal #cli

bin+lib phetch

小巧的 Gopher 客户端

29 个版本 (10 个稳定版)

1.2.0 2022年12月4日
1.1.0 2020年11月17日
1.0.7 2020年10月3日
1.0.3 2020年5月30日
0.1.7 2019年12月31日

#2120 in 命令行工具

Download history 9/week @ 2024-03-10 18/week @ 2024-03-31 1/week @ 2024-04-07

每月98次 下载
用于 phroxy

MIT 许可

175KB
4.5K SLoC


phetch 是一个终端客户端,旨在帮助您快速导航 Gopher 圈。


demo of phetch in action

特性

  • <1MB 可执行文件,适用于 Linux、Mac 和 NetBSD
  • 彩色设计(基于 GILD
  • 无废话的键盘导航
  • 支持 Gopher 搜索、文本和菜单页面,以及下载
  • 使用书签保存您最喜欢的 Gopher 网站
  • 可选历史记录跟踪
  • 安全 Gopher 支持(TLS)
  • 支持 Tor

使用方法

Usage:

    phetch [options]       Launch phetch in interactive mode
    phetch [options] url   Open Gopher URL in interactive mode

Options:

    -s, --tls              Try to open Gopher URLs securely w/ TLS
    -o, --tor              Use local Tor proxy to open all pages
    -S, -O                 Disable TLS or Tor

    -w, --wrap COLUMN      Wrap long lines in "text" views at COLUMN.
    -m, --media PROGRAM    Use to open media files. Default: mpv
    -M, --no-media         Just download media files, don't download
    -a, --autoplay         Autoplay media files without prompting.
    -A, --no-autoplay      Prompt before playing media files.

    -r, --raw              Print raw Gopher response only
    -p, --print            Print rendered Gopher response only
    -l, --local            Connect to 127.0.0.1:7070
    -e, --encoding         Render text documents in CP437 or UTF8.

    -c, --config FILE      Use instead of ~/.config/phetch/phetch.conf
    -C, --no-config        Don't use any config file
    -t, --theme FILE       Use FILE for color theme or print current theme.
    --print-theme          Print current theme.

    -h, --help             Show this screen
    -v, --version          Show phetch version

Command line options always override options set in phetch.conf.

Once you've launched phetch, use `ctrl-h` to view the on-line help.

安装

如果您已经有一个 Gopher 客户端,可以在此处下载 phetch

gopher://phkt.io/1/phetch/latest

在 macOS 上,您可以使用 HomebrewMacPorts 进行安装。

如果您使用 Homebrew,打开终端并输入

brew install xvxx/code/phetch

对于 MacPorts

sudo port install phetch

在 Arch Linux 上,您可以使用您喜欢的 AUR 辅助工具 安装 phetch

yay phetch

在 NetBSD 上,phetch 包含在主 pkgsrc 仓库中

pkgin install phetch

Linux、Raspberry Pi、Mac 和 Android (termux) 的二进制文件可在 https://github.com/xvxx/phetch/releases 获取

只需将 phetch 程序解压缩/解tar到您的 $PATH 中,然后开始使用!

如果您有 cargomake 以及下一节中描述的其他依赖项,您也可以从源代码构建和安装

git clone https://github.com/xvxx/phetch
cd phetch
env PREFIX=/usr/local make install

对于 Termux 使用

env PREFIX=/data/data/com.termux/files/usr make install

开发

要在 Linux 上使用 TLS 支持,您需要 opensslpkg-config

sudo apt install -y pkg-config libssl-dev

常规开发使用 cargo

cargo run -- <gopher-url>

技巧:0.0..0.0.:7070 上运行本地 Gopher 服务器(如 phd),然后使用 -l--local 启动 phetch 以快速连接。对调试很有用!

phetch 默认支持 TLS 和 Tor。要禁用这些功能,或只启用其中一个,请使用 --no-default-features 标志。

cargo build --no-default-features

您可以通过访问“关于”页面来检查 TLS 是否已启用。

cargo run --no-default-features -- gopher://phetch/about

要仅启用 TLS 支持,或仅启用 Tor 支持,请使用 --features

cargo run --no-default-features --features tor -- gopher://phetch/about

媒体播放器支持

phetch 包含在 mpv 或您选择的任何应用程序中打开视频文件(; 项目类型)和声音文件(s 项目类型)的支持,使用 -m 命令行标志。要测试它,请访问兼容的 Gopher 服务器(可能使用 Gophor?)。或者,按 ctrl-h 然后按 3 在 phetch 中查看“gopher 类型”帮助页面。

待办事项

  • load() 中的 ctrl-c 尚未实现

错误

  • raw_input 更改后,telnet IO 似乎损坏(1146f42)

未来功能

  • 跟踪每个发布的二进制大小
  • 存在 URL 时,文本视图是菜单(每行最多一个)
  • 在文本视图中查找文本
  • 模糊查找增量搜索
  • 持久历史记录
  • 书签:切换而不是仅将文件前置
  • 书签:保存当前页的标题

依赖关系

~0.1–9.5MB
~90K SLoC