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

feat: notification scheduler #56

Merged
merged 9 commits into from
Dec 13, 2024
Merged

feat: notification scheduler #56

merged 9 commits into from
Dec 13, 2024

Conversation

jsonmaf1a
Copy link
Member

@jsonmaf1a jsonmaf1a commented Dec 10, 2024

This pull-request implements the feature discussed in #32
It adds support for scheduling notifications with the --schedule flag in the send command.

Supported Date and Time Formats:

  • Human readable duration (e.g., "2 hours", "10 minutes", "1m 25s")
  • %d.%m.%Y %H:%M — 01.01.2025 00:00
  • %d-%m-%Y %H:%M — 01-01-2025 00:00
  • %Y.%m.%d %H:%M — 2025.01.01 00:00
  • %Y-%m-%d %H:%M — 2025-01-01 00:00
  • %d.%m.%Y %I:%M %p — 01.01.2025 12:00 AM
  • %d-%m-%Y %I:%M %p — 01-01-2025 12:00 AM
  • %Y.%m.%d %I:%M %p — 2025.01.01 12:00 AM
  • %Y-%m-%d %I:%M %p — 2025-01-01 12:00 AM
  • %H:%M — 18:45
  • %I:%M %p — 06:45 PM
  • RFC 3339/ISO 8601 UTC string

Usage:

noti send --schedule "30 minutes" "Reminder" "Take a break" --timeout 0

@jsonmaf1a jsonmaf1a force-pushed the scheduler branch 2 times, most recently from 7a7a2c5 to 3c6ef74 Compare December 11, 2024 15:50
@JarKz JarKz self-requested a review December 11, 2024 20:36
crates/app/cli.rs Outdated Show resolved Hide resolved
crates/backend/src/lib.rs Show resolved Hide resolved
crates/backend/src/lib.rs Outdated Show resolved Hide resolved
crates/backend/src/scheduler.rs Outdated Show resolved Hide resolved
crates/backend/src/scheduler.rs Outdated Show resolved Hide resolved
crates/backend/src/scheduler.rs Outdated Show resolved Hide resolved
Comment on lines 41 to 46
let datetime_formats = [
"%d.%m.%Y %H:%M", // 01.01.2025 00:00
"%Y-%m-%d %H:%M", // 01-01-2025 00:00
"%d.%m.%Y %I:%M %p", // 01.01.2025 12:00 AM
"%Y-%m-%d %I:%M %p", // 01-01-2025 12:00 AM
];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second and last are not matched to examples in commentaries. The second will match only "2025-01-01 00:00" and the last one will match only "2025-01-01 12:00 AM".

crates/backend/src/scheduler.rs Outdated Show resolved Hide resolved
crates/dbus/src/server.rs Outdated Show resolved Hide resolved
crates/dbus/src/server.rs Outdated Show resolved Hide resolved
@jsonmaf1a jsonmaf1a requested a review from JarKz December 13, 2024 13:58
@jsonmaf1a jsonmaf1a merged commit 9af2624 into main Dec 13, 2024
5 checks passed
@jsonmaf1a jsonmaf1a deleted the scheduler branch December 15, 2024 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants