Git Product home page Git Product logo

lobsters's Introduction

Lobsters Client and TUI in Rust

crates.io Documentation

Screenshot of lobsters in a terminal window

What

This is a pair of Rust crates. One implements an asynchronous HTTP client for the Lobsters website, and other websites running its code. The other implements a terminal user interface using the client. Lobsters is a friendly programming oriented link sharing community.

This client crate allows the following actions to be performed:

  • Fetch stories
  • Fetch comments on stories
  • Post comments and replies
  • Login

Why

It did this mostly to practice building asynchronous HTTP clients in Rust and gain more experience with the async ecosystem. Then I needed something to test the client so I built the UI. You can read more about building the client and TUI on my blog.

How

The lobsters-cli crate in this repo provides an example of the crate in use. You can try out out by downloading a pre-compiled binary, available below.

Keyboard bindings

The TUI uses the following key bindings:

  • j or — Move cursor down
  • k or — Move cursor up
  • h or — Scroll view left
  • l or — Scroll view right
  • Enter — Open story URL in browser
  • c — Open story comments in browser
  • q or Esc — Quit

Download

lobsters is a single binary available for a handful of platforms. To download the latest release do the following:

  • FreeBSD 12.0 x86_64:
    • curl -L https://releases.wezm.net/lobsters/lobsters-0.1.0-x86_64-unknown-freebsd.tar.gz | tar zxf -
  • Linux x86_64:
    • curl -L https://releases.wezm.net/lobsters/lobsters-0.1.0-x86_64-unknown-linux-musl.tar.gz | tar zxf -
  • macOS x86_64:
    • curl -L https://releases.wezm.net/lobsters/lobsters-0.1.0-x86_64-apple-darwin.tar.gz | tar zxf -
  • NetBSD 8.0 x86_64:
    • curl -L https://releases.wezm.net/lobsters/lobsters-0.1.0-x86_64-unknown-netbsd.tar.gz | tar zxf -
  • OpenBSD 6.5 x86_64:
    • curl -L https://releases.wezm.net/lobsters/lobsters-0.1.0-x86_64-unknown-openbsd.tar.gz | tar zxf -
  • Raspberry Pi:
    • curl -L https://releases.wezm.net/lobsters/lobsters-0.1.0-arm-unknown-linux-gnueabihf.tar.gz | tar zxf -

The binary should be in your current directory and can be run as follows:

./lobsters

Feel free to move it elsewhere (~/.local/bin for example).

Building

Build Status:

  • Debian: builds.sr.ht Debian status
  • FreeBSD: builds.sr.ht FreeBSD status

From Source

Note: You will need the Rust compiler installed.

git clone https://git.sr.ht/~wezm/lobsters
cargo install --path lobsters/lobsters-cli

Cross-Compiling

There is a script that will build binaries for several platforms. You will need an arm-linux-gnueabihf and musl toolchain installed as well as those rustup targets installed.

./build-all-platforms

Known Limitations

  • Support for 2FA login is not implemented

Testing

Run the test suite:

cargo test

Contributing

If you have code or patches you wish to contribute, the preferred mechanism is a git pull request. Push your changes to a git repository somewhere (Sourcehut, GitHub, GitLab, whatever). Ensure that contributions don't break the tests and add new ones when appropriate.

Assuming you have followed the build steps above you would do the following to push to your own fork on Sourcehut, change the git URL to match wherever your forked repo is:

git remote rename origin upstream
git remote add origin [email protected]:~yourname/lobsters
git push -u origin master

Then generate the pull request:

git fetch upstream master
git request-pull -p upstream/master origin

And copy-paste the result into a plain-text email to [email protected].

You may alternately use a patch-based approach as described on https://git-send-email.io.

License

This project is dual licenced under:

lobsters's People

Contributors

wezm avatar

Stargazers

Ryota Sakai avatar Monomadic avatar Andrew Johnson avatar

Watchers

Patrick Elsen avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.