From fe11ed3ac76f331cd72fc89c70acfddb288f615f Mon Sep 17 00:00:00 2001 From: Philipp Heckel Date: Mon, 28 Nov 2022 11:06:47 -0500 Subject: [PATCH] Remove --env-topic flag from "ntfy publish" (as per deprecation) --- cmd/publish.go | 14 +++++--------- docs/deprecations.md | 9 +++++---- docs/releases.md | 6 ++++++ 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/cmd/publish.go b/cmd/publish.go index efa875bf..7a561973 100644 --- a/cmd/publish.go +++ b/cmd/publish.go @@ -49,7 +49,7 @@ var cmdPublish = &cli.Command{ Usage: "Send message via a ntfy server", UsageText: `ntfy publish [OPTIONS..] TOPIC [MESSAGE...] ntfy publish [OPTIONS..] --wait-cmd COMMAND... -NTFY_TOPIC=.. ntfy publish [OPTIONS..] -P [MESSAGE...]`, +NTFY_TOPIC=.. ntfy publish [OPTIONS..] [MESSAGE...]`, Action: execPublish, Category: categoryClient, Flags: flagsPublish, @@ -72,7 +72,7 @@ Examples: ntfy pub --wait-pid 1234 mytopic # Wait for process 1234 to exit before publishing ntfy pub --wait-cmd mytopic rsync -av ./ /tmp/a # Run command and publish after it completes NTFY_USER=phil:mypass ntfy pub secret Psst # Use env variables to set username/password - NTFY_TOPIC=mytopic ntfy pub -P "some message" # Use NTFY_TOPIC variable as topic + NTFY_TOPIC=mytopic ntfy pub "some message" # Use NTFY_TOPIC variable as topic cat flower.jpg | ntfy pub --file=- flowers 'Nice!' # Same as above, send image.jpg as attachment ntfy trigger mywebhook # Sending without message, useful for webhooks @@ -241,13 +241,9 @@ func parseTopicMessageCommand(c *cli.Context) (topic string, message string, com } func parseTopicAndArgs(c *cli.Context) (topic string, args []string, err error) { - envTopic := c.Bool("env-topic") - if envTopic { - fmt.Fprintln(c.App.ErrWriter, "\x1b[1;33mDeprecation notice: The --env-topic/-P flag will be removed in July 2022, see https://ntfy.sh/docs/deprecations/ for details.\x1b[0m") - topic = os.Getenv("NTFY_TOPIC") - if topic == "" { - return "", nil, errors.New("when --env-topic is passed, must define NTFY_TOPIC environment variable") - } + envTopic := os.Getenv("NTFY_TOPIC") + if envTopic != "" { + topic = envTopic return topic, remainingArgs(c, 0), nil } if c.NArg() < 1 { diff --git a/docs/deprecations.md b/docs/deprecations.md index b1709a20..8cbc997a 100644 --- a/docs/deprecations.md +++ b/docs/deprecations.md @@ -4,11 +4,14 @@ This page is used to list deprecation notices for ntfy. Deprecated commands and before the behavior is changed depends on the severity of the change, and how prominent the feature is. ## Active deprecations +_No active deprecations_ + +## Previous deprecations ### ntfy CLI: `ntfy publish --env-topic` will be removed -> Active since 2022-06-20, behavior will change end of **July 2022** +> Active since 2022-06-20, behavior changed with v1.30.0 -The `ntfy publish --env-topic` option will be removed. It'll still be possible to specify a topic via the +The `ntfy publish --env-topic` option will be removed. It'll still be possible to specify a topic via the `NTFY_TOPIC` environment variable, but it won't be necessary anymore to specify the `--env-topic` flag. === "Before" @@ -21,8 +24,6 @@ The `ntfy publish --env-topic` option will be removed. It'll still be possible t $ NTFY_TOPIC=mytopic ntfy publish "this is the message" ``` -## Previous deprecations - ### Android app: WebSockets will become the default connection protocol > Active since 2022-03-13, behavior will not change (deprecation removed 2022-06-20) diff --git a/docs/releases.md b/docs/releases.md index 3725f467..c04857a3 100644 --- a/docs/releases.md +++ b/docs/releases.md @@ -2,6 +2,12 @@ Binaries for all releases can be found on the GitHub releases pages for the [ntfy server](https://github.com/binwiederhier/ntfy/releases) and the [ntfy Android app](https://github.com/binwiederhier/ntfy-android/releases). +## ntfy server v1.30.0 (UNRELEASED) + +**Bug fixes + maintenance:** + +* Remove `--env-topic` option from `ntfy publish` as per [deprecation](deprecations.md) (no ticket) + ## ntfy Android app v1.14.0 (UNRELEASED) **Features:**