v0.1.0
First release. hostsctl keeps /etc/hosts entries in a YAML config and renders them into a block between markers; everything outside those markers is carried over byte for byte.
Added
- A YAML config at
~/.config/hostsctl/config.yaml(overridable with--configor$HOSTSCTL_CONFIG) holding groups of entries. A group is enabled or disabled as a whole, and an entry maps N addresses to M hostnames, so one name on several addresses stays several lines in/etc/hosts. - Zone files:
includeattaches files next to the config, in either plain hosts syntax (.hosts, one group per file, comments preserved) or YAML (.yaml). Edits made through the CLI go back to the file the group came from, in that file's own format, and a file that did not change is not rewritten. - Remote blocklists:
source addattaches a hosts list as a group, withrewrite_ipand an allowlist. Lists are cached under~/.cache/hostsctl/sources/and refreshed withsource update, which honoursETag.applyreads only the cache and never touches the network, so its result does not depend on connectivity. - Backups: a snapshot of the target is taken before every write, including before a restore.
backup list,backup restore [ID]andbackup prunemanage them, andsettings.keep_backupsbounds how many are kept. check, a linter for what/etc/hostswould silently ignore: wildcards, ports and paths in a hostname, invalid addresses, an address repeated inside one entry, and a name already defined outside the managed block.- Safety guarantees: writes are atomic (temporary file,
fsync,rename) and preserve the target's mode and owner; the result is refused unless it still contains127.0.0.1 localhost; a legacyhosts-syncblock is visible to the tool but is never removed without--drop-legacyormigrate. - Under
sudo, the config and cache are still read from the invoking user's home directory (resolved throughSUDO_USERin passwd), and files created as root are handed back to that user. migrateandimportto move an existinghosts-syncsetup or loose*.hostsfiles into the config.- Shell completions for bash, zsh, fish, elvish and PowerShell, plus a man page.
- A documented exit-code contract:
0ok,1generic failure,2usage,3config error,4permission,5I/O,6network. - A documentation site at https://jtprogru.github.io/hostsctl/, English with a Russian locale. The command reference and the exit-code table are generated from the code, and CI fails when the committed copies drift.
- Release archives for Linux (
x86_64/aarch64, glibc and musl) and macOS (Apple silicon and Intel), each with a keyless cosign signature, a SLSA build-provenance attestation and an entry inchecksums.txt. Distributed through Homebrew, crates.io,scripts/install.shand the archives themselves.
Install
brew install jtprogru/tap/hostsctl
cargo install hostsctl --version 0.1.0
curl -fsSL https://raw.githubusercontent.com/jtprogru/hostsctl/main/scripts/install.sh | shEvery archive carries a keyless cosign signature (.bundle) and a SLSA build
provenance attestation; checksums.txt lists the sha256 of each one.