uninstaller

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package uninstaller performs a complete one-command uninstall of vmflow: it removes the native service, deletes the binary, and purges owned config, logs, owned certificate caches, and the self-update cache. External TLS certificate and key files referenced by config are deliberately preserved.

The flow is plan → confirm → execute. Plan probes the system and returns the ordered list of items to remove (service first, the running binary last). Confirm asks for interactive consent. Execute requires service cleanup to succeed before removing files and tolerates already-absent paths so retries remain safe.

Style follows internal/service and internal/updater: error-return, progress streamed to an io.Writer, no logging inside the package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Confirm

func Confirm(w io.Writer, r io.Reader) (bool, error)

Confirm prompts on w and reads a yes/no answer from r. Returns true only for an explicit y/yes.

func ConfirmWithTranslator

func ConfirmWithTranslator(w io.Writer, r io.Reader, translator *i18n.Translator) (bool, error)

ConfirmWithTranslator prompts for explicit consent in the selected language.

func Execute

func Execute(w io.Writer, items []Item) error

Execute handles native service items first, then removes filesystem items in order. Already-absent paths are not errors, so re-running the command is safe. The running binary is removed last in plans produced by Plan.

func ExecuteWithTranslator

func ExecuteWithTranslator(w io.Writer, items []Item, translator *i18n.Translator) error

ExecuteWithTranslator localizes progress headings without changing validation, paths, or returned errors.

func Print

func Print(w io.Writer, items []Item, warnings []string)

Print writes the plan (warnings + items) to w.

func PrintWithTranslator

func PrintWithTranslator(w io.Writer, items []Item, warnings []string, translator *i18n.Translator)

PrintWithTranslator writes the localized plan while preserving paths and diagnostic warning text exactly as discovered by Plan.

Types

type Item

type Item struct {
	Path string // filesystem path; empty for the service item
	Kind string // service, binary, file, directory, owned config, or stats file
	Note string // human-readable description shown in the plan
	Self bool   // marks the running binary; removed last
}

Item describes one artifact the uninstall removes.

func Plan

func Plan() (items []Item, warnings []string)

Plan probes the system and returns the ordered list of items that would be removed, plus warnings. The service is removed first and the running binary last so a still-supervised daemon is gone before its executable is deleted.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL