Skip to content

Commit

Permalink
feat(submodules): init if necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
olets committed Dec 6, 2023
1 parent d1aa126 commit 862f29a
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions hometown.zsh-theme
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,24 @@ _hometown_build_prompt() {
_hometown_init() {
emulate -L zsh

local dir
# if installed with Homebrew, will not have .gitmodules
if [[ -f ${_hometown_source_path}/.gitmodules && ! -f ${_hometown_source_path}/git-prompt-kit/git-prompt-kit.plugin.zsh ]]; then
'builtin' 'print' Finishing installing Hometown
'command' 'git' submodule update --init --recursive &>/dev/null
fi

if ! (( $# )); then
'builtin' 'printf' Hometown could not be initialized
if ! [[ -f ${_hometown_source_path}/git-prompt-kit/git-prompt-kit.plugin.zsh ]]; then
'builtin' 'print' There was problem finishing installing Hometown
return
fi

dir=$1

GIT_PROMPT_KIT_GITSTATUS_FUNCTIONS_SUFFIX=__hometown
GIT_PROMPT_KIT_GITSTATUSD_INSTANCE_NAME=HOMETOWN

'builtin' 'source' $dir/git-prompt-kit/git-prompt-kit.zsh
'builtin' 'source' $_hometown_source_path/git-prompt-kit/git-prompt-kit.zsh

PROMPT=$(_hometown_build_prompt)
}

_hometown_init ${0:A:h}
typeset -r _hometown_source_path=${0:A:h}
_hometown_init

0 comments on commit 862f29a

Please sign in to comment.