EraseInstall for macOS is designed to allow users to easily erase the HD on their Mac and install a fresh copy of macOS.
The application is a wrapper around the command `startosinstall`.

This command is included in the 'Install macOS High Sierra/Mojave' application, which you can download in the Mac App Store. The `startosinstall` command can be used to upgrade the current system, or (optionally) to erase the current system and replace it with a fresh installation of macOS.