Rich Enhanced Shell History - Contextual shell history for zsh and bash
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
resh/cmd/install-utils/migrate.go

40 lines
1010 B

package main
import (
"fmt"
"os"
"github.com/curusarn/resh/internal/cfg"
)
func migrateConfig() {
err := cfg.Touch()
if err != nil {
fmt.Fprintf(os.Stderr, "ERROR: Failed to touch config file: %v\n", err)
os.Exit(1)
}
changes, err := cfg.Migrate()
if err != nil {
fmt.Fprintf(os.Stderr, "ERROR: Failed to update config file: %v\n", err)
os.Exit(1)
}
if changes {
fmt.Printf("RESH config file format has changed since last update - your config was updated to reflect the changes.\n")
}
}
func migrateHistory() {
// homeDir, err := os.UserHomeDir()
// if err != nil {
// }
// TODO: Find history in:
// - .resh/history.json (copy) - message user to delete the file once they confirm the new setup works
// - .resh_history.json (copy) - message user to delete the file once they confirm the new setup works
// - xdg_data/resh/history.reshjson
// Read xdg_data/resh/history.reshjson
// Write xdg_data/resh/history.reshjson
// the old format can be found in the backup dir
}