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

tsh play --format=text #46849

Merged
merged 2 commits into from
Oct 1, 2024
Merged

tsh play --format=text #46849

merged 2 commits into from
Oct 1, 2024

Conversation

zmb3
Copy link
Collaborator

@zmb3 zmb3 commented Sep 22, 2024

For sessions with print events, this command will write the text directly to standard out. This makes it easier to grep for a particular pattern or just dump a session recording to a file for manual analysis.

Closes #11694

changelog: tsh play now supports a text output format

@zmb3 zmb3 force-pushed the zmb3/tsh-play-text branch 3 times, most recently from a95b5f9 to c5bbdd5 Compare September 22, 2024 23:26
@zmb3 zmb3 marked this pull request as ready for review September 22, 2024 23:26
@github-actions github-actions bot added size/sm tsh tsh - Teleport's command line tool for logging into nodes running Teleport. labels Sep 22, 2024
Copy link

The PR changelog entry failed validation: The changelog entry must start with a letter.

Copy link

The PR changelog entry failed validation: The changelog entry must start with a letter.

@zmb3 zmb3 requested a review from rosstimothy September 30, 2024 19:21
go.mod Outdated Show resolved Hide resolved
@GavinFrazar
Copy link
Contributor

GavinFrazar commented Sep 30, 2024

actually, I wonder if we should not strip ansi control characters? It messes up the output when I remote into my box that has fish shell (doing all kinds of colorful things and auto completions).

with stripping:

$ ~/code/timemachine/v16/build/tsh play f03e90e6-6e9a-489d-b92e-6ac8dc65dc95 --format text                                                                                                (dev) 
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
[13:28:36] gavin@pop-os ~  
c cd work/teleport
⏎                                                                                                                                                                                               [13:28:45] gavin@pop-os ~/work/teleport  
s ls
api              bpf                      buf-gogo.gen.yaml  buf.lock  build.assets    Cargo.toml          common.mk        darwin-signing.mk  doc.go  e2e           fixtures  gitref.go  go.work      integrations    LICENSE            metrics.go    proto        rfd          tool                version.go  webassets               webassets_noembed.go
assets           buf-connect-go.gen.yaml  buf-legacy.yaml    buf.yaml  BUILD_macos.md  CHANGELOG.md        constants.go     devbox.json        docs    e_imports.go  fuzz      go.mod     go.work.sum  jest.config.js  LICENSE-community  node_modules  protogen.go  SECURITY.md  tsconfig.json       version.mk  webassets_embed.go      yarn.lock
babel.config.js  buf-go.gen.yaml          buf-ts.gen.yaml    build     Cargo.lock      CODE_OF_CONDUCT.md  CONTRIBUTING.md  devbox.lock        e       examples      gen       go.sum     integration  lib             Makefile           package.json  README.md    target       tsconfig.node.json  web         webassets_embed_ent.go  
⏎                                                                                                                                                                                               [13:28:46] gavin@pop-os ~/work/teleport  
lsdocker ls
docker: 'ls' is not a docker command.
See 'docker --help'
⏎                                                                                                                                                                                               [13:28:49] gavin@pop-os ~/work/teleport [1] 
docker lsls
docker: 'ls' is not a docker command.
See 'docker --help'
⏎                                                                                                                                                                                               [13:28:53] gavin@pop-os ~/work/teleport [1] 
$ 

vs tsh built without the ansi stripping:

[I] [13:30:55] gavin@m3 ~/code/timemachine/v16  
$ ~/code/timemachine/v16/build/tsh play f03e90e6-6e9a-489d-b92e-6ac8dc65dc95 --format text                                                                                                (dev) 
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
[13:28:36] gavin@pop-os ~  
$ cd work/teleport
⏎                                                                                                                                                                                               [13:28:45] gavin@pop-os ~/work/teleport  
$ ls
api              bpf                      buf-gogo.gen.yaml  buf.lock  build.assets    Cargo.toml          common.mk        darwin-signing.mk  doc.go  e2e           fixtures  gitref.go  go.work      integrations    LICENSE            metrics.go    proto        rfd          tool                version.go  webassets               webassets_noembed.go
assets           buf-connect-go.gen.yaml  buf-legacy.yaml    buf.yaml  BUILD_macos.md  CHANGELOG.md        constants.go     devbox.json        docs    e_imports.go  fuzz      go.mod     go.work.sum  jest.config.js  LICENSE-community  node_modules  protogen.go  SECURITY.md  tsconfig.json       version.mk  webassets_embed.go      yarn.lock
babel.config.js  buf-go.gen.yaml          buf-ts.gen.yaml    build     Cargo.lock      CODE_OF_CONDUCT.md  CONTRIBUTING.md  devbox.lock        e       examples      gen       go.sum     integration  lib             Makefile           package.json  README.md    target       tsconfig.node.json  web         webassets_embed_ent.go  
⏎                                                                                                                                                                                               [13:28:46] gavin@pop-os ~/work/teleport  
$ docker ls
docker: 'ls' is not a docker command.
See 'docker --help'
⏎                                                                                                                                                                                               [13:28:49] gavin@pop-os ~/work/teleport [1] 
$ docker ls
docker: 'ls' is not a docker command.
See 'docker --help'
⏎                                                                                                                                                                                               [13:28:53] gavin@pop-os ~/work/teleport [1] 
$ 
[I] [13:30:59] gavin@m3 ~/code/timemachine/v16  
$                                                                                                                                                                                         (dev) 

For sessions with print events, this command will write the text directly
to standard out. This makes it easier to grep for a particular pattern or
just dump a session recording to a file for manual analysis.

Closes #11694
@zmb3 zmb3 force-pushed the zmb3/tsh-play-text branch from c5bbdd5 to 55f98b1 Compare October 1, 2024 21:55
@zmb3
Copy link
Collaborator Author

zmb3 commented Oct 1, 2024

Decided to remove the ANSI stripping and just print the raw session. It's a bit simpler, requires no dependencies, and you can always pipe the output through to a separate tool that strips the ANSI control characters.

@zmb3 zmb3 enabled auto-merge October 1, 2024 21:56
@zmb3 zmb3 added this pull request to the merge queue Oct 1, 2024
Merged via the queue into master with commit 0cffff4 Oct 1, 2024
39 checks passed
@zmb3 zmb3 deleted the zmb3/tsh-play-text branch October 1, 2024 22:42
@public-teleport-github-review-bot

@zmb3 See the table below for backport results.

Branch Result
branch/v16 Create PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/branch/v16 size/sm tsh tsh - Teleport's command line tool for logging into nodes running Teleport.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement tsh play --format=text
4 participants