Compare commits
15 commits
Author | SHA1 | Date | |
---|---|---|---|
d74625e2b3 | |||
d200bcb9b5 | |||
![]() |
a9d6c1b327 | ||
![]() |
631470324c | ||
![]() |
e091e03d5a | ||
![]() |
14b6923e60 | ||
1a1c5d24f6 | |||
![]() |
adaa032f69 | ||
![]() |
64f06c65f9 | ||
04dc5e28eb | |||
1788524a70 | |||
04ba3e64be | |||
535ace44e3 | |||
e87a8d453c | |||
a6787d0688 |
12 changed files with 95 additions and 78 deletions
|
@ -1,4 +1,4 @@
|
|||
name: Rust
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
|
@ -19,10 +19,10 @@ jobs:
|
|||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build release
|
||||
run: cargo build --release
|
||||
- uses: https://github.com/dtolnay/rust-toolchain@stable
|
||||
- run: cargo build --release
|
||||
|
||||
- name: Upload release assets
|
||||
uses: softprops/action-gh-release@v2
|
||||
uses: https://gitea.com/actions/gitea-release-action@v1
|
||||
with:
|
||||
files: ${{ env.BIN_NAME }}
|
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
|
@ -1 +0,0 @@
|
|||
* @troylusty
|
10
.github/dependabot.yml
vendored
10
.github/dependabot.yml
vendored
|
@ -1,10 +0,0 @@
|
|||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "cargo"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
groups:
|
||||
dev-dependencies:
|
||||
patterns:
|
||||
- "*"
|
84
Cargo.lock
generated
84
Cargo.lock
generated
|
@ -81,6 +81,12 @@ dependencies = [
|
|||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.97"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f"
|
||||
|
||||
[[package]]
|
||||
name = "atom_syndication"
|
||||
version = "0.12.6"
|
||||
|
@ -147,9 +153,9 @@ checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b"
|
|||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.2.5"
|
||||
version = "1.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c31a0499c1dc64f458ad13872de75c0eb7e3fdb0e67964610c914b034fc5956e"
|
||||
checksum = "be714c154be609ec7f5dad223a33bf1482fff90472de28f7362806e6d4832b8c"
|
||||
dependencies = [
|
||||
"shlex",
|
||||
]
|
||||
|
@ -162,23 +168,23 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.39"
|
||||
version = "0.4.40"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825"
|
||||
checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c"
|
||||
dependencies = [
|
||||
"android-tzdata",
|
||||
"iana-time-zone",
|
||||
"js-sys",
|
||||
"num-traits",
|
||||
"wasm-bindgen",
|
||||
"windows-targets",
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.5.26"
|
||||
version = "4.5.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a8eb5e908ef3a6efbe1ed62520fb7287959888c88485abe072543190ecc66783"
|
||||
checksum = "027bb0d98429ae334a8698531da7077bdf906419543a35a55c2cb1b66437d767"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
|
@ -186,9 +192,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.5.26"
|
||||
version = "4.5.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "96b01801b5fc6a0a232407abc821660c9c6d25a1cafc0d4f85f29fb8d9afc121"
|
||||
checksum = "5589e0cba072e0f3d23791efac0fd8627b49c829c196a492e88168e6a669d863"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
|
@ -198,9 +204,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "clap_derive"
|
||||
version = "4.5.24"
|
||||
version = "4.5.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "54b755194d6389280185988721fffba69495eed5ee9feeee9a599b53db80318c"
|
||||
checksum = "bf4ced95c6f4a675af3da73304b9ac4ed991640c36374e4b46795c49e17cf1ed"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
|
@ -831,9 +837,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "indicatif"
|
||||
version = "0.17.9"
|
||||
version = "0.17.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cbf675b85ed934d3c67b5c5469701eec7db22689d0a2139d856e0925fa28b281"
|
||||
checksum = "183b3088984b400f4cfac3620d5e076c84da5364016b4f49473de574b2586235"
|
||||
dependencies = [
|
||||
"console",
|
||||
"number_prefix",
|
||||
|
@ -981,9 +987,9 @@ checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
|
|||
|
||||
[[package]]
|
||||
name = "openssl"
|
||||
version = "0.10.68"
|
||||
version = "0.10.70"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5"
|
||||
checksum = "61cfb4e166a8bb8c9b55c500bc2308550148ece889be90f609377e58140f42c6"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cfg-if",
|
||||
|
@ -1013,9 +1019,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
|
|||
|
||||
[[package]]
|
||||
name = "openssl-sys"
|
||||
version = "0.9.104"
|
||||
version = "0.9.105"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741"
|
||||
checksum = "8b22d5b84be05a8d6947c7cb71f7c849aa0f112acd4bf51c2a7c1c988ac0a9dc"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
|
@ -1025,8 +1031,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "packard"
|
||||
version = "0.0.1"
|
||||
version = "0.0.4"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
"clap",
|
||||
"futures",
|
||||
|
@ -1143,24 +1150,23 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ring"
|
||||
version = "0.17.8"
|
||||
version = "0.17.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d"
|
||||
checksum = "70ac5d832aa16abd7d1def883a8545280c20a60f523a370aa3a9617c2b8550ee"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"cfg-if",
|
||||
"getrandom",
|
||||
"libc",
|
||||
"spin",
|
||||
"untrusted",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rss"
|
||||
version = "2.0.11"
|
||||
version = "2.0.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "531af70fce504d369cf42ac0a9645f5a62a8ea9265de71cfa25087e9f6080c7c"
|
||||
checksum = "b2107738f003660f0a91f56fd3e3bd3ab5d918b2ddaf1e1ec2136fb1c46f71bf"
|
||||
dependencies = [
|
||||
"atom_syndication",
|
||||
"derive_builder",
|
||||
|
@ -1266,18 +1272,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.217"
|
||||
version = "1.0.218"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70"
|
||||
checksum = "e8dfc9d19bdbf6d17e22319da49161d5d0108e4188e8b680aef6299eed22df60"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.217"
|
||||
version = "1.0.218"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0"
|
||||
checksum = "f09503e191f4e797cb8aac08e9a4a4695c5edf6a2e70e376d961ddd5c969f82b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -1348,12 +1354,6 @@ dependencies = [
|
|||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spin"
|
||||
version = "0.9.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
|
||||
|
||||
[[package]]
|
||||
name = "stable_deref_trait"
|
||||
version = "1.2.0"
|
||||
|
@ -1510,9 +1510,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.8.19"
|
||||
version = "0.8.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e"
|
||||
checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
|
@ -1531,9 +1531,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "toml_edit"
|
||||
version = "0.22.22"
|
||||
version = "0.22.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5"
|
||||
checksum = "02a8b472d1a3d7c18e2d61a489aee3453fd9031c33e4f55bd533f4a7adca1bee"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"serde",
|
||||
|
@ -1758,6 +1758,12 @@ dependencies = [
|
|||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-link"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6dccfd733ce2b1753b03b6d3c65edf020262ea35e20ccdf3e288043e6dd620e3"
|
||||
|
||||
[[package]]
|
||||
name = "windows-registry"
|
||||
version = "0.2.0"
|
||||
|
@ -1872,9 +1878,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
|||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.6.24"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c8d71a593cc5c42ad7876e2c1fda56f314f3754c084128833e64f1345ff8a03a"
|
||||
checksum = "86e376c75f4f43f44db463cf729e0d3acbf954d13e22c51e26e4c264b4ab545f"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
|
15
Cargo.toml
15
Cargo.toml
|
@ -1,21 +1,22 @@
|
|||
[package]
|
||||
name = "packard"
|
||||
version = "0.0.2"
|
||||
version = "0.0.4"
|
||||
edition = "2021"
|
||||
description = "A terminal based feed checker."
|
||||
authors = ["Troy Lusty <hello@troylusty.com>"]
|
||||
|
||||
[dependencies]
|
||||
chrono = "0.4.39"
|
||||
clap = { version = "4.5.26", features = ["derive"] }
|
||||
chrono = "0.4.40"
|
||||
clap = { version = "4.5.31", features = ["derive"] }
|
||||
reqwest = "0.12.12"
|
||||
rss = "2.0.11"
|
||||
serde = { version = "1.0.217", features = ["derive"] }
|
||||
rss = "2.0.12"
|
||||
serde = { version = "1.0.218", features = ["derive"] }
|
||||
tokio = { version = "1.43.0", features = ["macros", "rt-multi-thread"] }
|
||||
toml = "0.8.19"
|
||||
toml = "0.8.20"
|
||||
xdg = "2.5.2"
|
||||
futures = "0.3.31"
|
||||
indicatif = "0.17.9"
|
||||
indicatif = "0.17.11"
|
||||
anyhow = "1.0.97"
|
||||
|
||||
[profile.dev]
|
||||
opt-level = 0
|
||||
|
|
12
README.md
12
README.md
|
@ -1,10 +1,10 @@
|
|||
<div align="center">
|
||||
<h1>️📰 Packard</h1>
|
||||
<img alt="GitHub Release" src="https://img.shields.io/github/v/release/troylusty/packard">
|
||||
<img alt="Release" src="https://img.shields.io/gitea/v/release/troy/packard?gitea_url=https%3A%2F%2Fcode.troylusty.com">
|
||||
<h5>Packard is a simple RSS aggregator meant to allow you to take a quick glance at what's occurring in topics you care about.</h5>
|
||||
</div>
|
||||
|
||||

|
||||

|
||||
|
||||
This is my first attempt at making something with Rust so that I may learn alongside creating something that I personally find useful.
|
||||
|
||||
|
@ -14,17 +14,17 @@ On NixOS you can install Packard by including it as an input in flake.nix, then
|
|||
|
||||
```nix
|
||||
inputs = {
|
||||
packard.url = "github:troylusty/packard";
|
||||
packard.url = "git+https://code.troylusty.com/troy/packard";
|
||||
};
|
||||
```
|
||||
|
||||
```nix
|
||||
...
|
||||
|
||||
environment.systemPackages = {
|
||||
inputs.packard.packages."${pkgs.system}".default
|
||||
};
|
||||
```
|
||||
|
||||
Alternatively, [the latest release](https://github.com/troylusty/packard/releases/latest) binary is available.
|
||||
Alternatively, the [latest release](https://github.com/troylusty/packard/releases/latest) binary is available.
|
||||
|
||||
## Configuration
|
||||
|
||||
|
|
BIN
demo/demo.gif
Normal file
BIN
demo/demo.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 761 KiB |
|
@ -8,11 +8,12 @@ Set Width 1200
|
|||
Set Height 600
|
||||
|
||||
Type@250ms "packard" Sleep 500ms
|
||||
Type@150ms " -c 48 -l news | less" Sleep 500ms Enter
|
||||
Hide Type " -c 48 -l news" Show Sleep 500ms
|
||||
Type@200ms " | less" Sleep 500ms Enter
|
||||
Sleep 3s
|
||||
PageDown@50ms 1
|
||||
Sleep 1s
|
||||
PageDown@50ms 2
|
||||
Sleep 2s
|
||||
Sleep 1s
|
||||
PageUp@50ms 3
|
||||
Sleep 3s
|
|
@ -2,7 +2,6 @@ use clap::Parser;
|
|||
use serde::Deserialize;
|
||||
use std::collections::HashMap;
|
||||
use std::fs;
|
||||
use toml;
|
||||
use xdg::BaseDirectories;
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
|
|
13
src/data.rs
13
src/data.rs
|
@ -1,9 +1,9 @@
|
|||
use anyhow::{Context, Result};
|
||||
use chrono::{DateTime, Utc};
|
||||
use futures::future::join_all;
|
||||
use indicatif::ProgressBar;
|
||||
use reqwest::get;
|
||||
use rss::Channel;
|
||||
use std::error::Error;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct FeedItem {
|
||||
|
@ -13,9 +13,14 @@ pub struct FeedItem {
|
|||
pub pub_date: DateTime<Utc>,
|
||||
}
|
||||
|
||||
async fn fetch_rss(url: &str, pb: &ProgressBar) -> Result<Channel, Box<dyn Error>> {
|
||||
let response = get(url).await?.text().await?;
|
||||
let channel = Channel::read_from(response.as_bytes())?;
|
||||
async fn fetch_rss(url: &str, pb: &ProgressBar) -> Result<Channel> {
|
||||
let response = get(url)
|
||||
.await
|
||||
.context("Failed to send request")?
|
||||
.text()
|
||||
.await
|
||||
.context("Failed to read response text")?;
|
||||
let channel = Channel::read_from(response.as_bytes()).context("Failed to parse RSS feed")?;
|
||||
pb.inc(1);
|
||||
pb.set_message(format!("Processing: {}", channel.title));
|
||||
Ok(channel)
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
use indicatif::ProgressStyle;
|
||||
use std::error::Error;
|
||||
use tokio;
|
||||
use tokio::io;
|
||||
|
||||
mod config;
|
||||
mod data;
|
||||
mod utils;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn Error>> {
|
||||
async fn main() -> Result<(), io::Error> {
|
||||
let config = config::validate_config();
|
||||
let args = config::parse_cli();
|
||||
let (count, skip_amount, list) = config::collate_values(args, &config);
|
||||
|
@ -28,7 +27,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
|||
"\x1b[1m>\x1b[0m \x1b[1;32m\x1b]8;;{}\x1b\\{}\x1b]8;;\x1b\\\x1b[0m\n\x1b[3m\x1b[2m{}\x1b[0m\n\x1b[2m{}\x1b[0m\n",
|
||||
item.link,
|
||||
item.title,
|
||||
utils::trim_chars(&item.description),
|
||||
utils::trim_chars(&utils::remove_html_tags(&item.description)),
|
||||
item.pub_date.to_string()
|
||||
);
|
||||
}
|
||||
|
|
17
src/utils.rs
17
src/utils.rs
|
@ -7,3 +7,20 @@ pub fn trim_chars(input: &str) -> String {
|
|||
trimmed
|
||||
}
|
||||
}
|
||||
|
||||
pub fn remove_html_tags(input: &str) -> String {
|
||||
let mut result = String::new();
|
||||
let mut in_tag = false;
|
||||
|
||||
for c in input.chars() {
|
||||
if c == '<' {
|
||||
in_tag = true;
|
||||
} else if c == '>' {
|
||||
in_tag = false;
|
||||
} else if !in_tag {
|
||||
result.push(c);
|
||||
}
|
||||
}
|
||||
|
||||
result
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue