- Notifications
You must be signed in to change notification settings - Fork928
feat: Refactor CLI config-ssh to improve UX#1900
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Just noticed we need to place the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I like the approach so far! The--diff
option is really cool!
Some observations:
- We should keep the configs under
~/.ssh
because that's where they always go. - We should check that we "own"
~/.ssh/coder
(maybe by checking for a magic string) before writing it
mafredri commentedMay 31, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@johnstcn great observations, I've made the necessary changes.
|
cli/configssh.go Outdated
# | ||
# To remove this blob, run: | ||
# You should not hand-edit this file, all changes will be lost upon workspace | ||
# creation, deletion or when running "coder config-ssh".` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I really would love to see this feature. (i.e. runningcoder create
will automatically update the config). But I suggest we rewrite this comment to not include it, open up a ticket for this functionality, and leave it for a follow-up PR. (PS. This is one reason we write the used options to the config file.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
TODO: rewrite comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I haven't tested this locally, but looks good to me. I appreciate the thorough tests!
I do think there's still scope for refactoring; a lot of the code related to reading and writing SSH configs seems like it could be ripped out to its own module. This should probably done in a separate PR however!
cli/configssh.go Outdated
# | ||
# To remove this blob, run: | ||
# You should not hand-edit this file, all changes will be lost upon workspace | ||
# creation, deletion or when running "coder config-ssh".` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
TODO: rewrite comment
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
af23128
to142683b
Compare- 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 presentTODO:- [ ] Parse previous `config-ssh` options and suggest re-using them- [ ] Auto-update `~/.ssh/coder` on `coder create` and `coder delete`- [ ] Tests for the new functionalityFixes#1326
This reverts commitf2f4a83.
142683b
toe084a73
Comparee084a73
tof1be4c6
Compare- 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 the new functionalityFixes#1326
Uh oh!
There was an error while loading.Please reload this page.
This PR improves the UX of
coder config-ssh
with multiple QoL improvements. Replaces#1848.--diff
config-ssh
options, compare to new options and ask to use new (otherwise old ones are used)Fixes#1326
TODO:
~/.ssh/coder
oncoder create
andcoder delete
Examples:
New config:
Options changed:
Options would change => select no (no changes):
Diff: