Add separate command for completion install/uninstall (was: npm install mucks with preferences silently)
See original GitHub issueI’ve got my home directory in git so I noticed something that I perceived to be wildly bad manners. When I npm install -g serverless
it makes global changes to my .zshrc
without asking. My rc file is configured for multiple machines and tailored to my needs, as I think it is for many people – having things haphazardly add themselves to it without my control feels invasive, IMHO*
The culprit lines of code that caused this are: https://github.com/serverless/serverless/blob/66f019b1f36af41dd067ac598244e97f98e1ead8/scripts/postinstall.js#L30-L31
The use of tabtab’s --auto
flag is what I think is damaging. In auto mode, tabtab doesn’t place a standalone file in the completions folder for bash/zsh, it just haphazardly dumps code into the rc file.
Maybe I’m being overly sensitive about packages changing files outside of their scope in stateful manners and convenience is king. I just wanted to start a discussion about this to see if this was a valid concern or if I should continue “being weird” and write protecting my zshrc so that npm install
doesn’t mess with it.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:44
- Comments:41 (16 by maintainers)
User friendliness is important. But it doesn’t mean you need to spoonfeed your users. This is a tool for developers, I don’t think we need to have completion out of the box for a program without explicitly asking for it.
This tabtab thing is messy, it would add lines to my dotfiles either if I want or not. The best way to handle this is to explicitly ask your users to copy-paste completion snippets.
In my case, for example, I would add it to my
~/.zsh.local
not in my~/.zshrc
.Please don’t mess with user’s own files without the user’s input. It’s a bad user experience.
I think many would consider it bad form, actually. @pmuens , have you guys considered offering completions as a separate node module, e.g.
serverless-completions
?