Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add wish.Command and wish.Cmd #229

Merged
merged 13 commits into from
Jan 30, 2024
Merged

feat: add wish.Command and wish.Cmd #229

merged 13 commits into from
Jan 30, 2024

Conversation

caarlos0
Copy link
Member

@caarlos0 caarlos0 commented Jan 22, 2024

The wish-exec example with vim worked because neovim was not using
STDERR.

Bubbletea doesn't have a concept of stdout and stderr, just output, so
tea.ExecProcess sets the exec.Cmd stderr to os.Stderr.

This would fail for bash, for instance.

This also introduces a wish.Cmd type and a wish.Command
function to properly set up a wish.Cmd based on ssh.Session (and
optionally a Pty), which can then be used with tea.Exec.

Finally, it adds to the wish-exec example, including the s key to run
a shell (bash).

closes #228

@caarlos0 caarlos0 added the enhancement New feature or request label Jan 22, 2024
@caarlos0 caarlos0 self-assigned this Jan 22, 2024
@caarlos0 caarlos0 changed the title feat: add PTYCommand feat: add wish.Command Jan 22, 2024
The wish-exec example with vim worked because neovim was not using
STDERR.

Bubbletea doesn't have a concept of stdout and stderr, just output, so
`tea.ExecProcess` sets the `exec.Cmd` stderr to `os.Stderr`.

This would fail for bash, for instance.

This also introduces a `wish.Cmd` type and a `wish.Command`
function to properly set up a `wish.Cmd` based on `ssh.Session` (and
optionally a Pty), which can then be used with `tea.Exec`.

Finally, it adds to the wish-exec example, including the `s` key to run
a shell (bash).

closes #228

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Copy link

codecov bot commented Jan 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e5d20f5) 76.58% compared to head (98030fa) 77.23%.

❗ Current head 98030fa differs from pull request most recent head 10790a8. Consider uploading reports for the commit 10790a8 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #229      +/-   ##
==========================================
+ Coverage   76.58%   77.23%   +0.64%     
==========================================
  Files          17       19       +2     
  Lines         914      940      +26     
==========================================
+ Hits          700      726      +26     
  Misses        160      160              
  Partials       54       54              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@caarlos0 caarlos0 changed the title feat: add wish.Command feat: add wish.Command and wish.Cmd Jan 22, 2024
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
cmd.go Outdated Show resolved Hide resolved
cmd.go Outdated Show resolved Hide resolved
cmd_test.go Show resolved Hide resolved
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
cmd.go Show resolved Hide resolved
* fix: create a new pty for exec.Cmd

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: improvements

* fix: test

* fix: windows

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: unneeded err

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: resize && race

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: windows/linux

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* test: ignore on windows for now

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: sync

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* test: hammer

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* chore: import

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
@caarlos0 caarlos0 merged commit ef54347 into main Jan 30, 2024
12 checks passed
@caarlos0 caarlos0 deleted the pty-command branch January 30, 2024 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

wish-exec has issues starting a bash shell (outputs to server stdout | error Inappropriate ioctl for device)
3 participants