{"id":20310957,"url":"https://github.com/progrium/tview-ssh","last_synced_at":"2025-04-11T16:06:26.489Z","repository":{"id":56745270,"uuid":"524523916","full_name":"progrium/tview-ssh","owner":"progrium","description":"Example using tcell+tview over SSH using gliderlabs/ssh","archived":false,"fork":false,"pushed_at":"2022-08-13T23:12:43.000Z","size":85,"stargazers_count":22,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-25T12:07:29.928Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/progrium.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-13T22:46:23.000Z","updated_at":"2025-03-10T22:18:32.000Z","dependencies_parsed_at":"2022-08-16T01:20:25.015Z","dependency_job_id":null,"html_url":"https://github.com/progrium/tview-ssh","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/progrium%2Ftview-ssh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/progrium%2Ftview-ssh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/progrium%2Ftview-ssh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/progrium%2Ftview-ssh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/progrium","download_url":"https://codeload.github.com/progrium/tview-ssh/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248438494,"owners_count":21103409,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T17:35:08.924Z","updated_at":"2025-04-11T16:06:26.432Z","avatar_url":"https://github.com/progrium.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tview-ssh\nExample using [tcell](https://github.com/gdamore/tcell)+[tview](https://github.com/rivo/tview) over SSH using [gliderlabs/ssh](https://github.com/gliderlabs/ssh) without allocating a PTY or creating a subprocess. \n\n![Demo GIF](https://raw.githubusercontent.com/progrium/tview-ssh/main/demo.gif)\n\nThere is a little bit of glue, but maybe not enough for a library? Plus it's probably incomplete. Here is what it looks like to make an SSH server that shows a modal when you connect:\n\n```golang\nfunc main() {\n\tssh.Handle(func(sess ssh.Session) {\n\t\tscreen, err := NewSessionScreen(sess)\n\t\tif err != nil {\n\t\t\tfmt.Fprintln(sess.Stderr(), \"unable to create screen:\", err)\n\t\t\treturn\n\t\t}\n\n\t\t// tview says we don't have to do this\n\t\t// when using SetScreen, but it lies\n\t\tif err := screen.Init(); err != nil {\n\t\t\tfmt.Fprintln(sess.Stderr(), \"unable to init screen:\", err)\n\t\t\treturn\n\t\t}\n\n\t\tapp := tview.NewApplication().SetScreen(screen).EnableMouse(true)\n\n\t\tmodal := tview.NewModal().\n\t\t\tSetText(\"Do you want to quit the application?\").\n\t\t\tAddButtons([]string{\"Quit\", \"Cancel\"}).\n\t\t\tSetDoneFunc(func(buttonIndex int, buttonLabel string) {\n\t\t\t\tif buttonLabel == \"Quit\" {\n\t\t\t\t\tapp.Stop()\n\t\t\t\t}\n\t\t\t})\n\n\t\tapp.SetRoot(modal, false)\n\t\tif err := app.Run(); err != nil {\n\t\t\tfmt.Fprintln(sess.Stderr(), err)\n\t\t\treturn\n\t\t}\n\n\t\tsess.Exit(0)\n\t})\n\n\tlog.Fatal(ssh.ListenAndServe(\":2222\", nil, ssh.HostKeyFile(\"/Users/progrium/.ssh/id_rsa\")))\n}\n```\n\nIf you try this, change the hostkey file to something that works for you.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprogrium%2Ftview-ssh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprogrium%2Ftview-ssh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprogrium%2Ftview-ssh/lists"}