display (empty) if no text is set

This commit is contained in:
onyx-and-iris 2025-07-14 03:44:12 +01:00
parent f65af8298d
commit c6406888a9
2 changed files with 9 additions and 2 deletions

View File

@ -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/), 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). 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 ### Added

View File

@ -33,11 +33,18 @@ func (cmd *TextCurrentCmd) Run(ctx *context) error {
return fmt.Errorf("input %s is of %s", cmd.InputName, kind) 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( fmt.Fprintf(
ctx.Out, ctx.Out,
"Current text for source %s: %s\n", "Current text for source %s: %s\n",
ctx.Style.Highlight(cmd.InputName), ctx.Style.Highlight(cmd.InputName),
resp.InputSettings["text"], currentText,
) )
return nil return nil
} }