Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

empty tables #7

Merged
merged 6 commits into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 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,6 +1,6 @@
[package]
name = "kouran"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
authors = ["Jain Ramchurn"]
description = "View Power Outages in Mauritius"
Expand Down
2 changes: 1 addition & 1 deletion EN-README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

The data is sourced from a [dataset](https://github.com/MrSunshyne/mauritius-dataset-electricity) created by [Sandeep Ramgolam](https://github.com/MrSunshyne).

![demo](./assets/demo.jpeg)
![demo](./assets/demo.png)

## Features

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Bann done-la sorti depi enn [dataset](https://github.com/MrSunshyne/mauritius-dataset-electricity) ki finn kree par [Sandeep Ramgolam](https://github.com/MrSunshyne).

![demo](./assets/demo.jpeg)
![demo](./assets/demo.png)

## Fonksionalite

Expand All @@ -29,7 +29,7 @@ cargo install kouran
Pou bann itilizater macOS, ou kapav instal `kouran` avek Homebrew:

```bash
brew instal k3ii/tap/kouran
brew install k3ii/tap/kouran
```
Chek paz version pou instal bann biner ki finn konstrir alavans.

Expand Down
Binary file removed assets/demo.jpeg
Binary file not shown.
Binary file added assets/demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use clap::Command;

pub fn cli() -> Command {
Command::new("courant")
.version("0.1.0")
.version("0.1.1")
.author("Jain Ramchurn")
.subcommand(
Command::new("today")
Expand All @@ -12,7 +12,7 @@ pub fn cli() -> Command {
.subcommand(
Command::new("tomorrow")
.about("Show tomorrow's power outages")
.aliases(["demain", "dmain", "future"]),
.aliases(["demain", "dmain", "demin", "future"]),
)
.subcommand(
Command::new("all")
Expand Down
9 changes: 8 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ struct OutageEvent {
}

fn print_outage_events(events: &[OutageEvent], title: &str, is_today: bool) {
if events.is_empty() && is_today {
println!("There are no planned outages scheduled for today. 🎉");
return;
}

let mut table = Table::new();
let utc_plus_4 = FixedOffset::east_opt(4 * 3600).expect("Unable to create UTC+4 offset");
let now = Utc::now().with_timezone(&utc_plus_4);
Expand Down Expand Up @@ -97,7 +102,9 @@ async fn main() -> Result<(), reqwest::Error> {
}
Some(("all", _)) => {
print_outage_events(&outage.today, "Today's Outages", true);
println!("\n"); // Add a blank line between tables
if !outage.today.is_empty() {
println!("\n");
}
print_outage_events(&outage.future, "Future Outages", false);
}
_ => {
Expand Down