Skip to content

Commit

Permalink
feat(app): add options to disable notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
ja-ko committed Jun 2, 2024
1 parent 3dd8001 commit a5a37df
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@ Arguments:
[ROOM] Room to join
Options:
-n, --name <NAME> Name to use for this session
-s, --server <SERVER> Websocket URL to connect to
-S, --skip-update-check Skip the automatic update check and stay on the current version
-h, --help Print help
-V, --version Print version
-n, --name <NAME> Name to use for this session
-s, --server <SERVER> Websocket URL to connect to
-S, --skip-update-check Skip the automatic update check and stay on the current version
-N, --disable-notifications Disable notifications
-h, --help Print help
-V, --version Print version
```

You can also use environment variables to set each argument or option. For this prefix the option name with
Expand All @@ -57,4 +58,5 @@ name = "ja-ko"
room = "planning-room"
server = "wss://pp.discordia.network/"
skip_update_check = false
disable_notifications = false
```
6 changes: 5 additions & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ pub struct Cli {
/// Room to join.
#[arg()]
pub(crate) room: Option<String>,

/// Skip the automatic update check and stay on the current version.
#[arg(short = 'S', long)]
pub(crate) skip_update_check: bool,

/// Disable notifications
#[arg(short = 'N', long)]
pub(crate) disable_notifications: bool,
}
4 changes: 3 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ pub struct Config {
pub name: String,
pub room: String,
pub server: String,
pub skip_update_check: bool
pub skip_update_check: bool,
pub disable_notifications: bool,
}

impl Default for Config {
Expand All @@ -42,6 +43,7 @@ impl Default for Config {
room: petname::petname(3, "").expect("Failed to generate random room name"),
server: "wss://pp.discordia.network/".to_owned(),
skip_update_check: false,
disable_notifications: false,
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ fn main() -> AppResult<()> {
if cli.skip_update_check {
config.skip_update_check = true;
}
if cli.disable_notifications {
config.disable_notifications = true;
}

let update = update()?;
match update {
Expand Down

0 comments on commit a5a37df

Please sign in to comment.