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

feat: if plug dirname exists then local source only #111

Merged
merged 2 commits into from
Jan 26, 2023
Merged

feat: if plug dirname exists then local source only #111

merged 2 commits into from
Jan 26, 2023

Conversation

wintermi
Copy link
Contributor

When trying to perform a local file and the file does not exist, ⚡ Zap will attempt a Git clone and error.

Modified to check to see if the directory containing the local file exists, if so, then treat as a local source only and not move on should the local file not exist.

For example when executing the below

plug "$HOME/.zshrc.local"

zap.zsh Outdated
@@ -16,7 +16,12 @@ function plug() {
done
}

[[ -f "$1" ]] && source "$1" && return 0
# If the directory exists, then local source only
if [ -d $(dirname "$1") ]; then
Copy link
Member

Choose a reason for hiding this comment

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

if [ -d "${1:h}" ]; then

This seams to work better and uses ZSH built-in substitution instead of os commands

# If the directory exists, then local source only
if [ -d $(dirname "$1") ]; then
[[ -f "$1" ]] && source "$1"
return 0
Copy link
Member

Choose a reason for hiding this comment

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

return

Returns the last exit code

@mamaraddio mamaraddio merged commit b913252 into zap-zsh:master Jan 26, 2023
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.

2 participants