From 905afd91c313fdf887153154075c5784c692c38c Mon Sep 17 00:00:00 2001 From: David Dworken Date: Sun, 20 Oct 2024 12:09:16 -0700 Subject: [PATCH] Add support to skip modifying shell configs during the hishtory update process, since the shell configs are already set up at that point and haven't ever needed to change (#259) * Skip modifying shell configs during the hishtory update process, since the shell configs are already set up at that point and haven't ever needed to change * Use separate flag for skipping update config mods to enable future flexibility * Revert the update change since that needs to be in a separate release --- client/cmd/install.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/client/cmd/install.go b/client/cmd/install.go index 1123a26..e9c7cdc 100644 --- a/client/cmd/install.go +++ b/client/cmd/install.go @@ -26,10 +26,14 @@ import ( ) var ( - offlineInit *bool - forceInit *bool - offlineInstall *bool - skipConfigModification *bool + offlineInit *bool + forceInit *bool + offlineInstall *bool + skipConfigModification *bool + skipUpdateConfigModification *bool + + //lint:ignore U1000 Flag that is allowed to be specified, but not used + currentlyInstalledVersion *string ) var installCmd = &cobra.Command{ @@ -45,7 +49,7 @@ var installCmd = &cobra.Command{ if strings.HasPrefix(secretKey, "-") { lib.CheckFatalError(fmt.Errorf("secret key %#v looks like a CLI flag, please use a secret key that does not start with a -", secretKey)) } - lib.CheckFatalError(install(secretKey, *offlineInstall, *skipConfigModification)) + lib.CheckFatalError(install(secretKey, *offlineInstall, *skipConfigModification || *skipUpdateConfigModification)) if os.Getenv("HISHTORY_SKIP_INIT_IMPORT") == "" { db, err := hctx.OpenLocalSqliteDb() lib.CheckFatalError(err) @@ -686,4 +690,6 @@ func init() { forceInit = initCmd.Flags().Bool("force", false, "Force re-init without any prompts") offlineInstall = installCmd.Flags().Bool("offline", false, "Install hiSHtory in offline mode with all syncing capabilities disabled") skipConfigModification = installCmd.Flags().Bool("skip-config-modification", false, "Skip modifying shell configs and instead instruct the user on how to modify their configs") + skipUpdateConfigModification = installCmd.Flags().Bool("skip-update-config-modification", false, "Skip modifying shell configs for updates") + currentlyInstalledVersion = installCmd.Flags().String("currently-installed-version", "", "The currently installed version (used by the update command)") }