[PR #1382] [MERGED] Add piping support #1586

Closed
opened 2026-05-07 01:02:47 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/binwiederhier/ntfy/pull/1382
Author: @srevn
Created: 7/6/2025
Status: Merged
Merged: 7/6/2025
Merged by: @binwiederhier

Base: mainHead: main


📝 Commits (4)

📊 Changes

1 file changed (+19 additions, -0 deletions)

View changed files

📝 cmd/publish.go (+19 -0)

📄 Description

The client will automatically detect piped input and use it as the message content when no explicit message is provided.

  • Added stdin detection: The isStdinRedirected() function detects when data is being piped by checking if stdin is not a character device
  • Automatic reading: When no message is provided via arguments and stdin has data, it automatically reads the piped content
  • Preserves existing behavior: Still works with explicit --file=- and doesn't break any existing functionality

Example : echo "test message from stdin" | ntfy publish mytopic


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/binwiederhier/ntfy/pull/1382 **Author:** [@srevn](https://github.com/srevn) **Created:** 7/6/2025 **Status:** ✅ Merged **Merged:** 7/6/2025 **Merged by:** [@binwiederhier](https://github.com/binwiederhier) **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (4) - [`6fbcd85`](https://github.com/binwiederhier/ntfy/commit/6fbcd85d17568fed75d847c563f75d04bdaf51ca) Add piping support - [`04aff72`](https://github.com/binwiederhier/ntfy/commit/04aff72631b1b23a7a327cee097023211bed009e) Add example and logging - [`9ed96e5`](https://github.com/binwiederhier/ntfy/commit/9ed96e5d8b16944d40a6e2e6a2ddf924112a2fc5) Small cosmetic fixes - [`47da3ae`](https://github.com/binwiederhier/ntfy/commit/47da3aeea6ab36cbe7f5990282bb1028334ba8c6) fix unbounded read ### 📊 Changes **1 file changed** (+19 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `cmd/publish.go` (+19 -0) </details> ### 📄 Description The client will automatically detect piped input and use it as the message content when no explicit message is provided. - Added stdin detection: The isStdinRedirected() function detects when data is being piped by checking if stdin is not a character device - Automatic reading: When no message is provided via arguments and stdin has data, it automatically reads the piped content - Preserves existing behavior: Still works with explicit `--file=-` and doesn't break any existing functionality Example : `echo "test message from stdin" | ntfy publish mytopic` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-07 01:02:47 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ntfy#1586
No description provided.