-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added the private-leaderboard command
* Added a command to show a private leaderboard. Closes #41
- Loading branch information
Showing
31 changed files
with
972 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
[package] | ||
name = "elv" | ||
description = "A little CLI helper for Advent of Code. 🎄" | ||
version = "0.13.0" | ||
version = "0.13.1" | ||
authors = ["Konrad Pagacz <[email protected]>"] | ||
edition = "2021" | ||
readme = "README.md" | ||
|
@@ -24,6 +24,7 @@ cssparser = "0.29.6" | |
directories = "4.0.1" | ||
config = "0.13.2" | ||
serde = "1.0.130" | ||
serde_json = "1.0.107" | ||
toml = "0.5.9" | ||
serde_cbor = "0.11.2" | ||
chrono = { version = "0.4.26", features = ["serde"] } | ||
|
@@ -32,6 +33,7 @@ html2text = "0.4.5" | |
regex = "1.7.1" | ||
thiserror = "1.0.43" | ||
anyhow = "1.0.72" | ||
colored = "2.0.4" | ||
|
||
[target.x86_64-unknown-linux-musl.dependencies] | ||
openssl = { version = "0.10", features = ["vendored"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,12 @@ | ||
mod description; | ||
mod duration_string; | ||
mod leaderboard; | ||
pub mod description; | ||
pub mod duration_string; | ||
pub mod leaderboard; | ||
pub mod ports; | ||
mod riddle_date; | ||
mod riddle_part; | ||
pub mod private_leaderboard; | ||
pub mod riddle_date; | ||
pub mod riddle_part; | ||
pub(crate) mod solved_parts; | ||
pub mod stars; | ||
mod submission; | ||
mod submission_result; | ||
mod submission_status; | ||
|
||
pub use crate::domain::description::Description; | ||
pub use crate::domain::duration_string::DurationString; | ||
pub use crate::domain::leaderboard::{Leaderboard, LeaderboardEntry, LeaderboardError}; | ||
pub use crate::domain::riddle_date::RiddleDate; | ||
pub use crate::domain::riddle_part::RiddlePart; | ||
pub use crate::domain::submission::Submission; | ||
pub use crate::domain::submission_result::SubmissionResult; | ||
pub use crate::domain::submission_status::SubmissionStatus; | ||
pub mod submission; | ||
pub mod submission_result; | ||
pub mod submission_status; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
pub(crate) mod aoc_client; | ||
pub(crate) mod errors; | ||
pub(crate) mod get_leaderboard; | ||
pub(crate) mod get_private_leaderboard; | ||
pub(crate) mod get_stars; | ||
pub(crate) mod input_cache; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use crate::domain::private_leaderboard::PrivateLeaderboard; | ||
|
||
use super::errors::AocClientError; | ||
|
||
pub trait GetPrivateLeaderboard { | ||
fn get_private_leaderboard( | ||
&self, | ||
leaderboard_id: &str, | ||
year: i32, | ||
) -> Result<PrivateLeaderboard, AocClientError>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use super::solved_parts::SolvedParts; | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct PrivateLeaderboard { | ||
pub entries: Vec<PrivateLeaderboardEntry>, | ||
} | ||
|
||
impl PrivateLeaderboard { | ||
pub fn new(mut entries: Vec<PrivateLeaderboardEntry>) -> Self { | ||
entries.sort_by(|first, second| second.points.cmp(&first.points)); | ||
Self { entries } | ||
} | ||
} | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct PrivateLeaderboardEntry { | ||
pub user: String, | ||
pub points: usize, | ||
pub stars: Vec<SolvedParts>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.