From c6406888a9ae39fe171e9ecf5a66c47573077ede Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Mon, 14 Jul 2025 03:44:12 +0100 Subject: [PATCH] display (empty) if no text is set --- CHANGELOG.md | 2 +- text.go | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c0ae43d..7da58f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -# [0.14.0] - 2025-07-14 +# [0.14.1] - 2025-07-14 ### Added diff --git a/text.go b/text.go index 64a9ba5..44059f9 100644 --- a/text.go +++ b/text.go @@ -33,11 +33,18 @@ func (cmd *TextCurrentCmd) Run(ctx *context) error { return fmt.Errorf("input %s is of %s", cmd.InputName, kind) } + currentText, ok := resp.InputSettings["text"] + if !ok { + return fmt.Errorf("input %s does not have a 'text' setting", cmd.InputName) + } + if currentText == "" { + currentText = "(empty)" + } fmt.Fprintf( ctx.Out, "Current text for source %s: %s\n", ctx.Style.Highlight(cmd.InputName), - resp.InputSettings["text"], + currentText, ) return nil }