An alternative to 'chezmoi cd' #3089
Replies: 2 comments 5 replies
-
It would be possible, but I don’t necessarily think that it would be a good idea. Chezmoi completions are provided by spf13/cobra and I don’t think that any additional work is done to maintain those for chezmoi (this is why
Yes, bash and zsh shell functions are mostly compatible, but they need not be as zsh is strictly more capable. If this were accepted I would:
I don’t think that I’d use this, and I think that support efforts would increase unless |
Beta Was this translation helpful? Give feedback.
-
The function for most shells is (ref): chezmoi-cd() {
cd $(chezmoi source-path)
} I'm not sure this is work generating. Note that chezmoi already has a |
Beta Was this translation helpful? Give feedback.
-
Reading #3088, I wanted to ask if an alternative approach here wouldn't be better.
chezmoi
is already providing shell specific code for tab-completion, so the concept isn't totally foreign.Would it make sense to have chezmoi have an option to generate a native function in the shell that does the cd (or a pushd if available) without forking the shell.
I undertand why forking the shell is the 'easiest, most robust solution', but it's still spinning a new shell - and cding out of chezmoi dir, without exiting leaves those processes.
in bash it would be something like
. <( chezmoi util-funcs "cz" )
where it would created acz
funciton/alias tochezmoi
, andczcd
as a shell-nativechezmoi cd
replacement.Beta Was this translation helpful? Give feedback.
All reactions