Skip to content

Changes to create $ZSH_CACHE_DIR/completions directory #708

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

war-turtle
Copy link

Description

Changes to create $ZSH_CACHE_DIR/completions directory and add it to fpath.

Related Issue(s)

#707

Motivation and Context

Usage examples

How Has This Been Tested?

These line of changes were moved into a .zsh file
echo $fpath was added to the end of the file
then that file was executed to check if fpath was getting updated or not.
Also, the directory was created.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • Bug fix (non-breaking change which fixes an issue)
  • Documentation change
  • New feature (non-breaking change which adds functionality)

Checklist:

  • All new and existing tests passed.
  • I have added tests to cover my changes.
  • I have updated the documentation accordingly.

Comment on lines +168 to +171
# Create "$ZSH_CACHE_DIR/completions" directory
[[ ! -d "$ZSH_CACHE_DIR/completions" ]] && command mkdir -p "$ZSH_CACHE_DIR/completions"
# Add "$ZSH_CACHE_DIR/completions" diretory to fpath
[[ -z ${fpath[(re)$ZSH_CACHE_DIR/completions]} ]] && fpath=( "$ZSH_CACHE_DIR/completions" "${fpath[@]}" )

Choose a reason for hiding this comment

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

Using this version of the code generated warning/error on my machine when going to zsh from a bash shell.

mkdir: cannot create directory ‘/completions’: Permission denied

I added these lines coming from oh-my-zsh repo:

# Make sure $ZSH_CACHE_DIR is writable, otherwise use a directory in $HOME
if [[ ! -w "$ZSH_CACHE_DIR" ]]; then
  ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/oh-my-zsh"
fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants