-
Notifications
You must be signed in to change notification settings - Fork 43
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
Sort plugin exec order #41
base: master
Are you sure you want to change the base?
Sort plugin exec order #41
Conversation
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.
Thanks, it's looking good just a couple of minor suggestions.
Can you also update the CHANGELOG file with the changes from this PR and your previous one?
@@ -63,7 +63,15 @@ plugin-list() { | |||
plugin_dir="${dirs[${i}]}/.git-semver/plugins" | |||
if [ -d "${plugin_dir}" ] | |||
then | |||
find "${plugin_dir}" -maxdepth 1 -type f -exec echo "${plugin_type},{}" \; | |||
plugins=() |
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.
Is this variable needed? I can't see it being referenced in the following code.
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.
Actually I realise this may have been to cache the result of the find. That would save a command.
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 think that might actually be a mistake. I don't see it in the master branch of this repo, and I added it on the Fixed MacOS compatibility
commit for no apparent reason. And, if it actually does any caching, I can't see how, but I'm happy to leave it there if it's useful.
@@ -63,7 +63,15 @@ plugin-list() { | |||
plugin_dir="${dirs[${i}]}/.git-semver/plugins" | |||
if [ -d "${plugin_dir}" ] | |||
then | |||
find "${plugin_dir}" -maxdepth 1 -type f -exec echo "${plugin_type},{}" \; | |||
plugins=() | |||
for plugin in $(find "${plugin_dir}" -maxdepth 1 -type f -exec basename {} \; | grep "^[0-9]" | LC_ALL="C" sort -g) |
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.
Probably worth a quick comment here as to why the loop is run twice.
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.
That loop is ran twice to first echo the numeric prefixed plugins (note that the output is piped to a grep) and then echo the not numeric ones. This is basically what you suggested doing in this comment.
As you also said, it's hacky, but I really couldn't come with a better solution :/
As discussed in #36, this code sorts plugins by number before running them.
Please let me know of any improvements you see on this code, and thanks in advance for reviewing.