guumaster / hostctl

Your dev tool to manage /etc/hosts like a pro!
http://guumaster.github.io/hostctl
MIT License
1.04k stars 45 forks source link

hostctl removes multi-value domain aliases when adding any domain #87

Open alcroito opened 1 year ago

alcroito commented 1 year ago

Describe the bug My ubuntu 22.04 system has the following lines in /etc/hosts by default

127.0.1.1 customhost.mydomain.com customhost
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback

Whenever hostctl is invoked to add any domain, all the aliases after the domain get removed

hostctl add domains awesome my-awesome-ui.project.loc my-awesome-api.project.loc

and the resulting file ends up

127.0.1.1 customhost.mydomain.com
# The following lines are desirable for IPv6 capable hosts
::1 localhost

##################################################################
# Content under this line is handled by hostctl. DO NOT EDIT.
##################################################################

# profile.on awesome
127.0.0.1 my-awesome-ui.project.loc
127.0.0.1 my-awesome-api.project.loc
# end

now every time run I sudo su i get an message sudo: unable to resolve host customhost: Name or service not known because the customhost entry gets removed.

Expected behavior default profile aliases that are not managed via hostctl should not be removed.

System (please complete the following information):