René's URL Explorer Experiment


Title: feat: Refactor CLI config-ssh to improve UX by mafredri · Pull Request #1900 · coder/coder · GitHub

Open Graph Title: feat: Refactor CLI config-ssh to improve UX by mafredri · Pull Request #1900 · coder/coder

X Title: feat: Refactor CLI config-ssh to improve UX by mafredri · Pull Request #1900 · coder/coder

Description: This PR improves the UX of coder config-ssh with multiple QoL improvements. Replaces #1848. Magic block is replaced by Include statement Writes are only done on changes Inform user of changes via prompt Allow displaying changes via --diff Remove magic block if present Safer config writing via tmp-file + rename Parse previous config-ssh options, compare to new options and ask to use new (otherwise old ones are used) Tests for the new functionality Fixes #1326 TODO: Auto-update ~/.ssh/coder on coder create and coder delete This will be be left to a follow-up PR, or scrapped in unwanted Examples: New config: ❯ coder config-ssh > The following changes will be made to your SSH configuration: * Remove old config block (START-CODER/END-CODER) from /home/maf/.ssh/config * Add "Include coder" to /home/maf/.ssh/config * Write auto-generated coder config file to /home/maf/.ssh/coder To see changes, run diff: $ coder config-ssh --diff Continue? (yes/no) yes You should now be able to ssh into your workspace. For example, try running: $ ssh coder.work Options changed: ❯ coder config-ssh -o ForwardAgent=yes > New options differ from previous options: New options: * ssh-option: ForwardAgent=yes Previous options: none Use new options? (yes/no) yes > The following changes will be made to your SSH configuration: * Update auto-generated coder config file in /home/maf/.ssh/coder To see changes, run diff: $ coder config-ssh --ssh-option "ForwardAgent=yes" --diff Continue? (yes/no) yes You should now be able to ssh into your workspace. For example, try running: $ ssh coder.work Options would change => select no (no changes): ❯ coder config-ssh -o ForwardAgent=yes -o IdentityAgent=none > New options differ from previous options: New options: * ssh-option: ForwardAgent=yes * ssh-option: IdentityAgent=none Previous options: * ssh-option: ForwardAgent=yes Use new options? (yes/no) no You should now be able to ssh into your workspace. For example, try running: $ ssh coder.work Diff: ❯ coder config-ssh --diff Changes: * Remove old config block (START-CODER/END-CODER) from /home/maf/.ssh/config * Add "Include coder" to /home/maf/.ssh/config * Write auto-generated coder config file to /home/maf/.ssh/coder --- /home/maf/.ssh/config +++ /home/maf/.ssh/config.new @@ -1,23 +1,6 @@ +Include coder + Host github.com HostName github.com User git -# ------------START-CODER----------- -# This was generated by "coder config-ssh". -# -# To remove this blob, run: -# -# coder config-ssh --remove -# -# You should not hand-edit this section, unless you are deleting it. - -Host coder.work - ForwardAgent=yes - HostName coder.work - ConnectTimeout=0 - StrictHostKeyChecking=no - UserKnownHostsFile=/dev/null - LogLevel ERROR - ProxyCommand "coder" --global-config "/Users/maf/Library/Application Support/coderv2" ssh --stdio work - -# ------------END-CODER------------ --- /home/maf/.ssh/coder +++ /home/maf/.ssh/coder.new @@ -0,0 +1,14 @@ +# This file is managed by coder. DO NOT EDIT. +# +# You should not hand-edit this file, all changes will be lost upon workspace +# creation, deletion or when running "coder config-ssh". +# +# Last config-ssh options: +# +Host coder.work + HostName coder.work + ConnectTimeout=0 + StrictHostKeyChecking=no + UserKnownHostsFile=/dev/null + LogLevel ERROR + ProxyCommand "coder" --global-config "/home/maf/.config/coderv2" ssh --stdio work exit status 1

Open Graph Description: This PR improves the UX of coder config-ssh with multiple QoL improvements. Replaces #1848. Magic block is replaced by Include statement Writes are only done on changes Inform user of changes via ...

