DRYer
This commit is contained in:
parent
5bc2fa187c
commit
3e3744753d
@ -71,14 +71,20 @@ def setup_fish_env(env: Dict[str, str]) -> None:
|
|||||||
env['XDG_DATA_DIRS'] = os.pathsep.join(dirs)
|
env['XDG_DATA_DIRS'] = os.pathsep.join(dirs)
|
||||||
|
|
||||||
|
|
||||||
def setup_zsh_env(env: Dict[str, str]) -> None:
|
def is_new_zsh_install() -> bool:
|
||||||
zdotdir = os.environ.get('ZDOTDIR')
|
zdotdir = os.environ.get('ZDOTDIR')
|
||||||
base = zdotdir or os.path.expanduser('~')
|
base = zdotdir or os.path.expanduser('~')
|
||||||
for q in ('.zshrc', '.zshenv', '.zprofile', '.zlogin'):
|
for q in ('.zshrc', '.zshenv', '.zprofile', '.zlogin'):
|
||||||
if os.path.exists(os.path.join(base, q)):
|
if os.path.exists(os.path.join(base, q)):
|
||||||
break
|
return False
|
||||||
else:
|
return True
|
||||||
# a new zsh install dont prevent zsh-newuser-install from running
|
|
||||||
|
|
||||||
|
def setup_zsh_env(env: Dict[str, str]) -> None:
|
||||||
|
zdotdir = os.environ.get('ZDOTDIR')
|
||||||
|
base = zdotdir or os.path.expanduser('~')
|
||||||
|
if is_new_zsh_install():
|
||||||
|
# dont prevent zsh-newuser-install from running
|
||||||
return
|
return
|
||||||
if zdotdir is not None:
|
if zdotdir is not None:
|
||||||
env['KITTY_ORIG_ZDOTDIR'] = zdotdir
|
env['KITTY_ORIG_ZDOTDIR'] = zdotdir
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user