Skip to content

Commit d2f9f7c

Browse files
authored
Merge pull request #582 from unixorn/update-per-plugin-standard
Update the way we add our `/bin` to user's `$PATH`
2 parents df9997b + c53fdd2 commit d2f9f7c

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
- [ ] Add/Remove/Update a helper script or `git` alias
1212
- [ ] Add/Remove/Update link to an external resource like a blog post or video
13+
- [ ] Plugin file updates - functions added here probably should be standalone scripts in `/bin`
1314
- [ ] Text cleanups/updates
1415
- [ ] Test updates
1516

git-extra-commands.plugin.zsh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,17 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
# Add our plugin's bin diretory to user's path
16-
path+=("${0:h}/bin")
15+
# Add our plugin's bin diretory to user's path per
16+
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html#zero-handling
17+
18+
0="${ZERO:-${${0:#$ZSH_ARGZERO}:-${(%):-%N}}}"
19+
0="${${(M)0:#/*}:-$PWD/$0}"
20+
21+
local git_extra_commands_bin="${0:h}/bin"
22+
23+
if [[ -z "${path[(r)${git_extra_commands_bin}]}" ]]; then
24+
path+=( "${git_extra_commands_bin}" )
25+
fi
1726

1827
alias git-grab='git-incoming-commits'
1928
alias gitroot='cd $(git rev-parse --show-toplevel) && echo "$_"'

0 commit comments

Comments
 (0)