-
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?
Changes from all commits
e95ba5b
be7cff8
e84c08c
24b7967
e736972
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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 commentThe 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 :/ |
||
do | ||
echo "${plugin_type},${plugin_dir}/${plugin}" | ||
done | ||
for plugin in $(find "${plugin_dir}" -maxdepth 1 -type f -exec basename {} \; | grep "^[^0-9]" | LC_ALL="C" sort -g) | ||
do | ||
echo "${plugin_type},${plugin_dir}/${plugin}" | ||
done | ||
fi | ||
done | ||
} | ||
|
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.