feross / hostile

Simple, programmatic `/etc/hosts` manipulation (in node.js)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Suggestion - dry run or check mode that tells you if changes need to be made

pokle opened this issue · comments

We use hostile as part of our dev workflow, and we have to run it with sudo so that it has the right permissions to do its bit. However, most of the time there's nothing for it to do, and we end up being prompted for our password even when there's nothing to be done.

We've worked around this by doing a host lookup to check all our hosts before invoking hostile with a sudo. I feel like hostile would be in a better position to check if it has something to do.

I'm happy to submit a Pull Request if you like.

Thanks for the issue, but I'd rather not add more functionality to this package. You can already use getFile to get the contents and check it in your own program.