Просмотр исходного кода

Remove --env-topic flag from "ntfy publish" (as per deprecation)

Philipp Heckel 3 лет назад
Родитель
Сommit
fe11ed3ac7
3 измененных файлов с 16 добавлено и 13 удалено
  1. 5 9
      cmd/publish.go
  2. 5 4
      docs/deprecations.md
  3. 6 0
      docs/releases.md

+ 5 - 9
cmd/publish.go

@@ -49,7 +49,7 @@ var cmdPublish = &cli.Command{
 	Usage:   "Send message via a ntfy server",
 	Usage:   "Send message via a ntfy server",
 	UsageText: `ntfy publish [OPTIONS..] TOPIC [MESSAGE...]
 	UsageText: `ntfy publish [OPTIONS..] TOPIC [MESSAGE...]
 ntfy publish [OPTIONS..] --wait-cmd COMMAND...
 ntfy publish [OPTIONS..] --wait-cmd COMMAND...
-NTFY_TOPIC=.. ntfy publish [OPTIONS..] -P [MESSAGE...]`,
+NTFY_TOPIC=.. ntfy publish [OPTIONS..] [MESSAGE...]`,
 	Action:   execPublish,
 	Action:   execPublish,
 	Category: categoryClient,
 	Category: categoryClient,
 	Flags:    flagsPublish,
 	Flags:    flagsPublish,
@@ -72,7 +72,7 @@ Examples:
   ntfy pub --wait-pid 1234 mytopic                        # Wait for process 1234 to exit before publishing
   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 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_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
   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
   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) {
 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
 		return topic, remainingArgs(c, 0), nil
 	}
 	}
 	if c.NArg() < 1 {
 	if c.NArg() < 1 {

+ 5 - 4
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.
 before the behavior is changed depends on the severity of the change, and how prominent the feature is.
 
 
 ## Active deprecations
 ## Active deprecations
+_No active deprecations_
+
+## Previous deprecations
 
 
 ### ntfy CLI: `ntfy publish --env-topic` will be removed
 ### 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.
 `NTFY_TOPIC` environment variable, but it won't be necessary anymore to specify the `--env-topic` flag.
 
 
 === "Before"
 === "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"
     $ NTFY_TOPIC=mytopic ntfy publish "this is the message"
     ```
     ```
 
 
-## Previous deprecations
-
 ### <del>Android app: WebSockets will become the default connection protocol</del>
 ### <del>Android app: WebSockets will become the default connection protocol</del>
 > Active since 2022-03-13, behavior will not change (deprecation removed 2022-06-20)
 > Active since 2022-03-13, behavior will not change (deprecation removed 2022-06-20)
 
 

+ 6 - 0
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)
 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).
 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)
 ## ntfy Android app v1.14.0 (UNRELEASED)
 
 
 **Features:**
 **Features:**