Compare commits

..

15 commits
v0.0.2 ... main

Author SHA1 Message Date
d74625e2b3
docs: fix readme demo gif 2025-03-09 21:03:06 +00:00
d200bcb9b5
feat: build using forgejo actions
All checks were successful
Release / build (push) Successful in 3m48s
2025-03-08 16:59:37 +00:00
dependabot[bot]
a9d6c1b327
Bump ring from 0.17.8 to 0.17.13 in the cargo group (#8)
Bumps the cargo group with 1 update: [ring](https://github.com/briansmith/ring).


Updates `ring` from 0.17.8 to 0.17.13
- [Changelog](https://github.com/briansmith/ring/blob/main/RELEASES.md)
- [Commits](https://github.com/briansmith/ring/commits)

---
updated-dependencies:
- dependency-name: ring
  dependency-type: indirect
  dependency-group: cargo
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-08 15:07:27 +00:00
dependabot[bot]
631470324c
Bump the dev-dependencies group across 1 directory with 4 updates (#7)
Bumps the dev-dependencies group with 4 updates in the / directory: [chrono](https://github.com/chronotope/chrono), [clap](https://github.com/clap-rs/clap), [serde](https://github.com/serde-rs/serde) and [anyhow](https://github.com/dtolnay/anyhow).


Updates `chrono` from 0.4.39 to 0.4.40
- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono/compare/v0.4.39...v0.4.40)

Updates `clap` from 4.5.29 to 4.5.31
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.29...v4.5.31)

Updates `serde` from 1.0.217 to 1.0.218
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.217...v1.0.218)

Updates `anyhow` from 1.0.95 to 1.0.97
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.95...1.0.97)

---
updated-dependencies:
- dependency-name: chrono
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dev-dependencies
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dev-dependencies
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dev-dependencies
- dependency-name: anyhow
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dev-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-03 13:27:10 +00:00
dependabot[bot]
e091e03d5a
Bump the dev-dependencies group with 2 updates (#5)
Bumps the dev-dependencies group with 2 updates: [clap](https://github.com/clap-rs/clap) and [rss](https://github.com/rust-syndication/rss).


Updates `clap` from 4.5.28 to 4.5.29
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.28...clap_complete-v4.5.29)

Updates `rss` from 2.0.11 to 2.0.12
- [Release notes](https://github.com/rust-syndication/rss/releases)
- [Changelog](https://github.com/rust-syndication/rss/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-syndication/rss/compare/2.0.11...2.0.12)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dev-dependencies
- dependency-name: rss
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dev-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-17 12:44:14 +00:00
dependabot[bot]
14b6923e60
Bump the dev-dependencies group with 2 updates (#4)
Bumps the dev-dependencies group with 2 updates: [clap](https://github.com/clap-rs/clap) and [toml](https://github.com/toml-rs/toml).


Updates `clap` from 4.5.27 to 4.5.28
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.27...clap_complete-v4.5.28)

Updates `toml` from 0.8.19 to 0.8.20
- [Commits](https://github.com/toml-rs/toml/compare/toml-v0.8.19...toml-v0.8.20)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dev-dependencies
- dependency-name: toml
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dev-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-10 14:35:19 +00:00
1a1c5d24f6
test build in pull request 2025-02-10 14:31:12 +00:00
dependabot[bot]
adaa032f69
Bump openssl from 0.10.68 to 0.10.70 in the cargo group (#3)
Bumps the cargo group with 1 update: [openssl](https://github.com/sfackler/rust-openssl).


Updates `openssl` from 0.10.68 to 0.10.70
- [Release notes](https://github.com/sfackler/rust-openssl/releases)
- [Commits](https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.68...openssl-v0.10.70)

---
updated-dependencies:
- dependency-name: openssl
  dependency-type: indirect
  dependency-group: cargo
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-03 22:34:38 +00:00
dependabot[bot]
64f06c65f9
Bump the dev-dependencies group with 2 updates (#2)
Bumps the dev-dependencies group with 2 updates: [clap](https://github.com/clap-rs/clap) and [indicatif](https://github.com/console-rs/indicatif).


Updates `clap` from 4.5.26 to 4.5.27
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.26...clap_complete-v4.5.27)

Updates `indicatif` from 0.17.9 to 0.17.11
- [Release notes](https://github.com/console-rs/indicatif/releases)
- [Commits](https://github.com/console-rs/indicatif/compare/0.17.9...0.17.11)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dev-dependencies
- dependency-name: indicatif
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dev-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-03 12:13:32 +00:00
04dc5e28eb
reorder description trim chars 2025-01-31 19:04:29 +00:00
1788524a70
bump version to v0.0.3 2025-01-30 22:27:43 +00:00
04ba3e64be
remove html tags from description content 2025-01-30 22:19:24 +00:00
535ace44e3
add updated demo.vhs file 2025-01-17 22:49:24 +00:00
e87a8d453c
update demo gif in readme 2025-01-17 22:48:46 +00:00
a6787d0688
main return more specific type 2025-01-16 21:21:51 +00:00
12 changed files with 95 additions and 78 deletions

View file

@ -1,4 +1,4 @@
name: Rust name: Release
on: on:
push: push:
@ -19,10 +19,10 @@ jobs:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Build release - uses: https://github.com/dtolnay/rust-toolchain@stable
run: cargo build --release - run: cargo build --release
- name: Upload release assets - name: Upload release assets
uses: softprops/action-gh-release@v2 uses: https://gitea.com/actions/gitea-release-action@v1
with: with:
files: ${{ env.BIN_NAME }} files: ${{ env.BIN_NAME }}

1
.github/CODEOWNERS vendored
View file

@ -1 +0,0 @@
* @troylusty

View file

@ -1,10 +0,0 @@
version: 2
updates:
- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: "weekly"
groups:
dev-dependencies:
patterns:
- "*"

84
Cargo.lock generated
View file

@ -81,6 +81,12 @@ dependencies = [
"windows-sys 0.59.0", "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]] [[package]]
name = "atom_syndication" name = "atom_syndication"
version = "0.12.6" version = "0.12.6"
@ -147,9 +153,9 @@ checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b"
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.2.5" version = "1.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c31a0499c1dc64f458ad13872de75c0eb7e3fdb0e67964610c914b034fc5956e" checksum = "be714c154be609ec7f5dad223a33bf1482fff90472de28f7362806e6d4832b8c"
dependencies = [ dependencies = [
"shlex", "shlex",
] ]
@ -162,23 +168,23 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "chrono" name = "chrono"
version = "0.4.39" version = "0.4.40"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c"
dependencies = [ dependencies = [
"android-tzdata", "android-tzdata",
"iana-time-zone", "iana-time-zone",
"js-sys", "js-sys",
"num-traits", "num-traits",
"wasm-bindgen", "wasm-bindgen",
"windows-targets", "windows-link",
] ]
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.5.26" version = "4.5.31"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8eb5e908ef3a6efbe1ed62520fb7287959888c88485abe072543190ecc66783" checksum = "027bb0d98429ae334a8698531da7077bdf906419543a35a55c2cb1b66437d767"
dependencies = [ dependencies = [
"clap_builder", "clap_builder",
"clap_derive", "clap_derive",
@ -186,9 +192,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_builder" name = "clap_builder"
version = "4.5.26" version = "4.5.31"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96b01801b5fc6a0a232407abc821660c9c6d25a1cafc0d4f85f29fb8d9afc121" checksum = "5589e0cba072e0f3d23791efac0fd8627b49c829c196a492e88168e6a669d863"
dependencies = [ dependencies = [
"anstream", "anstream",
"anstyle", "anstyle",
@ -198,9 +204,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_derive" name = "clap_derive"
version = "4.5.24" version = "4.5.28"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54b755194d6389280185988721fffba69495eed5ee9feeee9a599b53db80318c" checksum = "bf4ced95c6f4a675af3da73304b9ac4ed991640c36374e4b46795c49e17cf1ed"
dependencies = [ dependencies = [
"heck", "heck",
"proc-macro2", "proc-macro2",
@ -831,9 +837,9 @@ dependencies = [
[[package]] [[package]]
name = "indicatif" name = "indicatif"
version = "0.17.9" version = "0.17.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cbf675b85ed934d3c67b5c5469701eec7db22689d0a2139d856e0925fa28b281" checksum = "183b3088984b400f4cfac3620d5e076c84da5364016b4f49473de574b2586235"
dependencies = [ dependencies = [
"console", "console",
"number_prefix", "number_prefix",
@ -981,9 +987,9 @@ checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
[[package]] [[package]]
name = "openssl" name = "openssl"
version = "0.10.68" version = "0.10.70"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" checksum = "61cfb4e166a8bb8c9b55c500bc2308550148ece889be90f609377e58140f42c6"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cfg-if", "cfg-if",
@ -1013,9 +1019,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]] [[package]]
name = "openssl-sys" name = "openssl-sys"
version = "0.9.104" version = "0.9.105"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" checksum = "8b22d5b84be05a8d6947c7cb71f7c849aa0f112acd4bf51c2a7c1c988ac0a9dc"
dependencies = [ dependencies = [
"cc", "cc",
"libc", "libc",
@ -1025,8 +1031,9 @@ dependencies = [
[[package]] [[package]]
name = "packard" name = "packard"
version = "0.0.1" version = "0.0.4"
dependencies = [ dependencies = [
"anyhow",
"chrono", "chrono",
"clap", "clap",
"futures", "futures",
@ -1143,24 +1150,23 @@ dependencies = [
[[package]] [[package]]
name = "ring" name = "ring"
version = "0.17.8" version = "0.17.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" checksum = "70ac5d832aa16abd7d1def883a8545280c20a60f523a370aa3a9617c2b8550ee"
dependencies = [ dependencies = [
"cc", "cc",
"cfg-if", "cfg-if",
"getrandom", "getrandom",
"libc", "libc",
"spin",
"untrusted", "untrusted",
"windows-sys 0.52.0", "windows-sys 0.52.0",
] ]
[[package]] [[package]]
name = "rss" name = "rss"
version = "2.0.11" version = "2.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "531af70fce504d369cf42ac0a9645f5a62a8ea9265de71cfa25087e9f6080c7c" checksum = "b2107738f003660f0a91f56fd3e3bd3ab5d918b2ddaf1e1ec2136fb1c46f71bf"
dependencies = [ dependencies = [
"atom_syndication", "atom_syndication",
"derive_builder", "derive_builder",
@ -1266,18 +1272,18 @@ dependencies = [
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.217" version = "1.0.218"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" checksum = "e8dfc9d19bdbf6d17e22319da49161d5d0108e4188e8b680aef6299eed22df60"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.217" version = "1.0.218"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" checksum = "f09503e191f4e797cb8aac08e9a4a4695c5edf6a2e70e376d961ddd5c969f82b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -1348,12 +1354,6 @@ dependencies = [
"windows-sys 0.52.0", "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]] [[package]]
name = "stable_deref_trait" name = "stable_deref_trait"
version = "1.2.0" version = "1.2.0"
@ -1510,9 +1510,9 @@ dependencies = [
[[package]] [[package]]
name = "toml" name = "toml"
version = "0.8.19" version = "0.8.20"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148"
dependencies = [ dependencies = [
"serde", "serde",
"serde_spanned", "serde_spanned",
@ -1531,9 +1531,9 @@ dependencies = [
[[package]] [[package]]
name = "toml_edit" name = "toml_edit"
version = "0.22.22" version = "0.22.23"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" checksum = "02a8b472d1a3d7c18e2d61a489aee3453fd9031c33e4f55bd533f4a7adca1bee"
dependencies = [ dependencies = [
"indexmap", "indexmap",
"serde", "serde",
@ -1758,6 +1758,12 @@ dependencies = [
"windows-targets", "windows-targets",
] ]
[[package]]
name = "windows-link"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6dccfd733ce2b1753b03b6d3c65edf020262ea35e20ccdf3e288043e6dd620e3"
[[package]] [[package]]
name = "windows-registry" name = "windows-registry"
version = "0.2.0" version = "0.2.0"
@ -1872,9 +1878,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]] [[package]]
name = "winnow" name = "winnow"
version = "0.6.24" version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8d71a593cc5c42ad7876e2c1fda56f314f3754c084128833e64f1345ff8a03a" checksum = "86e376c75f4f43f44db463cf729e0d3acbf954d13e22c51e26e4c264b4ab545f"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]

View file

@ -1,21 +1,22 @@
[package] [package]
name = "packard" name = "packard"
version = "0.0.2" version = "0.0.4"
edition = "2021" edition = "2021"
description = "A terminal based feed checker." description = "A terminal based feed checker."
authors = ["Troy Lusty <hello@troylusty.com>"] authors = ["Troy Lusty <hello@troylusty.com>"]
[dependencies] [dependencies]
chrono = "0.4.39" chrono = "0.4.40"
clap = { version = "4.5.26", features = ["derive"] } clap = { version = "4.5.31", features = ["derive"] }
reqwest = "0.12.12" reqwest = "0.12.12"
rss = "2.0.11" rss = "2.0.12"
serde = { version = "1.0.217", features = ["derive"] } serde = { version = "1.0.218", features = ["derive"] }
tokio = { version = "1.43.0", features = ["macros", "rt-multi-thread"] } tokio = { version = "1.43.0", features = ["macros", "rt-multi-thread"] }
toml = "0.8.19" toml = "0.8.20"
xdg = "2.5.2" xdg = "2.5.2"
futures = "0.3.31" futures = "0.3.31"
indicatif = "0.17.9" indicatif = "0.17.11"
anyhow = "1.0.97"
[profile.dev] [profile.dev]
opt-level = 0 opt-level = 0

View file

@ -1,10 +1,10 @@
<div align="center"> <div align="center">
<h1>️📰 Packard</h1> <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> <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> </div>
![Demo](https://github.com/user-attachments/assets/17f228c7-a931-4988-a1c0-8cc7190d4349) ![Demo](demo/demo.gif)
This is my first attempt at making something with Rust so that I may learn alongside creating something that I personally find useful. 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 ```nix
inputs = { inputs = {
packard.url = "github:troylusty/packard"; packard.url = "git+https://code.troylusty.com/troy/packard";
}; };
```
```nix ...
environment.systemPackages = { environment.systemPackages = {
inputs.packard.packages."${pkgs.system}".default 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 ## Configuration

BIN
demo/demo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 761 KiB

View file

@ -8,11 +8,12 @@ Set Width 1200
Set Height 600 Set Height 600
Type@250ms "packard" Sleep 500ms 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 Sleep 3s
PageDown@50ms 1 PageDown@50ms 1
Sleep 1s Sleep 1s
PageDown@50ms 2 PageDown@50ms 2
Sleep 2s Sleep 1s
PageUp@50ms 3 PageUp@50ms 3
Sleep 3s Sleep 3s

View file

@ -2,7 +2,6 @@ use clap::Parser;
use serde::Deserialize; use serde::Deserialize;
use std::collections::HashMap; use std::collections::HashMap;
use std::fs; use std::fs;
use toml;
use xdg::BaseDirectories; use xdg::BaseDirectories;
#[derive(Parser, Debug)] #[derive(Parser, Debug)]

View file

@ -1,9 +1,9 @@
use anyhow::{Context, Result};
use chrono::{DateTime, Utc}; use chrono::{DateTime, Utc};
use futures::future::join_all; use futures::future::join_all;
use indicatif::ProgressBar; use indicatif::ProgressBar;
use reqwest::get; use reqwest::get;
use rss::Channel; use rss::Channel;
use std::error::Error;
#[derive(Debug)] #[derive(Debug)]
pub struct FeedItem { pub struct FeedItem {
@ -13,9 +13,14 @@ pub struct FeedItem {
pub pub_date: DateTime<Utc>, pub pub_date: DateTime<Utc>,
} }
async fn fetch_rss(url: &str, pb: &ProgressBar) -> Result<Channel, Box<dyn Error>> { async fn fetch_rss(url: &str, pb: &ProgressBar) -> Result<Channel> {
let response = get(url).await?.text().await?; let response = get(url)
let channel = Channel::read_from(response.as_bytes())?; .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.inc(1);
pb.set_message(format!("Processing: {}", channel.title)); pb.set_message(format!("Processing: {}", channel.title));
Ok(channel) Ok(channel)

View file

@ -1,13 +1,12 @@
use indicatif::ProgressStyle; use indicatif::ProgressStyle;
use std::error::Error; use tokio::io;
use tokio;
mod config; mod config;
mod data; mod data;
mod utils; mod utils;
#[tokio::main] #[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> { async fn main() -> Result<(), io::Error> {
let config = config::validate_config(); let config = config::validate_config();
let args = config::parse_cli(); let args = config::parse_cli();
let (count, skip_amount, list) = config::collate_values(args, &config); 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", "\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.link,
item.title, item.title,
utils::trim_chars(&item.description), utils::trim_chars(&utils::remove_html_tags(&item.description)),
item.pub_date.to_string() item.pub_date.to_string()
); );
} }

View file

@ -7,3 +7,20 @@ pub fn trim_chars(input: &str) -> String {
trimmed 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
}