Skip to content

Commit

Permalink
feat: minor improvements to private leaderboard
Browse files Browse the repository at this point in the history
* show leaderboard of past years without providing a day
* report unaccessible leaderboard on http 302 redirect
* on any unexpected http reponse, warn that cookie may be expired
  • Loading branch information
scarvalhojr committed Dec 15, 2022
1 parent 1823498 commit 82ef97b
Show file tree
Hide file tree
Showing 7 changed files with 195 additions and 93 deletions.
5 changes: 4 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ In particular, the commit message should start with one of the following types:
- **build**: Changes that affect the build system or external dependencies
- **ci**: Changes to CI or release configuration files and scripts

Before submitting your code, please run `cargo clippy` and resolve any warnings
it finds, and make sure your code is properly formatted with `cargo fmt`.

# Ideas

- Add a configuration file (in home or `.config` directory) that can store
Expand All @@ -43,7 +46,7 @@ In particular, the commit message should start with one of the following types:
and create a configuration file.
- `[l]ogin` - prompt for session cookie and save it in a user-protected file.
- `[pe]rsonal-stats` - show [personal stats](https://adventofcode.com/2022/leaderboard/self).
- `[pr]ivate-leaderboard` - show [private leaderboards](https://adventofcode.com/2022/leaderboard/private).
- `[pr]ivate-leaderboard` - already implemented!
- `[r]ead` - already implemented!
- `[se]t-config` - make changes to configuration file (e.g. `aoc set-config year 2015`).
- `[st]ats` - show [event stats](https://adventofcode.com/2022/stats).
Expand Down
22 changes: 11 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "aoc-cli"
description = "Advent of Code command-line tool"
version = "0.8.0"
version = "0.9.0"
authors = ["Sergio de Carvalho <[email protected]>"]
categories = ["command-line-utilities"]
edition = "2021"
Expand Down
37 changes: 32 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ comfort of your terminal.
Code event.
- Load Advent of Code session cookie from a file.
- Save puzzle description to a file in Markdown format.
- Show the state of private leaderboards.

## Installation options πŸŽ…

Expand Down Expand Up @@ -112,10 +113,11 @@ Advent of Code command-line tool
Usage: aoc [OPTIONS] [COMMAND]
Commands:
read Read puzzle statement (the default command) [aliases: r]
download Save puzzle description and input to files [aliases: d]
submit Submit puzzle answer [aliases: s]
help Print this message or the help of the given subcommand(s)
read Read puzzle statement (the default command) [aliases: r]
download Save puzzle description and input to files [aliases: d]
submit Submit puzzle answer [aliases: s]
private-leaderboard Show the state of a private leaderboard [aliases: p]
help Print this message or the help of the given subcommand(s)
Options:
-d, --day <DAY> Puzzle day [default: last unlocked day (during Advent of Code month)]
Expand Down Expand Up @@ -206,12 +208,37 @@ That's the right answer! You are one gold star closer to saving your vacation. [
[1] /2022/day/2#part2
```

### Show private leaderboard

If you are a member of a [private leaderboard](https://adventofcode.com/leaderboard/private),
you can see how you are faring against your friends by passing the leaderboad
number:

```
# aoc private-leaderboard 1234
[INFO aoc] πŸŽ„ aoc-cli - Advent of Code command-line tool
Private leaderboard of me & my friends for Advent of Code 2022.
1111111111222222
1234567890123456789012345
1) 254 β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…... Whitney Effertz
2) 252 β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜…β˜….β˜…β˜…β˜…. Emery Zboncak
3) 134 β˜…β˜…β˜…β˜…β˜…β˜…β˜…........ Ezra Parisian
4) 72 β˜…β˜…β˜…β˜…........... Asha Gerlach
5) 54 β˜…β˜…β˜…β˜…........... Frederik Robel
6) 20 β˜….............. Graciela Herzog
7) 0 ............... Thad Prohaska
```

### Command abbreviations

Any prefix of a command can be used instead of the full command name. For instance:
Any non-ambiguous prefix of a command can be used instead of the full command
name. For instance:
- Instead of `aoc read`, type `aoc r`, `aoc re` or `aoc rea`.
- Instead of `aoc download`, type `aoc d`, `aoc do`, `aoc dow`, `aoc down`, etc.
- Instead of `aoc submit`, type `aoc s`, `aoc su`, `aoc sub`, etc.
- Instead of `aoc private-leaderboard`, type `aoc p`, `aoc pr`, `aoc pri` etc.

### More examples

Expand Down
Loading

0 comments on commit 82ef97b

Please sign in to comment.