From 01ea12e68be9df16d43decd6b4649927d92f2937 Mon Sep 17 00:00:00 2001 From: n3tw0rth Date: Sat, 11 Jan 2025 19:57:49 +0530 Subject: [PATCH] chore: update readme --- Cargo.toml | 1 - README.md | 88 ++++++++++++++++++++++++++++++++++-------------------- 2 files changed, 55 insertions(+), 34 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 94eaafc..0e33532 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,6 @@ anyhow = "1.0.95" clap = { version = "4.5.23", features = ["derive"] } ctrlc = "3.4.5" dirs = "5.0.1" -duct = "0.13.7" futures = "0.3.31" lettre = "0.11.11" mail-send = "0.4.9" diff --git a/README.md b/README.md index b8e00ea..4fc8ed1 100644 --- a/README.md +++ b/README.md @@ -1,52 +1,74 @@ +# Completion Notifier -⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡀⠀⠀ -⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣿⣿⠆⠀ -⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⡿⠁⠀⠀ -⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⣿⠟⠀⠀⠀⠀ -⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⣿⣿⡿⠃⠀⠀⠀⠀⠀ -⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣾⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀ -⠀⢀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣿⣿⣿⠏⠀⠀⠀⠀⠀⠀⠀⠀ -⠀⠺⣿⣷⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀ -⠀⠀⠈⠻⣿⣿⣦⣄⠀⠀⠀⠀⠀⠀⣠⣿⣿⣿⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ -⠀⠀⠀⠀⠈⠻⣿⣿⣷⣤⡀⠀⠀⣰⣿⣿⣿⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ -⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣿⣦⣼⣿⣿⣿⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ -⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣿⣿⣿⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ -⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠻⣿⣿⣿⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ -⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢿⡟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ -⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +A simple notifier to send notifications on terminal process events. -Usage: completion-notifier [OPTIONS] ... +## Installation -Arguments: - ... +Install directly from source -Options: - -p, --profiles [default: default] - -n, --name - -t, --triggers - -v, --verbose - -h, --help Print help - -V, --version Print version +```bash + $ git clone https://github.com/n3tw0rth/completion-notifier.git + $ cd completion-notifier + $ ./install.sh + + $ completion-notifier -v + $ completion-notifier -h +``` + +it is better to use a alias for the binary, +```bash +#.bashrc +alias notif='completion-notifier' +``` +## Usage +It is easy as passing the command directly, by default a notification will be send once the program completes execution success or failed. +```shell +$ completion-notifier ping google.com +``` +### Triggers +Triggers can be added to send custom notifications based on the requirement. for example, +```shell +$ completion-notifier -t PING ping google.com +``` +program will start running as usual, and will send additionals notifications before process exit. Based on the string values passed into the `-t` flag. According to this example a notification will be send when program find a specific line contain the word `PING`. -## config +```shell +$ completion-notifier -t approve,'Enter a value' terraform apply +``` +flag `-t` will accept comma seperated values, and trigger values containing more words seperated by spaces they can be passed in as shown. In this example user will be notified when there undefined variables and when terraform ask for user confirmation to apply the change. +## Configuration -```markdown +```toml [email.default] -from = "" -to = "" -api_key = "" -port = 587 +from = "acme@dev.com" +to = "me@dev.com" +username = "" +password = "" +port = 465 +host = "" + +[email.work] +from = "acme@dev.com" +to = "pm@dev.com" +username = "" +password = "" +port = 465 host = "" [profiles.default] print_output = true -sendto = ["email.default"] +sendto = ["desktop","email.default"] -[gchat.default] +[profiles.work] +print_output = true +sendto = ["desktop","gchat.work","email.work"] + +[gchat.work] api_key = "" webhook = "" + ```