Skip to content

fix(output): export output writer - #122

Merged
muesli merged 1 commit into
masterfrom
readwriter
Aug 25, 2023
Merged

muesli merged 1 commit into
masterfrom
readwriter

Conversation

@aymanbagabas

@aymanbagabas aymanbagabas commented Mar 9, 2023 •

Copy link
Copy Markdown
Collaborator

Termenv output can be a buffer, ssh session, a file, or anything that
implements the io.Writer interface.

In the case of an ssh session, the std ssh library returns a
io.ReadWriter for ssh sessions and the current Termenv implementation
makes it impossible to read terminal status reports since it expects a
file in return.

In addition, the TTY() function is confusing since it implies that the
returned value is a TTY. Which is not always true until we check that
using the isTTY() function.

Deprecate TTY() in favor of Writer() which simply returns the underlying
writer. The caller then can infer the type of the writer and decide what
to do with it.

This also deprecates parts of commit 669c9ab 669c9ab

Comment thread output.go Resolved
@aymanbagabas
aymanbagabas force-pushed the readwriter branch 2 times, most recently from 8368526 to 0f89b9f Compare April 14, 2023 20:17
@aymanbagabas aymanbagabas changed the title fix(output): status report ignored when assumeTTY or unsafe is true fix(output): export output writer Apr 14, 2023
@aymanbagabas
aymanbagabas requested review from caarlos0 and muesli April 14, 2023 20:21
@aymanbagabas
aymanbagabas force-pushed the readwriter branch 2 times, most recently from f96dbec to efeeaef Compare April 14, 2023 21:12
caarlos0 added a commit to charmbracelet/bubbletea that referenced this pull request May 15, 2023
refs muesli/termenv#122

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Termenv output can be a buffer, ssh session, a file, or anything that
implements the io.Writer interface.

In the case of an ssh session, the std ssh library returns a
io.ReadWriter for ssh sessions and the current Termenv implementation
makes it impossible to read terminal status reports since it expects a
file in return.

In addition, the TTY() function is confusing since it implies that the
returned value is a TTY. Which is not always true until we check that
using the isTTY() function.

Deprecate TTY() in favor of Writer() which simply returns the underlying
writer. The caller then can infer the type of the writer and decide what
to do with it.

This also deprecate parts of commit 669c9ab 669c9ab
@muesli
muesli merged commit 3b3da4b into master Aug 25, 2023
@muesli
muesli deleted the readwriter branch August 25, 2023 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

⌂ 换网址