migratesvc

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package migratesvc brings a home from an earlier release to the current layout.

The config home moved twice: ~/.sshmgr and ~/.config/sshmgr (sshmgr), then ~/.config/ssh-manager (%APPDATA%\ssh-manager on Windows; ssh-manager and authama 0.1.0), and now ~/.config/authama on every OS. Migration COPIES the newest legacy home into the current one and leaves the old folder where it was, with a MIGRATED-TO-AUTHAMA.txt marker in it, so an older binary still installed beside this one keeps working and nothing is lost if the copy is not what the user wanted. It runs once on its own (AutoMigrate, the first time authama starts with no home), and `authama migrate` is the guided path for when both homes already exist.

The tool's own state - log/, snapshots/, dist/ and .state/ - then moves out of the config home into the state home (RelocateState) when those differ.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RelocateState added in v0.1.1

func RelocateState(p paths.Paths) (moved, conflicts []string, err error)

RelocateState moves the state folders a config home from before 0.1.1 holds (log/, snapshots/, dist/, .state/) into a separate state home. A folder already present in the state home is left where it is and reported, never merged. It does nothing when the state home is the config home.

Types

type Result

type Result struct {
	Moved   bool
	Legacy  string
	Home    string
	Backup  string
	Message string
	// Relocated lists the state folders moved to the state home.
	Relocated []string
}

Result is the outcome of a migrate run.

func AutoMigrate added in v0.1.1

func AutoMigrate(p paths.Paths) (Result, bool, error)

AutoMigrate is the first-run migration: when the current home does not exist yet and a legacy one does, copy it in. It does nothing in a sandbox or when the home exists, and reports whether it acted.

func Migrate

func Migrate(p paths.Paths, force bool, stamp string) (Result, error)

Migrate copies the newest legacy home into the current home. If the current home is absent, the legacy one is copied in. If both exist, it refuses unless force - with force the current home is moved aside (using stamp) and replaced by the copy. The legacy folder is kept and marked either way.

func (Result) Format

func (r Result) Format() string

Format renders the message.

Jump to

Keyboard shortcuts

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