Compare commits

...

33 Commits
1.1.1 ... main

Author SHA1 Message Date
Bauke 57b6c64ea0
Version 1.1.6! 2024-01-21 13:59:35 +01:00
Bauke 7c20a44619
Update license years. 2024-01-21 13:59:24 +01:00
Bauke 495e6ac048
Add the Development section. 2024-01-21 13:58:36 +01:00
Bauke f9bfe86ad6
Redo the cargo-make configuration to make use of default tasks. 2024-01-21 13:50:11 +01:00
Bauke 3bf315829a
Update all dependencies. 2024-01-21 13:48:27 +01:00
Bauke 0a03826fd2
Fix Clippy issues. 2024-01-21 13:44:26 +01:00
Bauke b0893af002
Switch the resolver. 2024-01-21 13:42:23 +01:00
Bauke d7278ba3a2
Add Nix flake and direnv files. 2024-01-21 13:41:41 +01:00
Bauke 7545039bec
Version 1.1.5! 2022-10-02 22:10:29 +02:00
Bauke 49969b307a
Update RSS example. 2022-10-02 21:54:15 +02:00
Bauke 8b450cc724
Clean up documentation. 2022-10-02 21:30:15 +02:00
Bauke 2ebc218149
Forbid unsafe code and add documentation warnings. 2022-10-02 16:12:12 +02:00
Bauke 521a9bbd1a
Update Cargo.toml metadata info. 2022-10-01 01:06:29 +02:00
Bauke 3a001d1326
Update edition and dependencies. 2022-10-01 01:03:47 +02:00
Bauke fc2503e752
Add Eq derives. 2022-10-01 01:00:34 +02:00
Bauke 243750ff5f
Rewrite CLI tests using insta and test_case. 2022-10-01 00:55:12 +02:00
Bauke 9db7f4f1b2
Update CLI dependencies, rewrite with Clap's Derive API. 2022-10-01 00:09:13 +02:00
Bauke 3a466adedc
Update license year and email. 2022-09-30 23:46:53 +02:00
Bauke b32e45d058
Update gitignore and move coverage directory. 2022-09-30 23:36:21 +02:00
Bauke dda3e2debc
Rewrite readme. 2022-09-30 23:34:20 +02:00
Bauke 3442351223
Version 1.1.4. 2022-07-20 14:25:56 +02:00
Bauke b4fadea55d
Run cargo fmt. 2022-07-20 14:14:44 +02:00
Kevin Cox 34677a5fa1
Switch to hard-xml. (#4)
strong-xml is unmaintained and this fork includes a fix to a self-closing element causing a parse error.

This also fixes a build-time warning with the strong-xml derive macro.
2022-07-19 13:47:46 +02:00
Bauke 75eb03b23f
Version 1.1.3 2021-09-27 19:28:36 +02:00
Bauke a39b0b8db8
Version 1.1.2 2021-09-27 19:24:12 +02:00
Bauke 1ae347f2ef
Remove unused imports from doc examples. 2021-09-27 13:49:08 +02:00
Bauke 4f285142d8
Remove the Regex dependency.
This isn't really necessary if we're checking against
a list of valid versions.
2021-09-27 13:37:43 +02:00
Bauke 9ef1bf37ef
Add cargo-make tasks. 2021-09-27 12:36:57 +02:00
Bauke c146776e8b
Add more tests. 2021-09-27 12:23:50 +02:00
Bauke 40e9e785b9
Fix a Clippy warning. 2021-09-27 12:07:31 +02:00
Bauke fab193f2dd
Clean up and update the documentation. 2021-09-27 12:06:22 +02:00
Bauke 00fc02f7a0
Update all dependencies. 2021-09-26 22:21:24 +02:00
Bauke d0b85869e3
Remove GitHub CI stuff. 2021-09-26 22:14:50 +02:00
39 changed files with 956 additions and 622 deletions

3
.envrc Normal file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
use flake

View File

@ -1,64 +0,0 @@
on: [push, pull_request]
name: Continuous Integration
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: check
test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: test
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add clippy
- uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings

7
.gitignore vendored
View File

@ -1,5 +1,4 @@
# Compiled files and executables.
.direnv/
coverage/
debug/
target/
# Backup files generated by rustfmt.
**/*.rs.bk

491
Cargo.lock generated
View File

@ -1,29 +1,63 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "aho-corasick"
version = "0.7.13"
name = "anstream"
version = "0.6.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86"
checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5"
dependencies = [
"memchr",
"anstyle",
"anstyle-parse",
"anstyle-query",
"anstyle-wincon",
"colorchoice",
"utf8parse",
]
[[package]]
name = "ansi_term"
version = "0.11.0"
name = "anstyle"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87"
[[package]]
name = "anstyle-parse"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c"
dependencies = [
"winapi",
"utf8parse",
]
[[package]]
name = "anstyle-query"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648"
dependencies = [
"windows-sys",
]
[[package]]
name = "anstyle-wincon"
version = "3.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7"
dependencies = [
"anstyle",
"windows-sys",
]
[[package]]
name = "assert_cmd"
version = "1.0.1"
version = "2.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c88b9ca26f9c16ec830350d309397e74ee9abdfd8eb1f71cb6ecc71a3fc818da"
checksum = "00ad3f3a942eee60335ab4342358c161ee296829e0d16ff42fc1d6cb07815467"
dependencies = [
"anstyle",
"bstr",
"doc-comment",
"predicates",
"predicates-core",
@ -32,42 +66,91 @@ dependencies = [
]
[[package]]
name = "atty"
version = "0.2.14"
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bstr"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c48f0051a4b4c5e0b6d365cd04af53aeaa209e3cc15ec2cdb69e73cc87fbd0dc"
dependencies = [
"hermit-abi",
"libc",
"winapi",
"memchr",
"regex-automata",
"serde",
]
[[package]]
name = "bitflags"
version = "1.2.1"
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "clap"
version = "2.33.3"
version = "4.4.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c"
dependencies = [
"ansi_term",
"atty",
"bitflags",
"strsim",
"textwrap",
"unicode-width",
"vec_map",
"clap_builder",
"clap_derive",
]
[[package]]
name = "difference"
version = "2.0.0"
name = "clap_builder"
version = "4.4.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7"
dependencies = [
"anstream",
"anstyle",
"clap_lex",
"strsim",
]
[[package]]
name = "clap_derive"
version = "4.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442"
dependencies = [
"heck",
"proc-macro2",
"quote",
"syn 2.0.48",
]
[[package]]
name = "clap_lex"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1"
[[package]]
name = "colorchoice"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
[[package]]
name = "console"
version = "0.15.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb"
dependencies = [
"encode_unicode",
"lazy_static",
"libc",
"windows-sys",
]
[[package]]
name = "difflib"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8"
[[package]]
name = "doc-comment"
@ -76,25 +159,66 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
[[package]]
name = "hermit-abi"
version = "0.1.15"
name = "encode_unicode"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9"
checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
[[package]]
name = "hard-xml"
version = "1.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fafc2bcb74049535eb6fab49eb20164a427867a9e809516ef95a98e961164432"
dependencies = [
"libc",
"hard-xml-derive",
"jetscii",
"lazy_static",
"memchr",
"xmlparser",
]
[[package]]
name = "hard-xml-derive"
version = "1.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57a345b327da51b997c94f841d9db6b2d292c7632713bd8a1b8b191e8b819df7"
dependencies = [
"bitflags",
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "heck"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]]
name = "insta"
version = "1.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d64600be34b2fcfc267740a243fa7744441bb4947a619ac4e5bb6507f35fbfc"
dependencies = [
"console",
"lazy_static",
"linked-hash-map",
"similar",
"yaml-rust",
]
[[package]]
name = "itoa"
version = "0.4.6"
version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6"
checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c"
[[package]]
name = "jetscii"
version = "0.4.4"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f25cca2463cb19dbb1061eb3bd38a8b5e4ce1cc5a5a9fc0e02de486d92b9b05"
checksum = "47f142fe24a9c9944451e8349de0a56af5f3e7226dc46f3ed4d4ecc0b85af75e"
[[package]]
name = "lazy_static"
@ -104,130 +228,126 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.76"
version = "0.2.152"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "755456fae044e6fa1ebbbd1b3e902ae19e73097ed4ed87bb79934a867c007bc3"
checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7"
[[package]]
name = "linked-hash-map"
version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
[[package]]
name = "memchr"
version = "2.3.3"
version = "2.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149"
[[package]]
name = "opml"
version = "1.1.1"
version = "1.1.6"
dependencies = [
"regex",
"hard-xml",
"serde",
"strong-xml",
"thiserror",
]
[[package]]
name = "opml_cli"
version = "1.1.1"
version = "1.1.6"
dependencies = [
"assert_cmd",
"clap",
"insta",
"opml",
"serde",
"serde_json",
"test-case",
]
[[package]]
name = "predicates"
version = "1.0.5"
version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96bfead12e90dccead362d62bb2c90a5f6fc4584963645bc7f71a735e0b0735a"
checksum = "68b87bfd4605926cdfefc1c3b5f8fe560e3feca9d5552cf68c466d3d8236c7e8"
dependencies = [
"difference",
"anstyle",
"difflib",
"predicates-core",
]
[[package]]
name = "predicates-core"
version = "1.0.0"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06075c3a3e92559ff8929e7a280684489ea27fe44805174c3ebd9328dcb37178"
checksum = "b794032607612e7abeb4db69adb4e33590fa6cf1149e95fd7cb00e634b92f174"
[[package]]
name = "predicates-tree"
version = "1.0.0"
version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e63c4859013b38a76eca2414c64911fba30def9e3202ac461a2d22831220124"
checksum = "368ba315fb8c5052ab692e68a0eefec6ec57b23a36959c14496f0b0df2c0cecf"
dependencies = [
"predicates-core",
"treeline",
"termtree",
]
[[package]]
name = "proc-macro2"
version = "1.0.24"
version = "1.0.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae"
dependencies = [
"unicode-xid",
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.7"
version = "1.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
dependencies = [
"proc-macro2",
]
[[package]]
name = "regex"
version = "1.3.9"
name = "regex-automata"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
"thread_local",
]
[[package]]
name = "regex-syntax"
version = "0.6.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8"
checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f"
[[package]]
name = "ryu"
version = "1.0.5"
version = "1.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c"
[[package]]
name = "serde"
version = "1.0.115"
version = "1.0.195"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e54c9a88f2da7238af84b5101443f0c0d0a3bbdc455e34a5c9497b1903ed55d5"
checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.115"
version = "1.0.195"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "609feed1d0a73cc36a0182a840a9b37b4a82f0b1150369f0536a9e3f2a31dc48"
checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.48",
]
[[package]]
name = "serde_json"
version = "1.0.57"
version = "1.0.111"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "164eacbdb13512ec2745fb09d51fd5b22b0d65ed294a1dcf7285a360c80a675c"
checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4"
dependencies = [
"itoa",
"ryu",
@ -235,107 +355,109 @@ dependencies = [
]
[[package]]
name = "strong-xml"
version = "0.6.2"
name = "similar"
version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73d7a5a280d6097649ea2254eb65d38e81f1752fa47ea69d5fa2179470c8bf4c"
dependencies = [
"jetscii",
"lazy_static",
"memchr",
"strong-xml-derive",
"xmlparser",
]
[[package]]
name = "strong-xml-derive"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c3fa5e97f5557b119549b559e37bd3990528534110d0fdfa6c7e9b4c9a9d75a"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
checksum = "32fea41aca09ee824cc9724996433064c89f7777e60762749a4170a14abbfa21"
[[package]]
name = "strsim"
version = "0.8.0"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "syn"
version = "1.0.64"
version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fd9d1e9976102a03c542daa2eff1b43f9d72306342f3f8b3ed5fb8908195d6f"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
"unicode-xid",
"unicode-ident",
]
[[package]]
name = "textwrap"
version = "0.11.0"
name = "syn"
version = "2.0.48"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f"
dependencies = [
"unicode-width",
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "termtree"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76"
[[package]]
name = "test-case"
version = "3.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb2550dd13afcd286853192af8601920d959b14c401fcece38071d53bf0768a8"
dependencies = [
"test-case-macros",
]
[[package]]
name = "test-case-core"
version = "3.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adcb7fd841cd518e279be3d5a3eb0636409487998a4aff22f3de87b81e88384f"
dependencies = [
"cfg-if",
"proc-macro2",
"quote",
"syn 2.0.48",
]
[[package]]
name = "test-case-macros"
version = "3.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.48",
"test-case-core",
]
[[package]]
name = "thiserror"
version = "1.0.24"
version = "1.0.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e"
checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.24"
version = "1.0.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0"
checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.48",
]
[[package]]
name = "thread_local"
version = "1.0.1"
name = "unicode-ident"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14"
dependencies = [
"lazy_static",
]
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
name = "treeline"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41"
[[package]]
name = "unicode-width"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
[[package]]
name = "unicode-xid"
name = "utf8parse"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
[[package]]
name = "vec_map"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
[[package]]
name = "wait-timeout"
@ -347,29 +469,82 @@ dependencies = [
]
[[package]]
name = "winapi"
version = "0.3.9"
name = "windows-sys"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
"windows-targets",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
name = "windows-targets"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
name = "windows_aarch64_gnullvm"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef"
[[package]]
name = "windows_i686_gnu"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313"
[[package]]
name = "windows_i686_msvc"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
[[package]]
name = "xmlparser"
version = "0.13.2"
version = "0.13.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52613e655f6f11f63c0fe7d1c3b5ef69e44d96df9b65dab296b441ed0e1125f5"
checksum = "66fee0b777b0f5ac1c69bb06d361268faafa61cd4682ae064a171c16c433e9e4"
[[package]]
name = "yaml-rust"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
dependencies = [
"linked-hash-map",
]

View File

@ -5,3 +5,4 @@ members = [
"opml_api",
"opml_cli"
]
resolver = "2"

View File

@ -1,6 +1,6 @@
The MIT License
Copyright (c) 2020-2021 Holllo <helllo@holllo.cc>
Copyright (c) 2020-2024 Holllo <helllo@holllo.org>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

31
Makefile.toml Normal file
View File

@ -0,0 +1,31 @@
[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
# Do a full check of everything.
[tasks.complete-check]
dependencies = [
"clean",
"format",
"check",
"clippy",
"test",
"code-coverage",
"docs",
"build",
"audit-flow",
"outdated-flow"
]
# Run cargo-tarpaulin and output the test coverage.
[tasks.code-coverage]
workspace = false
command = "cargo"
args = [
"tarpaulin",
"--exclude-files=target/*",
"--out=html",
"--output-dir=coverage",
"--skip-clean",
"--target-dir=target/tarpaulin",
"--workspace"
]

View File

@ -1,21 +1,31 @@
# OPML
# OPML 📄
> An OPML parser for Rust and the command-line.
> **OPML library for Rust & standalone CLI.**
## API
For the API documentation, see [docs.rs](https://docs.rs/opml).
For API documentation and examples see [docs.rs](https://docs.rs/opml).
## CLI
To install the OPML command-line parser, run `cargo install opml_cli` or download a precompiled executable directly from [the Releases page](https://github.com/Holllo/opml/releases/latest).
### Cargo
Then run `opml --help` to see all the available options.
With a working [Rust and Cargo](https://www.rust-lang.org/learn/get-started) installation, you can install the OPML CLI from [Crates.io](https://crates.io/crates/opml_cli).
```
cargo install opml_cli
```
### Binaries
Precompiled `x86_64-unknown-linux-gnu` binaries are available on the [Releases page](https://git.bauke.xyz/Holllo/opml/releases).
## Development
With [Nix flakes](https://nixos.wiki/wiki/Flakes) and [direnv](https://direnv.net/) installed and enabled, all the required dependencies are automatically loaded from [`shell.nix`](./shell.nix). Then [cargo-make](https://sagiegurari.github.io/cargo-make/) can be used to build, deploy and lint the code. The available tasks are all described in the [`Makefile.toml`](Makefile.toml) configuration.
## License
Both the API and command-line parser are licensed under either of [Apache License, Version 2.0](https://github.com/Holllo/opml/blob/main/LICENSE-Apache) or [MIT license](https://github.com/Holllo/opml/blob/main/LICENSE-MIT) at your option.
Distributed under the [Apache License 2.0](https://spdx.org/licenses/Apache-2.0.html) and [MIT](https://spdx.org/licenses/MIT.html) licenses, see [LICENSE-Apache](https://git.bauke.xyz/Holllo/opml/src/branch/main/LICENSE-Apache) and [LICENSE-MIT](https://git.bauke.xyz/Holllo/opml/src/branch/main/LICENSE-MIT) for more information.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in either crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
The samples [located in `opml_api/tests/spec_samples`](https://github.com/Holllo/opml/tree/main/opml_api/tests/spec_samples) were [taken from the OPML 2.0 spec](http://dev.opml.org/spec2.html#examples) and are subject to [their own license](https://github.com/Holllo/opml/blob/main/opml_api/tests/spec_samples/LICENSE).
The samples located in `opml_api/tests/spec_samples`) were [taken from the OPML 2.0 spec](http://dev.opml.org/spec2.html#examples) and are subject to [their own license](https://git.bauke.xyz/Holllo/opml/src/branch/main/opml_api/tests/spec_samples/LICENSE).

128
flake.lock Normal file
View File

@ -0,0 +1,128 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1705697961,
"narHash": "sha256-XepT3WS516evSFYkme3GrcI3+7uwXHqtHbip+t24J7E=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e5d1c87f5813afde2dda384ac807c57a105721cc",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1681358109,
"narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "96ba1c52e54e74c3197f4d43026b3f3d92e83ff9",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1705803528,
"narHash": "sha256-nChqKQPRXxmGBEkHse39LjNpkNKk4U1xPQ4a4oYlUdw=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "bd7e8f4e122e11c934a576abc04327764f9bf19b",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

17
flake.nix Normal file
View File

@ -0,0 +1,17 @@
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = { self, nixpkgs, flake-utils, rust-overlay }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
in
{
devShells.default = import ./shell.nix { inherit pkgs; };
}
);
}

View File

@ -2,20 +2,22 @@
[package]
name = "opml"
description = "An OPML parser for Rust."
authors = ["Holllo <helllo@holllo.cc>"]
version = "1.1.1"
description = "OPML library for Rust."
repository = "https://git.bauke.xyz/Holllo/opml"
license = "MIT OR Apache-2.0"
repository = "https://github.com/Holllo/opml"
version = "1.1.6"
authors = ["Holllo <helllo@holllo.org>"]
edition = "2021"
readme = "../README.md"
edition = "2018"
keywords = ["xml", "opml"]
[lib]
path = "source/lib.rs"
[dependencies]
regex = "1.3"
serde = { version = "1.0", features = ["derive"] }
strong-xml = "0.6.2"
thiserror = "1.0.24"
hard-xml = "1.34.0"
thiserror = "1.0.56"
[dependencies.serde]
version = "1.0.195"
features = ["derive"]

View File

@ -1,6 +1,6 @@
The MIT License
Copyright (c) 2020-2021 Holllo <helllo@holllo.cc>
Copyright (c) 2020-2024 Holllo <helllo@holllo.org>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,26 +1,31 @@
use std::{error::Error, fs};
use opml::OPML;
fn main() -> Result<(), Box<dyn Error>> {
let xml = fs::read_to_string("examples/opml_samples/rust_feeds.opml")?;
const SAMPLE: &str = r#"<opml version="2.0">
<head>
<title>Rust Feeds</title>
</head>
<body>
<outline text="Rust Blog" xmlUrl="https://blog.rust-lang.org/feed.xml" />
<outline text="Inside Rust" xmlUrl="https://blog.rust-lang.org/inside-rust/feed.xml" />
</body>
</opml>"#;
let subscriptions = OPML::from_str(&xml)?;
let head = subscriptions.head.unwrap();
let title = head.title.unwrap();
/// Run this example using `cargo run --example rss`.
///
/// Output:
/// Rust Feeds
/// ──────────
/// Rust Blog https://blog.rust-lang.org/feed.xml
/// Inside Rust https://blog.rust-lang.org/inside-rust/feed.xml
fn main() {
let subscriptions = OPML::from_str(SAMPLE).unwrap();
println!(" {}", title);
println!(" {}", "".repeat(title.len()));
for outline in subscriptions.body.outlines {
println!(" {}\t{}", outline.text, outline.xml_url.unwrap());
if let Some(title) = subscriptions.head.and_then(|head| head.title) {
println!("{}", title);
println!("{}", "-".repeat(title.len()));
}
Ok(())
for outline in subscriptions.body.outlines {
println!("{}\t{}", outline.text, outline.xml_url.unwrap());
}
}
// Output:
// Rust Feeds
// ──────────
// Rust Blog https://blog.rust-lang.org/feed.xml
// Inside Rust https://blog.rust-lang.org/inside-rust/feed.xml

View File

@ -1,123 +1,86 @@
//! This crate provides an API to parse and construct
//! [OPML documents](http://dev.opml.org/spec2.html) to and from regular Rust
//! structs.
//! This crate provides an API to parse and create [OPML documents].
//!
//! ## Getting Started
//! [OPML documents]: http://opml.org/spec2.opml
//!
//! ### Parsing
//! ## Parsing
//!
//! Parsing XML into [an OPML struct](struct.OPML.html) can be done with
//! [`OPML::new()`](struct.OPML.html#method.new). Resulting in an error if the
//! XML can't be parsed, if the included OPML version is not supported
//! (currently all OPML versions (1.0, 1.1 and 2.0) are supported) or if the
//! [Body](struct.Body.html) element contains no child
//! [Outline](struct.Outline.html) elements,
//! [as per the spec](http://dev.opml.org/spec2.html#whatIsALtbodygt).
//! To parse an OPML document use [`OPML::from_str`] or [`OPML::from_reader`].
//!
//! Parsing will result in an error if:
//! * the XML is malformed,
//! * the included OPML version is not supported (currently all OPML versions
//! (1.0, 1.1 and 2.0) are supported) or,
//! * if the [`Body`] element contains no child [`Outline`] elements,
//! [as per the spec].
//!
//! [as per the spec]: http://opml.org/spec2.opml#1629042198000
//!
//! ```rust
//! use opml::{OPML, Outline};
//! use opml::OPML;
//!
//! let xml = r#"<opml version="2.0"><head/><body><outline text="Outline"/></body></opml>"#;
//! let parsed = OPML::new(xml).unwrap();
//! let document = OPML::from_str(xml).unwrap();
//!
//! let mut expected = OPML::default();
//! expected.body.outlines.push(Outline {
//! text: "Outline".to_string(),
//! ..Outline::default()
//! });
//!
//! println!("{:#?}", parsed);
//! assert_eq!(parsed, expected);
//! assert_eq!(document.version, "2.0");
//! ```
//!
//! ### Constructing
//! ## Creating
//!
//! Constructing OPMLs is very easy as all you have to do is instantiate the
//! [OPML struct](struct.OPML.html) with
//! [`OPML::default()`](struct.OPML.html#method.default), add anything wanted
//! and then call [`OPML::to_xml()`](struct.OPML.html#method.to_xml) to return
//! the XML as a string.
//!
//! ```rust
//! use opml::{Head, OPML};
//!
//! let mut opml = OPML::default();
//! opml.head = Some(Head {
//! title: Some("Rust Feeds".to_string()),
//! ..Head::default()
//! });
//! opml
//! .add_feed("Rust Blog", "https://blog.rust-lang.org/feed.xml")
//! .add_feed(
//! "Inside Rust",
//! "https://blog.rust-lang.org/inside-rust/feed.xml",
//! );
//!
//! let xml = opml.to_xml().unwrap();
//! let expected = r#"<opml version="2.0"><head><title>Rust Feeds</title></head><body><outline text="Rust Blog" xmlUrl="https://blog.rust-lang.org/feed.xml"/><outline text="Inside Rust" xmlUrl="https://blog.rust-lang.org/inside-rust/feed.xml"/></body></opml>"#;
//! println!("{}", xml);
//! assert_eq!(xml, expected);
//! ```
//! To create an OPML document from scratch, use [`OPML::default()`] or the good
//! old `OPML { /* ... */ }` syntax.
use regex::Regex;
#![forbid(unsafe_code)]
#![warn(missing_docs, clippy::missing_docs_in_private_items)]
use hard_xml::{XmlRead, XmlWrite};
use serde::{Deserialize, Serialize};
use strong_xml::{XmlRead, XmlWrite};
use thiserror::Error;
/// All possible errors.
#[derive(Debug, Error)]
pub enum Error {
/// [From the spec], "a `<body>` contains one or more `<outline>` elements".
///
/// [From the spec]: http://opml.org/spec2.opml#1629042198000
#[error("OPML body has no <outline> elements")]
BodyHasNoOutlines,
/// Wrapper for [`std::io::Error`].
#[error("Failed to read file")]
IoError(#[from] std::io::Error),
/// The version string in the XML is not supported.
#[error("Unsupported OPML version: {0:?}")]
UnsupportedVersion(String),
/// The input string is not valid XML.
#[error("Failed to process XML file")]
XmlError(#[from] strong_xml::XmlError),
XmlError(#[from] hard_xml::XmlError),
}
/// The top-level [OPML](struct.OPML.html) element.
/// The top-level [`OPML`] element.
#[derive(
XmlWrite, XmlRead, PartialEq, Debug, Clone, Serialize, Deserialize,
XmlWrite, XmlRead, PartialEq, Eq, Debug, Clone, Serialize, Deserialize,
)]
#[xml(tag = "opml")]
pub struct OPML {
/// The version attribute from the element, valid values are `1.0`, `1.1` and `2.0`.
/// The version attribute from the element, valid values are `1.0`, `1.1` and
/// `2.0`.
#[xml(attr = "version")]
pub version: String,
/// The [Head](struct.Head.html) child element. Contains the metadata of the OPML document.
/// The [`Head`] child element. Contains the metadata of the OPML document.
#[xml(child = "head")]
pub head: Option<Head>,
/// The [Body](struct.Body.html) child element. Contains all the [Outlines](struct.Outline.html).
/// The [`Body`] child element. Contains all the [`Outline`] elements.
#[xml(child = "body")]
pub body: Body,
}
impl OPML {
/// Parses an OPML document.
///
/// # Example
///
/// ```rust
/// use opml::{OPML, Outline};
///
/// let xml = r#"<opml version="2.0"><head/><body><outline text="Outline"/></body></opml>"#;
/// let parsed = OPML::new(xml).unwrap();
///
/// let mut expected = OPML::default();
/// expected.body.outlines.push(Outline {
/// text: "Outline".to_string(),
/// ..Outline::default()
/// });
///
/// assert_eq!(parsed, expected);
/// ```
#[deprecated(note = "use from_str instead", since = "1.1.0")]
/// Deprecated, use [`OPML::from_str`] instead.
#[deprecated(note = "Use from_str instead", since = "1.1.0")]
pub fn new(xml: &str) -> Result<Self, Error> {
Self::from_str(xml).map_err(Into::into)
}
@ -130,7 +93,7 @@ impl OPML {
/// use opml::{OPML, Outline};
///
/// let xml = r#"<opml version="2.0"><head/><body><outline text="Outline"/></body></opml>"#;
/// let parsed = OPML::from_str(xml).unwrap();
/// let document = OPML::from_str(xml).unwrap();
///
/// let mut expected = OPML::default();
/// expected.body.outlines.push(Outline {
@ -138,21 +101,17 @@ impl OPML {
/// ..Outline::default()
/// });
///
/// assert_eq!(parsed, expected);
/// assert_eq!(document, expected);
/// ```
#[allow(clippy::should_implement_trait)]
pub fn from_str(xml: &str) -> Result<Self, Error> {
let opml = <OPML as XmlRead>::from_str(xml)?;
let version = &opml.version;
// SPEC: The version attribute is a version string, of the form, x.y, where
// x and y are both numeric strings.
let valid_versions = ["1.0", "1.1", "2.0"];
// SPEC: The version attribute is a version string, of the form, x.y, where x and y are both numeric strings.
let valid_version_regex = Regex::new(r"^\d+\.\d+$").unwrap();
let valid_versions = vec!["1.0", "1.1", "2.0"];
if !valid_version_regex.is_match(version)
|| !valid_versions.contains(&version.as_str())
{
if !valid_versions.contains(&opml.version.as_str()) {
return Err(Error::UnsupportedVersion(opml.version));
}
@ -169,11 +128,10 @@ impl OPML {
/// # Example
///
/// ```rust,no_run
/// use opml::{OPML, Outline};
/// use std::fs::File;
/// use opml::OPML;
///
/// let mut file = File::open("file.opml").unwrap();
/// let parsed = OPML::from_reader(&mut file).unwrap();
/// let mut file = std::fs::File::open("file.opml").unwrap();
/// let document = OPML::from_reader(&mut file).unwrap();
/// ```
pub fn from_reader<R>(reader: &mut R) -> Result<Self, Error>
where
@ -184,7 +142,9 @@ impl OPML {
Self::from_str(&s).map_err(Into::into)
}
/// Helper function to add an [Outline](struct.Outline.html) element with `text` and `xml_url` attributes to the [Body](struct.Body.html). Useful for creating feed lists quickly. This function [also exists on the Outline struct](struct.Outline.html#method.add_feed) to create grouped lists easily.
/// Helper function to add an [`Outline`] element with `text` and `xml_url`
/// attributes to the [`Body`]. Useful for creating feed lists quickly.
/// This function also exists as [`Outline::add_feed`] for grouped lists.
///
/// # Example
///
@ -213,20 +173,8 @@ impl OPML {
self
}
/// Converts the struct to an XML document.
///
/// # Example
///
/// ```rust
/// use opml::OPML;
///
/// let opml = OPML::default();
/// let xml = opml.to_xml().unwrap();
///
/// let expected = r#"<opml version="2.0"><head/><body/></opml>"#;
/// assert_eq!(xml, expected);
/// ```
#[deprecated(note = "Use to_string instead")]
/// Deprecated, use [`OPML::to_string`] instead.
#[deprecated(note = "Use to_string instead", since = "1.1.0")]
pub fn to_xml(&self) -> Result<String, Error> {
self.to_string()
}
@ -254,10 +202,9 @@ impl OPML {
///
/// ```rust,no_run
/// use opml::OPML;
/// use std::fs::File;
///
/// let opml = OPML::default();
/// let mut file = File::create("file.opml").unwrap();
/// let mut file = std::fs::File::create("file.opml").unwrap();
/// let xml = opml.to_writer(&mut file).unwrap();
/// ```
pub fn to_writer<W>(&self, writer: &mut W) -> Result<(), Error>
@ -265,7 +212,7 @@ impl OPML {
W: std::io::Write,
{
let xml_string = self.to_string()?;
writer.write_all(&xml_string.as_bytes())?;
writer.write_all(xml_string.as_bytes())?;
Ok(())
}
}
@ -280,10 +227,18 @@ impl Default for OPML {
}
}
/// The [Head](struct.Head.html) child element of [OPML](struct.OPML.html).
/// Contains the metadata of the OPML document.
/// The [`Head`] child element of [`OPML`]. Contains the metadata of the OPML
/// document.
#[derive(
XmlWrite, XmlRead, PartialEq, Debug, Clone, Default, Serialize, Deserialize,
XmlWrite,
XmlRead,
PartialEq,
Eq,
Debug,
Clone,
Default,
Serialize,
Deserialize,
)]
#[xml(tag = "head")]
pub struct Head {
@ -315,11 +270,16 @@ pub struct Head {
#[xml(flatten_text = "docs")]
pub docs: Option<String>,
/// A comma-separated list of line numbers that are expanded. The line numbers in the list tell you which headlines to expand. The order is important. For each element in the list, X, starting at the first summit, navigate flatdown X times and expand. Repeat for each element in the list.
/// A comma-separated list of line numbers that are expanded. The line numbers
/// in the list tell you which headlines to expand. The order is important.
/// For each element in the list, X, starting at the first summit, navigate
/// flatdown X times and expand. Repeat for each element in the list.
#[xml(flatten_text = "expansionState")]
pub expansion_state: Option<String>,
/// A number indicating which line of the outline is displayed on the top line of the window. This number is calculated with the expansion state already applied.
/// A number indicating which line of the outline is displayed on the top line
/// of the window. This number is calculated with the expansion state already
/// applied.
#[xml(flatten_text = "vertScrollState")]
pub vert_scroll_state: Option<i32>,
@ -340,50 +300,80 @@ pub struct Head {
pub window_right: Option<i32>,
}
/// The [Body](struct.Body.html) child element of [OPML](struct.OPML.html). Contains all the [Outlines](struct.Outline.html).
/// The [`Body`] child element of [`OPML`]. Contains all the [`Outline`]
/// elements.
#[derive(
XmlWrite, XmlRead, PartialEq, Debug, Clone, Default, Serialize, Deserialize,
XmlWrite,
XmlRead,
PartialEq,
Eq,
Debug,
Clone,
Default,
Serialize,
Deserialize,
)]
#[xml(tag = "body")]
pub struct Body {
/// All the top-level [Outline](struct.Outline.html) elements.
/// All the top-level [`Outline`] elements.
#[xml(child = "outline")]
pub outlines: Vec<Outline>,
}
/// The [Outline](struct.Outline.html) element.
/// The [`Outline`] element.
#[derive(
XmlWrite, XmlRead, PartialEq, Debug, Clone, Default, Serialize, Deserialize,
XmlWrite,
XmlRead,
PartialEq,
Eq,
Debug,
Clone,
Default,
Serialize,
Deserialize,
)]
#[xml(tag = "outline")]
pub struct Outline {
/// Every outline element must have at least a text attribute, which is what is displayed when an outliner opens the OPML document.
/// Version 1.0 OPML documents may omit this attribute, so for compatibility and strictness this attribute is "technically optional" as it will be replaced by an empty String if it is omitted.
/// Every outline element must have at least a text attribute, which is what
/// is displayed when an outliner opens the OPML document.
///
/// Version 1.0 OPML documents may omit this attribute, so for compatibility
/// and strictness this attribute is "technically optional" as it will be
/// replaced by an empty String if it is omitted.
///
/// Text attributes may contain encoded HTML markup.
#[xml(default, attr = "text")]
pub text: String,
/// A string that indicates how the other attributes of the [Outline](struct.Outline.html) should be interpreted.
/// A string that indicates how the other attributes of the [`Outline`]
/// should be interpreted.
#[xml(attr = "type")]
pub r#type: Option<String>,
/// Indicating whether the outline is commented or not. By convention if an outline is commented, all subordinate outlines are considered to also be commented.
/// Indicating whether the outline is commented or not. By convention if an
/// outline is commented, all subordinate outlines are considered to also be
/// commented.
#[xml(attr = "isComment")]
pub is_comment: Option<bool>,
/// Indicating whether a breakpoint is set on this outline. This attribute is mainly necessary for outlines used to edit scripts.
/// Indicating whether a breakpoint is set on this outline. This attribute is
/// mainly necessary for outlines used to edit scripts.
#[xml(attr = "isBreakpoint")]
pub is_breakpoint: Option<bool>,
/// The date-time (RFC822) that this [Outline](struct.Outline.html) element was created.
/// The date-time (RFC822) that this [`Outline`] element was created.
#[xml(attr = "created")]
pub created: Option<String>,
/// A string of comma-separated slash-delimited category strings, in the format defined by the [RSS 2.0 category](http://cyber.law.harvard.edu/rss/rss.html#ltcategorygtSubelementOfLtitemgt) element. To represent a "tag," the category string should contain no slashes.
/// A string of comma-separated slash-delimited category strings, in the
/// format defined by the [RSS 2.0 category] element. To represent a "tag",
/// the category string should contain no slashes.
///
/// [RSS 2.0 category]: https://cyber.law.harvard.edu/rss/rss.html#ltcategorygtSubelementOfLtitemgt
#[xml(attr = "category")]
pub category: Option<String>,
/// Child [Outline](struct.Outline.html) elements of the current one.
/// Child [`Outline`] elements of the current one.
#[xml(child = "outline")]
pub outlines: Vec<Outline>,
@ -411,18 +401,21 @@ pub struct Outline {
#[xml(attr = "version")]
pub version: Option<String>,
/// A link that can point to another OPML document or to something that can be displayed in a web browser.
/// A link that can point to another OPML document or to something that can
/// be displayed in a web browser.
#[xml(attr = "url")]
pub url: Option<String>,
}
impl Outline {
/// Helper function to add an [Outline](struct.Outline.html) element with `text` and `xml_url` attributes as a child element. Useful for creating grouped lists. This function [also exists on the OPML struct](struct.OPML.html#method.add_feed) for non-grouped lists.
/// Helper function to add an [`Outline`] element with `text` and `xml_url`
/// attributes as a child element, useful for creating grouped lists. This
/// function also exists as [`OPML::add_feed`] for non-grouped lists.
///
/// # Example
///
/// ```rust
/// use opml::{Outline};
/// use opml::Outline;
///
/// let mut group = Outline::default();
/// group.add_feed("Feed Name", "https://example.com/");

View File

@ -0,0 +1,11 @@
use opml::OPML;
#[test]
#[allow(deprecated)]
fn test_deprecated_functions() {
let xml = r#"<opml version="2.0"><head/><body><outline text="Outline"/></body></opml>"#;
let document = OPML::new(xml).unwrap();
assert_eq!(document.version, "2.0");
assert!(document.to_xml().is_ok());
}

View File

@ -0,0 +1,8 @@
<opml version="2.0">
<head>
<docs />
</head>
<body>
<outline text="Outline Text"/>
</body>
</opml>

View File

@ -14,7 +14,7 @@ pub fn test_spec_samples() -> Result<(), Box<dyn Error>> {
];
for sample in samples {
let sample_content = fs::read_to_string(&sample)?;
let sample_content = fs::read_to_string(sample)?;
OPML::from_str(&sample_content)?;
}

View File

@ -20,6 +20,26 @@ fn test_minimum_valid_opml() {
);
}
#[test]
fn test_valid_empty_docs() {
assert_eq!(
OPML::from_str(&read("tests/samples/empty_docs.opml").unwrap()).unwrap(),
OPML {
version: "2.0".to_string(),
head: Some(Head {
docs: Some("".to_string()),
..Head::default()
}),
body: Body {
outlines: vec![Outline {
text: "Outline Text".to_string(),
..Outline::default()
}]
},
}
)
}
#[test]
fn test_valid_opml_with_everything() {
assert_eq!(
@ -99,3 +119,17 @@ fn test_valid_opml_1_0() {
}
);
}
#[test]
fn test_valid_from_reader() {
let xml = r#"<opml version="2.0"><head/><body><outline text="Outline"/></body></opml>"#;
assert!(OPML::from_reader(&mut xml.as_bytes()).is_ok());
}
#[test]
fn test_valid_to_writer() {
let document = OPML::default();
let mut writer = vec![];
assert!(document.to_writer(&mut writer).is_ok());
assert!(!writer.is_empty());
}

View File

@ -2,13 +2,13 @@
[package]
name = "opml_cli"
description = "An OPML parser for the command-line."
version = "1.1.1"
authors = ["Holllo <helllo@holllo.cc>"]
description = "OPML for the command-line."
repository = "https://git.bauke.xyz/Holllo/opml"
license = "MIT OR Apache-2.0"
repository = "https://github.com/Holllo/opml"
version = "1.1.6"
authors = ["Holllo <helllo@holllo.org>"]
edition = "2021"
readme = "../README.md"
edition = "2018"
keywords = ["xml", "opml"]
[[bin]]
@ -16,13 +16,21 @@ name = "opml"
path = "source/main.rs"
[dependencies]
clap = "2.33"
opml = { path = "../opml_api", version = "1.1.1" }
serde_json = "1.0"
serde_json = "1.0.111"
[dependencies.clap]
version = "4.4.18"
features = ["derive"]
[dependencies.opml]
path = "../opml_api"
version = "1.1.5"
[dependencies.serde]
version = "1.0"
version = "1.0.195"
features = ["derive"]
[dev-dependencies]
assert_cmd = "1.0"
assert_cmd = "2.0.13"
insta = "1.34.0"
test-case = "3.3.1"

View File

@ -1,6 +1,6 @@
The MIT License
Copyright (c) 2020-2021 Holllo <helllo@holllo.cc>
Copyright (c) 2020-2024 Holllo <helllo@holllo.org>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,70 +1,43 @@
use std::fs::read_to_string;
use std::{fs::read_to_string, path::PathBuf};
use clap::{
crate_authors, crate_description, crate_version, App, Arg, ArgGroup,
};
use clap::Parser;
use opml::{Outline, OPML};
#[derive(Debug, Parser)]
#[clap(about, author, version)]
struct Args {
/// The OPML file to parse.
#[clap(short, long)]
file: PathBuf,
/// Output the OPML as JSON.
#[clap(long, group = "format", required = true)]
json: bool,
/// Output the OPML as pretty-printed JSON.
#[clap(long, group = "format", required = true)]
json_pretty: bool,
/// Only output the outline text and xmlUrl attributes when both are present
/// in the outline element.
#[clap(long, group = "format", required = true)]
rss: bool,
/// Print extra information while running.
#[clap(long)]
verbose: bool,
}
fn main() {
let cli = App::new("OPML CLI")
.about(crate_description!())
.author(crate_authors!())
.version(crate_version!())
.args(&[
// Format flags.
Arg::with_name("json")
.long("json")
.long_help("Output the OPML as JSON.")
.takes_value(false),
Arg::with_name("json pretty")
.long("json-pretty")
.long_help("Output the OPML as pretty-printed JSON.")
.takes_value(false),
Arg::with_name("rss")
.long("rss")
.long_help(
"Only output the outline text and xmlUrl attributes \
when both are present in the outline element.",
)
.takes_value(false),
// Boolean flags.
Arg::with_name("verbose")
.long("verbose")
.long_help("Print extra information while running.")
.takes_value(false),
// Options that are only allowed once.
Arg::with_name("file")
.long("file")
.long_help("The OPML file to parse.")
.required(true)
.short("f")
.takes_value(true),
])
.group(
ArgGroup::with_name("format")
.args(&["json", "json pretty", "rss"])
.required(true),
)
.get_matches();
// Extract format flags.
let json = cli.is_present("json");
let json_pretty = cli.is_present("json pretty");
let rss = cli.is_present("rss");
// Extract boolean flags.
let verbose = cli.is_present("verbose");
// Extract the various options.
let file = cli.value_of("file").unwrap();
let args = Args::parse();
// Read the file to string.
let xml = read_to_string(file).expect("Failed to read OPML file");
let xml = read_to_string(args.file).expect("Failed to read OPML file");
// Parse the OPML from the read file.
let opml = OPML::from_str(&xml).expect("Failed to parse OPML file");
if rss {
if args.rss {
// Get all the outlines from the OPML document.
let outlines = extract_all_outlines(&opml.body.outlines);
@ -73,19 +46,19 @@ fn main() {
if let Some(xml_url) = outline.xml_url {
println!("{}", outline.text);
println!("{}", xml_url);
} else if verbose {
} else if args.verbose {
println!(
"Skipping \"{}\" because it did not have an xmlUrl attribute.",
outline.text
);
}
}
} else if json {
} else if args.json {
println!(
"{}",
serde_json::to_string(&opml).expect("Failed to convert OPML to JSON")
);
} else if json_pretty {
} else if args.json_pretty {
println!(
"{}",
serde_json::to_string_pretty(&opml)

25
opml_cli/tests/cli.rs Normal file
View File

@ -0,0 +1,25 @@
use {
assert_cmd::Command, insta::assert_display_snapshot, test_case::test_case,
};
const SAMPLE: &str = "tests/sample.opml";
#[test_case(&["--file", SAMPLE, "--json"], "json" ; "json")]
#[test_case(&["--file", SAMPLE, "--json-pretty"], "json_pretty" ; "json_pretty")]
#[test_case(&["--file", SAMPLE, "--rss"], "rss" ; "rss")]
fn test_valid(args: &[&str], name: &str) {
let mut cmd = Command::cargo_bin("opml").unwrap();
let assert = cmd.args(args).assert().success().code(0);
let output = String::from_utf8(assert.get_output().stdout.clone()).unwrap();
assert_display_snapshot!(name, output);
}
#[test_case(&["--rss"], "missing_file" ; "missing_file")]
#[test_case(&["--file", SAMPLE], "missing_format" ; "missing_format")]
#[test_case(&["--rss", "--json"], "multiple_formats" ; "multiple_formats")]
fn test_invalid(args: &[&'static str], name: &str) {
let mut cmd = Command::cargo_bin("opml").unwrap();
let assert = cmd.args(args).assert().failure().code(2);
let output = String::from_utf8(assert.get_output().stderr.clone()).unwrap();
assert_display_snapshot!(name, output);
}

View File

@ -1,27 +0,0 @@
use std::fs::read_to_string;
use assert_cmd::Command;
const SAMPLE: &str = "tests/samples/youtube.opml";
#[test]
fn test_missing_file() {
let mut cmd = Command::cargo_bin("opml").unwrap();
let assert = cmd.args(&["--rss"]).assert();
assert
.failure()
.code(1)
.stderr(read_to_string("tests/snapshots/missing-file.txt").unwrap());
}
#[test]
fn test_missing_format() {
let mut cmd = Command::cargo_bin("opml").unwrap();
let assert = cmd.args(&["--file", SAMPLE]).assert();
assert
.failure()
.code(1)
.stderr(read_to_string("tests/snapshots/missing-format.txt").unwrap());
}

View File

@ -1,15 +0,0 @@
<opml version="1.1">
<body>
<outline text="YouTube Subscriptions"
title="YouTube Subscriptions">
<outline text="A YouTube Channel"
title="A YouTube Channel"
type="rss"
xmlUrl="https://www.youtube.com/feeds/videos.xml?channel_id=abcdefghijklmnopqrstuvwxyz1" />
<outline text="Another YouTube Channel"
title="Another YouTube Channel"
type="rss"
xmlUrl="https://www.youtube.com/feeds/videos.xml?channel_id=abcdefghijklmnopqrstuvwxyz2" />
</outline>
</body>
</opml>

View File

@ -0,0 +1,6 @@
---
source: opml_cli/tests/cli.rs
expression: output
---
{"version":"2.0","head":{"title":"Rust Feeds","date_created":null,"date_modified":null,"owner_name":null,"owner_email":null,"owner_id":null,"docs":null,"expansion_state":null,"vert_scroll_state":null,"window_top":null,"window_left":null,"window_bottom":null,"window_right":null},"body":{"outlines":[{"text":"Rust Blog","type":null,"is_comment":null,"is_breakpoint":null,"created":null,"category":null,"outlines":[],"xml_url":"https://blog.rust-lang.org/feed.xml","description":null,"html_url":null,"language":null,"title":null,"version":null,"url":null},{"text":"Inside Rust","type":null,"is_comment":null,"is_breakpoint":null,"created":null,"category":null,"outlines":[],"xml_url":"https://blog.rust-lang.org/inside-rust/feed.xml","description":null,"html_url":null,"language":null,"title":null,"version":null,"url":null}]}}

View File

@ -0,0 +1,59 @@
---
source: opml_cli/tests/cli.rs
expression: output
---
{
"version": "2.0",
"head": {
"title": "Rust Feeds",
"date_created": null,
"date_modified": null,
"owner_name": null,
"owner_email": null,
"owner_id": null,
"docs": null,
"expansion_state": null,
"vert_scroll_state": null,
"window_top": null,
"window_left": null,
"window_bottom": null,
"window_right": null
},
"body": {
"outlines": [
{
"text": "Rust Blog",
"type": null,
"is_comment": null,
"is_breakpoint": null,
"created": null,
"category": null,
"outlines": [],
"xml_url": "https://blog.rust-lang.org/feed.xml",
"description": null,
"html_url": null,
"language": null,
"title": null,
"version": null,
"url": null
},
{
"text": "Inside Rust",
"type": null,
"is_comment": null,
"is_breakpoint": null,
"created": null,
"category": null,
"outlines": [],
"xml_url": "https://blog.rust-lang.org/inside-rust/feed.xml",
"description": null,
"html_url": null,
"language": null,
"title": null,
"version": null,
"url": null
}
]
}
}

View File

@ -0,0 +1,13 @@
---
source: opml_cli/tests/cli.rs
expression: output
---
error: the following required arguments were not provided:
--file <FILE>
--json
--json-pretty
Usage: opml --file <FILE> --json --json-pretty --rss
For more information, try '--help'.

View File

@ -0,0 +1,13 @@
---
source: opml_cli/tests/cli.rs
expression: output
---
error: the following required arguments were not provided:
--json
--json-pretty
--rss
Usage: opml --file <FILE> --json --json-pretty --rss
For more information, try '--help'.

View File

@ -0,0 +1,10 @@
---
source: opml_cli/tests/cli.rs
expression: output
---
error: the argument '--rss' cannot be used with '--json'
Usage: opml --file <FILE> --json --json-pretty --rss
For more information, try '--help'.

View File

@ -0,0 +1,9 @@
---
source: opml_cli/tests/cli.rs
expression: output
---
Rust Blog
https://blog.rust-lang.org/feed.xml
Inside Rust
https://blog.rust-lang.org/inside-rust/feed.xml

View File

@ -1,57 +0,0 @@
{
"version": "1.1",
"head": null,
"body": {
"outlines": [
{
"text": "YouTube Subscriptions",
"type": null,
"is_comment": null,
"is_breakpoint": null,
"created": null,
"category": null,
"outlines": [
{
"text": "A YouTube Channel",
"type": "rss",
"is_comment": null,
"is_breakpoint": null,
"created": null,
"category": null,
"outlines": [],
"xml_url": "https://www.youtube.com/feeds/videos.xml?channel_id=abcdefghijklmnopqrstuvwxyz1",
"description": null,
"html_url": null,
"language": null,
"title": "A YouTube Channel",
"version": null,
"url": null
},
{
"text": "Another YouTube Channel",
"type": "rss",
"is_comment": null,
"is_breakpoint": null,
"created": null,
"category": null,
"outlines": [],
"xml_url": "https://www.youtube.com/feeds/videos.xml?channel_id=abcdefghijklmnopqrstuvwxyz2",
"description": null,
"html_url": null,
"language": null,
"title": "Another YouTube Channel",
"version": null,
"url": null
}
],
"xml_url": null,
"description": null,
"html_url": null,
"language": null,
"title": "YouTube Subscriptions",
"version": null,
"url": null
}
]
}
}

View File

@ -1 +0,0 @@
{"version":"1.1","head":null,"body":{"outlines":[{"text":"YouTube Subscriptions","type":null,"is_comment":null,"is_breakpoint":null,"created":null,"category":null,"outlines":[{"text":"A YouTube Channel","type":"rss","is_comment":null,"is_breakpoint":null,"created":null,"category":null,"outlines":[],"xml_url":"https://www.youtube.com/feeds/videos.xml?channel_id=abcdefghijklmnopqrstuvwxyz1","description":null,"html_url":null,"language":null,"title":"A YouTube Channel","version":null,"url":null},{"text":"Another YouTube Channel","type":"rss","is_comment":null,"is_breakpoint":null,"created":null,"category":null,"outlines":[],"xml_url":"https://www.youtube.com/feeds/videos.xml?channel_id=abcdefghijklmnopqrstuvwxyz2","description":null,"html_url":null,"language":null,"title":"Another YouTube Channel","version":null,"url":null}],"xml_url":null,"description":null,"html_url":null,"language":null,"title":"YouTube Subscriptions","version":null,"url":null}]}}

View File

@ -1,7 +0,0 @@
error: The following required arguments were not provided:
--file <file>
USAGE:
opml --file <file> <--json|--json-pretty|--rss>
For more information try --help

View File

@ -1,7 +0,0 @@
error: The following required arguments were not provided:
<--json|--json-pretty|--rss>
USAGE:
opml [FLAGS] --file <file> <--json|--json-pretty|--rss>
For more information try --help

View File

@ -1,4 +0,0 @@
A YouTube Channel
https://www.youtube.com/feeds/videos.xml?channel_id=abcdefghijklmnopqrstuvwxyz1
Another YouTube Channel
https://www.youtube.com/feeds/videos.xml?channel_id=abcdefghijklmnopqrstuvwxyz2

View File

@ -1,38 +0,0 @@
use std::fs::read_to_string;
use assert_cmd::Command;
const SAMPLE: &str = "tests/samples/youtube.opml";
#[test]
fn test_valid_rss() {
let mut cmd = Command::cargo_bin("opml").unwrap();
let assert = cmd.args(&["--file", SAMPLE, "--rss"]).assert();
assert
.success()
.code(0)
.stdout(read_to_string("tests/snapshots/rss.txt").unwrap());
}
#[test]
fn test_valid_json() {
let mut cmd = Command::cargo_bin("opml").unwrap();
let assert = cmd.args(&["--file", SAMPLE, "--json"]).assert();
assert
.success()
.code(0)
.stdout(read_to_string("tests/snapshots/json.json").unwrap());
}
#[test]
fn test_valid_json_pretty() {
let mut cmd = Command::cargo_bin("opml").unwrap();
let assert = cmd.args(&["--file", SAMPLE, "--json-pretty"]).assert();
assert
.success()
.code(0)
.stdout(read_to_string("tests/snapshots/json-pretty.json").unwrap());
}

3
rustup-toolchain.toml Normal file
View File

@ -0,0 +1,3 @@
[toolchain]
channel = "stable"
components = ["cargo", "clippy", "rustfmt", "rust-src"]

18
shell.nix Normal file
View File

@ -0,0 +1,18 @@
{ pkgs ? import <nixpkgs> { } }:
with pkgs;
let
rustup-toolchain = rust-bin.fromRustupToolchainFile ./rustup-toolchain.toml;
in
mkShell rec {
packages = [
cargo-audit
cargo-edit
cargo-insta
cargo-make
cargo-outdated
cargo-tarpaulin
rustup-toolchain
];
}