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

Port to Linux #19

Open
i8degrees opened this issue Sep 2, 2023 · 3 comments
Open

Port to Linux #19

i8degrees opened this issue Sep 2, 2023 · 3 comments

Comments

@i8degrees
Copy link

i8degrees commented Sep 2, 2023

Hi there, @ttscoff

We spoke ever so briefly the other week via email. You introduced me to this wonderful piece of software after I asked about https://fuckyeahmarkdown.com. So, it took me a few days to get around to installing Swift on my Linux workstation and seeing what would happen, and I am very happy to say that I was able to get it up and running with very little work.

I have forked this repository at https://github.com/syn-net/gather-cli and once I feel satisfied with a proper solution to replacing the missing bits of code, I will make a pull request and see if you are interested in merging my work upstream.

In short, NSWorkspace and NSPasteboard are the only two missing classes that I need to come up with a solution for. Being a complete newbie to the Swift language, it may take me some time to figure out how best to implement copy and paste in a cross-platform manner. Honestly, I was shocked as hell to see the software in action after simply commenting out the usage of the two classes. I did not realize yet that NSWorkspace is a class that must be used for obtaining access to the clipboard of other programs. (If I even understand that correctly?)

I have found a snippet of code for how to execute shell commands in Swift. I am thinking that maybe I can use xclip xsel on Linux to serve the same functionality that NSPasteboard offers. More challenging perhaps will be how to architect a Swift class out of it, as Objective-C was never my thing. I am sure willing to try, though! I cannot stress just how invaluable your Markdown tools have been to my life.

Thanks,
Jeff

@i8degrees
Copy link
Author

i8degrees commented Sep 2, 2023

Wow, I cannot believe that I managed to knock out a basic proof of concept so quickly! I have only tested a tiny subset of the port, and already have I found a very scary bug in how I deal with copying the resulting HTML to the clipboard -- I must sanitize incoming backtick characters before feeding it through the shell. Surely, my poor mind is missing a few other escape characters as well.

Anyhow, nothing that can't wait until another day. :-) Good night.

@ttscoff
Copy link
Owner

ttscoff commented Sep 2, 2023

This sounds awesome. I'll have to figure out how to create multiple build targets with Swift in order to make a single distro work for multiple platforms, but that can't be impossible, right? It might make sense to just keep your fork and link Linux users there from the README and from my site...

@ttscoff
Copy link
Owner

ttscoff commented Sep 2, 2023

By the way, there should be a Swift library for shell escaping, similar to Ruby's Shellwords library, but I didn't find it on a quick search.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants