Merged
Conversation
On my ubuntu laptop the prior code fails as follows because
`os.TempDir` is "/tmp" and not "/tmp/".
repos/rdm $ ./remote-development-manager server
panic: open /tmprdm.log: permission denied
goroutine 1 [running]:
github.com/blakewilliams/remote-development-manager/internal/cmd.newServerCmd.func1(0xc000120000?, {0x7e8618?, 0x0?, 0x0?})
/home/brasic/repos/rdm/internal/cmd/server.go:25 +0x45e
github.com/spf13/cobra.(*Command).execute(0xc000120000, {0xb06210, 0x0, 0x0})
/home/brasic/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:860 +0x663
github.com/spf13/cobra.(*Command).ExecuteC(0xacd500)
/home/brasic/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:974 +0x3b4
github.com/spf13/cobra.(*Command).Execute(...)
/home/brasic/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:902
github.com/blakewilliams/remote-development-manager/internal/cmd.Execute({0x898a38, 0xc00018c040})
/home/brasic/repos/rdm/internal/cmd/root.go:32 +0x207
main.main()
/home/brasic/repos/rdm/main.go:30 +0x159
Extracted most of macosClipboard into commandClipboard, which as a platform-agnostic class that can handle any copy/paste command. Added build-tagged files with build constraints for darwin and linux respectively to specify pbcopy/pbpaste and xclip respectively. Linux has multiple clipboards but I've chosen to use the one mapped to Ctrl-C / Ctrl-V. Possibly in the future this could be configurable.
On linux xdg-open is the standard command to open URLs:
* xdg-open - Open a URI in the user's preferred application that
handles the respective URI or file type
`open` exists but it has different semantics than on macos (for example,
cannot handle URLS
Use the same build-tag mechanism to change the constant depending on
which platform we are on. Unsupported platforms will be a build error.
BlakeWilliams
approved these changes
Oct 16, 2022
Owner
|
Oh, I think we'll want to update the README too, since it specifies that linux support isn't implemented yet. |
Collaborator
Author
Fixed in 87db441! |
Co-authored-by: Blake Williams <blakewilliams@github.com>
Co-authored-by: Blake Williams <blakewilliams@github.com>
BlakeWilliams
approved these changes
Oct 29, 2022
Owner
BlakeWilliams
left a comment
There was a problem hiding this comment.
LGTM! Feel free to merge when you're ready.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds support for running
rdm serveron linux machines by:xclipandopenbecomesxdg-open. One advantage of this approach is that the binary now only builds on platforms where it is capable of running.Cheers!
edit: By request, 47d1953 also introduces a new interface for all OS-specific functionality. I called it
hostservice.Runner with a default implementation calledhostservice.Servicehostservice.HostService.