X Description: This PR improves the UX of coder config-ssh with multiple QoL improvements. Replaces #1848. Magic block is replaced by Include statement Writes are only done on changes Inform user of changes via ...

Opengraph URL: https://github.com/coder/coder/pull/1900

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:2027b42c-434d-4e6d-604b-91f4dc0528b5
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id91E8:3E418A:AD985:E5BE4:6B018185
html-safe-nonce0bddcee5960b04cf25c980878cc9a36c80bb59f1aa52429ac03dcb0a9ae8868b
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MUU4OjNFNDE4QTpBRDk4NTpFNUJFNDo2QjAxODE4NSIsInZpc2l0b3JfaWQiOiIzNTM2MDY4OTQ0NzgxNzM4MzczIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac73e895b96fe92b4bf9fbec48fae92ba20814ca4e3928f5710f2432f0961ecf09
hovercard-subject-tagpull_request:951096862
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/coder/coder/pull/1900/files
twitter:imagehttps://avatars.githubusercontent.com/u/147409?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/147409?s=400&v=4
og:image:altThis PR improves the UX of coder config-ssh with multiple QoL improvements. Replaces #1848. Magic block is replaced by Include statement Writes are only done on changes Inform user of changes via ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/coder/coder git https://github.com/coder/coder.git
octolytics-dimension-user_id95932066
octolytics-dimension-user_logincoder
octolytics-dimension-repository_id440752086
octolytics-dimension-repository_nwocoder/coder
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id440752086
octolytics-dimension-repository_network_root_nwocoder/coder
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/coder/coder/pull/1900/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fcoder%2Fcoder%2Fpull%2F1900%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fcoder%2Fcoder%2Fpull%2F1900%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=coder%2Fcoder
Reloadhttps://github.com/coder/coder/pull/1900/files
Reloadhttps://github.com/coder/coder/pull/1900/files
Reloadhttps://github.com/coder/coder/pull/1900/files
coderhttps://github.com/coder
coderhttps://github.com/coder/coder
Codehttps://github.com/coder/coder
Issues320 (320)https://github.com/coder/coder/issues
Pull requests470 (470)https://github.com/coder/coder/pulls
Discussionshttps://github.com/coder/coder/discussions
Actionshttps://github.com/coder/coder/actions
Projectshttps://github.com/coder/coder/projects
Security and quality49 (49)https://github.com/coder/coder/security
Insightshttps://github.com/coder/coder/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fcoder%2Fcoder%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fcoder%2Fcoder%2Fissues%2Fnew%2Fchoose
mafredrihttps://github.com/mafredri
mainhttps://github.com/coder/coder/tree/main
mafredri/ssh-config-refactor-2https://github.com/coder/coder/tree/mafredri/ssh-config-refactor-2
Conversation 13 https://github.com/coder/coder/pull/1900
Commits 38 https://github.com/coder/coder/pull/1900/commits
Checks 0 https://github.com/coder/coder/pull/1900/checks
Files changed https://github.com/coder/coder/pull/1900/files
Please reload this pagehttps://github.com/coder/coder/pull/1900/files
feat: Refactor CLI config-ssh to improve UX https://github.com/coder/coder/pull/1900/files#top
Show all changes 38 commits https://github.com/coder/coder/pull/1900/files
b7f2b3d feat: Refactor CLI config-ssh to improve UX mafredri May 30, 2022 https://github.com/coder/coder/pull/1900/commits/b7f2b3d3caab5aea45d76def79b8b84519b6d3f7
4f03415 chore: Switch to github.com/pkg/diff for diffing mafredri May 30, 2022 https://github.com/coder/coder/pull/1900/commits/4f03415e073e709697794e29bcdff27d91da1212
e196920 fix: Output absolute paths for diffs mafredri May 30, 2022 https://github.com/coder/coder/pull/1900/commits/e196920474f92d62955d1e921e16c6b888cb405f
cdcf6c3 chore: Remove todone mafredri May 30, 2022 https://github.com/coder/coder/pull/1900/commits/cdcf6c35cdc326132ff8af7bfa0e1f99d3192db6
263d823 chore: Rename actions => changes for consistency mafredri May 30, 2022 https://github.com/coder/coder/pull/1900/commits/263d8236ab3ed5eee66b85dc826c744c3275d244
18797e7 fix: Remove workspaces check, removing is a legit use-case mafredri May 30, 2022 https://github.com/coder/coder/pull/1900/commits/18797e71fdf931524413a1fd5e27b2b9233ab1f9
9680792 fix: Remove unused else mafredri May 30, 2022 https://github.com/coder/coder/pull/1900/commits/9680792aca1a2c20f1362e240f18d384afc4b63b
7a4b8d6 fix: Handle no workspaces case mafredri May 30, 2022 https://github.com/coder/coder/pull/1900/commits/7a4b8d69b3f34eed2b0d2908e92f4cd3068c7a61
e552e84 chore: Update diffBytes comment mafredri May 30, 2022 https://github.com/coder/coder/pull/1900/commits/e552e846064319daf254b690cf60c6a58d7160fe
5250a8a fix: Cleanup temp file on failure mafredri May 30, 2022 https://github.com/coder/coder/pull/1900/commits/5250a8a25463c734742ef16cf8864eb520b51e56
0749e58 fix: Wrap error mafredri May 30, 2022 https://github.com/coder/coder/pull/1900/commits/0749e58875d358514be31129b9ecba49f2a0690b
b3f448a fix: Enable color when terminal is a tty mafredri May 30, 2022 https://github.com/coder/coder/pull/1900/commits/b3f448ae4284e658cad0cc427d3df49372aa2e85
c5f1983 fix: Improve output, detect if stdout is tty mafredri May 31, 2022 https://github.com/coder/coder/pull/1900/commits/c5f19836595281e7a037013e5a17df64038dad3b
8d0f72c fix: Add Include to the top of config, verify semantically mafredri May 31, 2022 https://github.com/coder/coder/pull/1900/commits/8d0f72c819bd15a1135d920f09dc4629f3f6f7a1
d7838b5 fix: Guard against overwriting unknown ~/.ssh/coder file mafredri May 31, 2022 https://github.com/coder/coder/pull/1900/commits/d7838b5de40c93e7af0d3abdec8fcd838b35d199
f94bc3f feat: Parse and prompt to re-use previous configuration mafredri May 31, 2022 https://github.com/coder/coder/pull/1900/commits/f94bc3f8a73571aa90f2cf1929aed72dd257fc23
00a8c12 chore: Increase indentation mafredri May 31, 2022 https://github.com/coder/coder/pull/1900/commits/00a8c129d53cd54e1ae03e0d127f124e50d794e0
e50c4c3 chore: Remove unused equality func mafredri May 31, 2022 https://github.com/coder/coder/pull/1900/commits/e50c4c3bcad9f95062136d7dbe730f530fae9c04
94c8681 fix: Perform multi line regexp matches mafredri Jun 1, 2022 https://github.com/coder/coder/pull/1900/commits/94c868144321f845bc28ef2cc0f90f4c2bbd24a3
1e33886 fix: Only rewrite coder file path if not ~/ mafredri Jun 1, 2022 https://github.com/coder/coder/pull/1900/commits/1e3388672c209e2110ee5b3b122f3ee3b21c34a0
209c8ff fix: Allow removing invalid Include coder entry mafredri Jun 1, 2022 https://github.com/coder/coder/pull/1900/commits/209c8ff7541ca6c4f9c88a151b0d3c58721377d6
5ed5e0e Revert "chore: Remove unused equality func" mafredri Jun 1, 2022 https://github.com/coder/coder/pull/1900/commits/5ed5e0ee2710971c39e90b28f76cdd4091a51aea
000c9b4 fix: Allow replacing default ssh config file in tests mafredri Jun 1, 2022 https://github.com/coder/coder/pull/1900/commits/000c9b461ecc90a172a0ec28d66c0212644abcf9
9d64680 feat: Update options prompt, default to using new options mafredri Jun 1, 2022 https://github.com/coder/coder/pull/1900/commits/9d6468093751c040074ba905935d92f61e7c0600
a7cb149 fix: Improve regexes mafredri Jun 1, 2022 https://github.com/coder/coder/pull/1900/commits/a7cb1494a2cfe3ea24a2dff3d7e09788d0a630d9
a77c791 feat: Add tests mafredri Jun 1, 2022 https://github.com/coder/coder/pull/1900/commits/a77c7913dccc41c1f72cc661795a478596bf1701
5bcd038 fix: Do not prompt for previous opts on first run mafredri Jun 1, 2022 https://github.com/coder/coder/pull/1900/commits/5bcd0383a851612df425fe786b5bd3cb3c33f41a
1632eb4 fix: Fix broken TestConfigSSH test mafredri Jun 1, 2022 https://github.com/coder/coder/pull/1900/commits/1632eb4bcecfade8360392f0d395b4321a7c02af
99693ce fix: Revert multiwriter change usued while testing mafredri Jun 1, 2022 https://github.com/coder/coder/pull/1900/commits/99693ced45be0aca3c92d599d4dede05aa55095b
fb24742 fix: Change diff suggestions for more natural sentence mafredri Jun 1, 2022 https://github.com/coder/coder/pull/1900/commits/fb24742e5e6b8876be63c4bbdb9de5d26d1af39d
5c785dd fix: Typo mafredri Jun 1, 2022 https://github.com/coder/coder/pull/1900/commits/5c785dd26adb416b8cb182fac56b57a2112d11a6
c60762f fix: Fix linting (gocyclo, revive), improve responsiveness mafredri Jun 1, 2022 https://github.com/coder/coder/pull/1900/commits/c60762f845cb9b89553ace85283b74b3059701a2
0422e71 chore: Update header comment mafredri Jun 6, 2022 https://github.com/coder/coder/pull/1900/commits/0422e71c95d827f0210fee9b79d4767cf0ecf0dd
6e1e1a0 chore: Extract function mafredri Jun 6, 2022 https://github.com/coder/coder/pull/1900/commits/6e1e1a06a8f5fa31c17f53f5f15b06862c05d6aa
fda935f chore: Remove test log statements mafredri Jun 6, 2022 https://github.com/coder/coder/pull/1900/commits/fda935fcb103889798454b62920dc83873ce861e
f1be4c6 Make Include regexp stricter to avoid deleting user data mafredri Jun 8, 2022 https://github.com/coder/coder/pull/1900/commits/f1be4c6634554c8797961e4ba3fe943d38270f6a
bf4596c chore: Update the "Changes" text for diff to match non-diff mode mafredri Jun 8, 2022 https://github.com/coder/coder/pull/1900/commits/bf4596c2089829bf2ae5bf1f1b41fba5b792ab79
093e2ce chore: Use consistent naming of functions mafredri Jun 8, 2022 https://github.com/coder/coder/pull/1900/commits/093e2ce77309e5ea21170a4b58f3f67b4efdcd66
Clear filters https://github.com/coder/coder/pull/1900/files
Please reload this pagehttps://github.com/coder/coder/pull/1900/files
Please reload this pagehttps://github.com/coder/coder/pull/1900/files
configssh.go https://github.com/coder/coder/pull/1900/files#diff-da52625030fea40a2f9287770d924177d6ad8f0db08baca769d09442e3fb7942
configssh_test.go https://github.com/coder/coder/pull/1900/files#diff-0b6d2ddfd728125257c8fab8470751ffb77e5cd07122a7a899361bdf364e9330
root.go https://github.com/coder/coder/pull/1900/files#diff-f95036fc6ff63eb5fcf251353f47b191fa8a2d927d37eacbb51e47e74e5f71f4
go.mod https://github.com/coder/coder/pull/1900/files#diff-33ef32bf6c23acb95f5902d7097b7a1d5128ca061167ec0716715b0b9eeaa5f6
go.sum https://github.com/coder/coder/pull/1900/files#diff-3295df7234525439d778f1b282d146a4f1ff6b415248aaac074e8042d9f42d63
Please reload this pagehttps://github.com/coder/coder/pull/1900/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.