diff --git a/.github/workflows/CICD.yaml b/.github/workflows/CICD.yaml index ba6e96e..9c591a7 100644 --- a/.github/workflows/CICD.yaml +++ b/.github/workflows/CICD.yaml @@ -59,7 +59,6 @@ jobs: matrix: rust: - stable - - 1.74.0 steps: - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 @@ -80,7 +79,6 @@ jobs: matrix: rust: - stable - - 1.74.0 steps: - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 @@ -141,3 +139,22 @@ jobs: if: startsWith(github.ref, 'refs/tags/') with: files: build/rodalies-cli* + + release: + name: Publish (crates.io) + if: startsWith(github.ref, 'refs/tags/') + needs: [build] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - name: Login + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + run: cargo login + - name: Publish + run: cargo publish diff --git a/Cargo.lock b/Cargo.lock index 10bb5cf..5c6c46f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -350,9 +350,9 @@ dependencies = [ [[package]] name = "async-stream" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" +checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" dependencies = [ "async-stream-impl", "futures-core", @@ -361,13 +361,13 @@ dependencies = [ [[package]] name = "async-stream-impl" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" +checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -391,13 +391,13 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.82" +version = "0.1.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -408,9 +408,9 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "backtrace" @@ -504,15 +504,15 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.7.1" +version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" +checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" [[package]] name = "cc" -version = "1.1.19" +version = "1.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d74707dde2ba56f86ae90effb3b43ddd369504387e718014de010cec7959800" +checksum = "812acba72f0a070b003d3697490d2b55b837230ae7c6c6497f05cc2ddbb8d938" dependencies = [ "shlex", ] @@ -548,18 +548,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.17" +version = "4.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e5a21b8495e732f1b3c364c9949b201ca7bae518c502c80256c96ad79eaf6ac" +checksum = "7be5744db7978a28d9df86a214130d106a89ce49644cbc4e3f0c22c3fba30615" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.5.17" +version = "4.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cf2dd12af7a047ad9d6da2b6b249759a22a7abc0f474c1dae1777afa4b21a73" +checksum = "a5fbc17d3ef8278f55b282b2a2e75ae6f6c7d4bb70ed3d0382375104bfafdb4b" dependencies = [ "anstream", "anstyle", @@ -567,7 +567,7 @@ dependencies = [ "strsim", "terminal_size", "unicase", - "unicode-width", + "unicode-width 0.2.0", ] [[package]] @@ -691,7 +691,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" dependencies = [ "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -759,7 +759,7 @@ checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -1001,7 +1001,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -1059,7 +1059,7 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" dependencies = [ - "unicode-width", + "unicode-width 0.1.14", ] [[package]] @@ -1161,7 +1161,7 @@ dependencies = [ "markup5ever", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -1207,15 +1207,15 @@ dependencies = [ [[package]] name = "httparse" -version = "1.9.4" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" [[package]] name = "iana-time-zone" -version = "0.1.60" +version = "0.1.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -1332,9 +1332,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.158" +version = "0.2.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" [[package]] name = "libredox" @@ -1493,9 +1493,12 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.20.0" +version = "1.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ea5043e58958ee56f3e15a90aee535795cd7dfd319846288d93c5b57d85cbe" +checksum = "82881c4be219ab5faaf2ad5e5e5ecdff8c66bd7402ca3160975c93b24961afd1" +dependencies = [ + "portable-atomic", +] [[package]] name = "opaque-debug" @@ -1607,7 +1610,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -1645,7 +1648,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -1713,6 +1716,12 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "portable-atomic" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2" + [[package]] name = "ppv-lite86" version = "0.2.20" @@ -1769,7 +1778,7 @@ dependencies = [ "is-terminal", "lazy_static", "term", - "unicode-width", + "unicode-width 0.1.14", ] [[package]] @@ -1869,9 +1878,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.4" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0884ad60e090bf1345b93da0a5de8923c93884cd03f40dfcfddd3b4bee661853" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" dependencies = [ "bitflags 2.6.0", ] @@ -1889,9 +1898,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.6" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" dependencies = [ "aho-corasick", "memchr", @@ -1901,9 +1910,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" dependencies = [ "aho-corasick", "memchr", @@ -1912,9 +1921,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "ring" @@ -1933,7 +1942,7 @@ dependencies = [ [[package]] name = "rodalies-cli" -version = "1.2.3" +version = "1.2.4" dependencies = [ "assert_cmd", "chrono", @@ -2097,7 +2106,7 @@ checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -2377,9 +2386,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.77" +version = "2.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" dependencies = [ "proc-macro2", "quote", @@ -2410,12 +2419,12 @@ dependencies = [ [[package]] name = "terminal_size" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" +checksum = "4f599bd7ca042cfdf8f4512b277c02ba102247820f9d9d4a9f521f496751a6ef" dependencies = [ "rustix 0.38.37", - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] @@ -2426,22 +2435,22 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -2523,7 +2532,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -2583,9 +2592,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" +checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" [[package]] name = "unicode-ident" @@ -2595,18 +2604,24 @@ checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-normalization" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" dependencies = [ "tinyvec", ] [[package]] name = "unicode-width" -version = "0.1.13" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + +[[package]] +name = "unicode-width" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" +checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" [[package]] name = "universal-hash" @@ -2709,7 +2724,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", "wasm-bindgen-shared", ] @@ -2743,7 +2758,7 @@ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2980,5 +2995,5 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] diff --git a/Cargo.toml b/Cargo.toml index 6492caa..6784c93 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rodalies-cli" -version = "1.2.3" +version = "1.2.4" edition = "2021" authors = ["Gerard C.L. "] license = "BSD-3-Clause" diff --git a/README.md b/README.md index a8c4fcd..cf82314 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ After a release a github action updates it with x86_64 built binaries for: Run the following command to get the binary into your bin folder or tune it as you like: ```bash -curl -LO "https://github.com/gerardcl/rodalies-cli/releases/download/1.2.3/rodalies-cli-linux-amd64" && \ +curl -LO "https://github.com/gerardcl/rodalies-cli/releases/download/1.2.4/rodalies-cli-linux-amd64" && \ chmod +x rodalies-cli-linux-amd64 && mv rodalies-cli-linux-amd64 /usr/local/bin/rodalies-cli ``` @@ -28,7 +28,7 @@ chmod +x rodalies-cli-linux-amd64 && mv rodalies-cli-linux-amd64 /usr/local/bin/ Run the following command to get the binary into your bin folder or tune it as you like: ```bash -curl -LO "https://github.com/gerardcl/rodalies-cli/releases/download/1.2.3/rodalies-cli-darwin-amd64" && \ +curl -LO "https://github.com/gerardcl/rodalies-cli/releases/download/1.2.4/rodalies-cli-darwin-amd64" && \ chmod +x rodalies-cli-darwin-amd64 && mv rodalies-cli-darwin-amd64 /usr/local/bin/rodalies-cli ``` @@ -39,7 +39,7 @@ chmod +x rodalies-cli-darwin-amd64 && mv rodalies-cli-darwin-amd64 /usr/local/bi Run the following command to get the binary into your bin folder or tune it as you like: ```bash -curl -LO "https://github.com/gerardcl/rodalies-cli/releases/download/1.2.3/rodalies-cli-windows-amd64.exe" && \ +curl -LO "https://github.com/gerardcl/rodalies-cli/releases/download/1.2.4/rodalies-cli-windows-amd64.exe" && \ chmod +x rodalies-cli-windows-amd64.exe && mv rodalies-cli-windows-amd64.exe /mingw64/bin/rodalies-cli.exe ``` @@ -131,7 +131,7 @@ $ rodalies-cli -d 9 -m 9 ```bash $ rodalies-cli -s gir 🚂 Rodalies CLI 📅 Today's date is 02/08/2022 -✅ You are running the latest rodalies-cli, version 1.2.3! yayy +✅ You are running the latest rodalies-cli, version 1.2.4! yayy ✨ Interactive mode enabled: 'false' 🔍 Searching stations that contain the text: 'gir' +--------------+------------+ @@ -142,7 +142,7 @@ $ rodalies-cli -s gir $ rodalies-cli -s si 🚂 Rodalies CLI 📅 Today's date is 02/08/2022 -✅ You are running the latest rodalies-cli, version 1.2.3! yayy +✅ You are running the latest rodalies-cli, version 1.2.4! yayy ✨ Interactive mode enabled: 'false' 🔍 Searching stations that contain the text: 'si' +------------------------+------------+ @@ -159,7 +159,7 @@ $ rodalies-cli -s si ```bash $ rodalies-cli -f 79300 -t 79202 🚂 Rodalies CLI 📅 Today's date is 02/08/2022 -✅ You are running the latest rodalies-cli, version 1.2.3! yayy +✅ You are running the latest rodalies-cli, version 1.2.4! yayy ✨ Interactive mode enabled: 'false' 🔍 Searching timetable for date 02/08/2022 📆 Listing timetable with 0 transfers @@ -208,7 +208,7 @@ If the timetable requires a transfer you will also see it: ```bash $ rodalies-cli -f 79300 -t 71701 🚂 Rodalies CLI 📅 Today's date is 02/08/2022 -✅ You are running the latest rodalies-cli, version 1.2.3! yayy +✅ You are running the latest rodalies-cli, version 1.2.4! yayy ✨ Interactive mode enabled: 'false' 🔍 Searching timetable for date 02/08/2022 📆 Listing timetable with 1 transfers @@ -249,7 +249,7 @@ $ rodalies-cli -f 79300 -t 71701 ```bash $ rodalies-cli -f 79300 -t 72503 🚂 Rodalies CLI 📅 Today's date is 02/08/2022 -✅ You are running the latest rodalies-cli, version 1.2.3! yayy +✅ You are running the latest rodalies-cli, version 1.2.4! yayy ✨ Interactive mode enabled: 'false' 🔍 Searching timetable for date 02/08/2022 📆 Listing timetable with 2 transfers diff --git a/src/main.rs b/src/main.rs index 7ea2ff2..653bb98 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ +use chrono::{Datelike, Local}; use std::error::Error; -use chrono::{Datelike, Local}; use rodalies_cli::config::check::check_rodalies_version; use rodalies_cli::config::cli::{init_cli, interactive_mode}; use rodalies_cli::rodalies::client::init_client; diff --git a/src/rodalies/station.rs b/src/rodalies/station.rs index b680af9..368d0b0 100644 --- a/src/rodalies/station.rs +++ b/src/rodalies/station.rs @@ -10,7 +10,7 @@ use crate::{ }; /// The Station information struct -#[derive(Clone)] +#[derive(Clone, Debug)] pub struct Station { /// The internal ID of the station name, that is provided by the rodalies site. It is the value used when submitting a search. pub id: String, @@ -22,7 +22,7 @@ pub struct Station { pub async fn get_stations_list(client: &Client) -> Result, Box> { let parsed_html = get_search_page(client).await?; - let selector = &Selector::parse(r#"#origen > option"#).unwrap(); + let selector = &Selector::parse(r#"#origen > option"#)?; let station_id: Vec<&str> = parsed_html .select(selector) diff --git a/src/rodalies/timetable.rs b/src/rodalies/timetable.rs index 02bb97c..f05e448 100644 --- a/src/rodalies/timetable.rs +++ b/src/rodalies/timetable.rs @@ -73,7 +73,7 @@ pub async fn search_timetable_input( let parsed_html = get_timetable_page(client, from, to, date).await?; // check, show and fail if displayed errors - let selector_errors = &Selector::parse(r#".error_contingut > p"#).unwrap(); + let selector_errors = &Selector::parse(r#".error_contingut > p"#)?; let errors: Vec<&str> = parsed_html .select(selector_errors) .flat_map(|el| el.text())