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

fill_template.sh fails on macOS #164

Open
msgilligan opened this issue Sep 16, 2024 · 3 comments
Open

fill_template.sh fails on macOS #164

msgilligan opened this issue Sep 16, 2024 · 3 comments

Comments

@msgilligan
Copy link

The fill_template.sh does not work with the built-in sed command on macOS (/usr/bin/sed) and produces the following error:

Patching files...
sed: 1: "Cargo.toml": invalid command code C

I worked around the issue by installing the Nix package gnused. Once that version of sed is first in my $PATH fill_template.sh works correctly.

@c-git
Copy link
Contributor

c-git commented Sep 26, 2024

I had redone the template in rust so no sed needed and had decided it maybe wasn't worth it as it wasn't that much better than the script. But I can revisit given considering cross platform, if that is actually helpful to someone other than me.

@msgilligan
Copy link
Author

At the very least you could just document that macOS users need to install GNU sed. It was pretty easy to figure out, but a comment in the script or elsewhere would IMO resolve this issue and might be simpler than publishing a Rust version.

@c-git
Copy link
Contributor

c-git commented Sep 26, 2024

TLDR

I suspect the original author may not have had experience with macOS and thus didn't know of the differences between the versions of sed. I think the simplest next step is to add a comment as you suggested.

Problems with that solution

But there is also another version that had to be done for windows #153 and now technically we've doubled the number of versions to be maintained along with needing a comment about versions of sed.

Problems I can think of with a rust solution

Rust scripts haven't been stabilized yet and would require nightly to run them. Otherwise I think they would be similar level of difficulty to doing a rust script compared with the current script.

The other option is doing a cargo subcommand but that would require the user to install a binary instead of just run a script again probably not worthwhile unless you start a lot of new projects.

My previous attempt (that I think missed the mark in some regards)

The main reason I didn't make a PR for the version I did was because my information doesn't change much between projects and thus I did something a bit more complicated (which in hindsight was maybe a bit too complicated) that would reuse information. The current version of what I did is online but I do not think it works well yet for the general case.

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