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

Update this script so that it works on Linux. #1799

Merged
merged 3 commits into from
Nov 9, 2020

Conversation

nlewycky
Copy link
Contributor

@nlewycky nlewycky commented Nov 6, 2020

Make fd the default name of the program, but allow for the user to specify another, such as FD=fdfind scripts/update-version.sh.

Fix the sed command to take the filename to modify in-place and specify that the regex string is the sed-expression to execute.

Review

  • Please check that this still works on a Mac.

Make `fd` the default name of the program, but allow for the user to specify another, such as `FD=fdfind scripts/update-version.sh`.

Fix the sed command to take the filename to modify in-place and specify that the regex string is the sed-expression to execute.
@nlewycky nlewycky requested a review from syrusakbary as a code owner November 6, 2020 18:56
@@ -1,12 +1,16 @@
#! /bin/sh

: "${FD:=fd}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need this? (can we add a comment on how to install fd (via cargo and apt-get)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On MacOS, fd can also be installed using homebrew.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this because when you install fd with apt-get, the command is fdfind. I assume we need to support both names, but I kept fd as the default on the assumption that it was Debian renaming things. If fdfind is the popular name, I can make that the default. Or, we can remove the default and use fdfind unconditionally. Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fd seems to be the right name to me. fd-find being the name of the crate which provides the fd CLI.

I think being able to change the name of the CLI is great to have. We ensure the script will work everywhere, whatever the path/name of the fd CLI is.

Copy link
Contributor

@jubianchi jubianchi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works on MacOS after installing fd and gnu-sed with brew.

@@ -1,12 +1,16 @@
#! /bin/sh

: "${FD:=fd}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
: "${FD:=fd}"
: # How to install `fd`: https://github.com/sharkdp/fd#installation
: "${FD:=fd}"

@nlewycky
Copy link
Contributor Author

nlewycky commented Nov 6, 2020

Works on MacOS after installing fd and gnu-sed with brew.

It shouldn't need gnu-sed, bsd sed should work too? Does it not?

@jubianchi
Copy link
Contributor

jubianchi commented Nov 6, 2020

@nlewycky unfortunately -i as a totally different meaning on BSD sed (https://www.freebsd.org/cgi/man.cgi?query=sed&sektion=&n=1)

@syrusakbary syrusakbary merged commit e9b280b into master Nov 9, 2020
@bors bors bot deleted the feature/update-version-linux branch November 9, 2020 22:59
@MarkMcCaskey
Copy link
Contributor

@jubianchi good call here, the script now doesn't work on mac 😆

I wrote this script as a hack in like 30 seconds a long time ago, maybe it's time to solve this problem properly 🤔

As for fd, I can just never remember all the flags required to make find work in a sensible way, so I went with fd 😆 , if fd is a problem find should work just fine too

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

Successfully merging this pull request may close these issues.

4 participants