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
This commit is contained in:
David Dworken 2024-10-20 12:09:16 -07:00 committed by GitHub
parent e96993b673
commit 905afd91c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -30,6 +30,10 @@ var (
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)")
}