From 18baba30d40f413dd57a73674dbf19f647aed102 Mon Sep 17 00:00:00 2001 From: Jared Hatfield Date: Wed, 3 Jun 2026 06:52:50 -0400 Subject: [PATCH] Rename 'update' command to 'upgrade' --- docs/CONFIG.md | 6 +-- docs/EXAMPLES.md | 14 +++---- docs/INSTALL.md | 8 ++-- docs/README.md | 4 +- docs/USAGE.md | 14 +++---- internal/cmd/root.go | 6 +-- internal/cmd/{update.go => upgrade.go} | 42 +++++++++---------- .../cmd/{update_test.go => upgrade_test.go} | 18 ++++---- 8 files changed, 56 insertions(+), 56 deletions(-) rename internal/cmd/{update.go => upgrade.go} (68%) rename internal/cmd/{update_test.go => upgrade_test.go} (86%) diff --git a/docs/CONFIG.md b/docs/CONFIG.md index 563220c..d695dba 100644 --- a/docs/CONFIG.md +++ b/docs/CONFIG.md @@ -53,14 +53,14 @@ If neither source provides a token, requests are made without authentication. ## GOPROXY -When `goproxy` is set, **gogitup** passes the configured value as the `GOPROXY` environment variable when running `go install` (during both `install` and `update`). This is useful in environments that require a custom module proxy. +When `goproxy` is set, **gogitup** passes the configured value as the `GOPROXY` environment variable when running `go install` (during both `install` and `upgrade`). This is useful in environments that require a custom module proxy. {: .note } If `goproxy` is not set or is empty, the `GOPROXY` value is inherited from the current process environment (the default Go behavior). ## CGO_ENABLED -When `cgo_enabled` is set, **gogitup** passes the configured value as the `CGO_ENABLED` environment variable when running `go install` (during both `install` and `update`). Setting `cgo_enabled: false` disables cgo for all installs and updates, which is useful in environments where cgo is unavailable or undesirable. +When `cgo_enabled` is set, **gogitup** passes the configured value as the `CGO_ENABLED` environment variable when running `go install` (during both `install` and `upgrade`). Setting `cgo_enabled: false` disables cgo for all installs and updates, which is useful in environments where cgo is unavailable or undesirable. {: .note } If `cgo_enabled` is not set, the `CGO_ENABLED` value is inherited from the current process environment (the default Go behavior). @@ -70,7 +70,7 @@ If `cgo_enabled` is not set, the `CGO_ENABLED` value is inherited from the curre The cache file is located at `~/.gogitup.cache` and uses YAML format. It stores the latest version information retrieved from GitHub so that repeated checks do not require additional API calls. {: .important } -Cache entries expire after **24 hours**. After expiry the next `check` or `update` will re-fetch the latest release from GitHub. A check can be forced with `--force` to bypass the cache, but the purpose of the cache is to avoid unnecessary API calls to GitHub. +Cache entries expire after **24 hours**. After expiry the next `check` or `upgrade` will re-fetch the latest release from GitHub. A check can be forced with `--force` to bypass the cache, but the purpose of the cache is to avoid unnecessary API calls to GitHub. ### Example diff --git a/docs/EXAMPLES.md b/docs/EXAMPLES.md index 9ae0169..4f3a4a2 100644 --- a/docs/EXAMPLES.md +++ b/docs/EXAMPLES.md @@ -61,21 +61,21 @@ Update Check {: .important } The `check` command only checks for updates once every 24 hours caching the latest release information. Use `gogitup check --force` to bypass the cache and re-fetch from GitHub. -## Updating All Tools +## Upgrading All Tools -Run a single command to update every tracked binary that has a newer release: +Run a single command to upgrade every tracked binary that has a newer release: ```bash -gogitup update +gogitup upgrade ``` ``` -gogitup update --verbose -⟳ Updating 'bulkfilepr' from v0.2.2 to v0.2.3... -✓ Updated 'bulkfilepr' to v0.2.3 +gogitup upgrade --verbose +⟳ Upgrading 'bulkfilepr' from v0.2.2 to v0.2.3... +✓ Upgraded 'bulkfilepr' to v0.2.3 ℹ 'ghorgsync' is already up to date (v0.1.0) -✓ Updated 1 binary(ies). +✓ Upgraded 1 binary(ies). ``` ## Using JSON Output for Scripting diff --git a/docs/INSTALL.md b/docs/INSTALL.md index cb75f01..0523a05 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -46,7 +46,7 @@ cd gogitup go build -o gogitup ``` -## Updating with gogitup +## Upgrading with gogitup ### Registering with gogitup @@ -56,10 +56,10 @@ Tell **gogitup** that it should manage the updates for **gogitup**: gogitup add gogitup ``` -### Updating with gogitup +### Upgrading with gogitup -Update the registered packages using **gogitup**: +Upgrade the registered packages using **gogitup**: ```bash -gogitup update +gogitup upgrade ``` diff --git a/docs/README.md b/docs/README.md index 11c1524..9dd0843 100644 --- a/docs/README.md +++ b/docs/README.md @@ -23,6 +23,6 @@ gogitup add gogitup # Check for updates gogitup check -# Update all tracked tools -gogitup update +# Upgrade all tracked tools +gogitup upgrade ``` diff --git a/docs/USAGE.md b/docs/USAGE.md index 939df87..2279cdb 100644 --- a/docs/USAGE.md +++ b/docs/USAGE.md @@ -60,7 +60,7 @@ gogitup install 1. Fetches the latest release tag for the repository from the GitHub Releases API. 2. Runs `go install github.com//@`. 3. Verifies that the resulting binary (named after the repository) is available on `PATH`. -4. Registers the binary with **gogitup** for future `check` and `update` tracking. +4. Registers the binary with **gogitup** for future `check` and `upgrade` tracking. If the installed binary name differs from the repository name (uncommon), the installation itself still succeeds but the binary will not be registered automatically. Use `gogitup add ` to register it manually. @@ -68,7 +68,7 @@ If the installed binary name differs from the repository name (uncommon), the in ## `remove` -Removes a binary from tracking. The binary itself is not uninstalled, **gogitup** just stops tracking it for updates when you run `check` or `update`. +Removes a binary from tracking. The binary itself is not uninstalled, **gogitup** just stops tracking it for updates when you run `check` or `upgrade`. ```bash gogitup remove @@ -125,18 +125,18 @@ By default, `check` uses a non-expired cache entry to reduce GitHub API calls. U --- -## `update` +## `upgrade` -Checks for updates and runs `go install` to update every registered binary that has a newer release available. +Checks for updates and runs `go install` to upgrade every registered binary that has a newer release available. ```bash -gogitup update +gogitup upgrade ``` | Name | Required | Default | Description | |------|----------|---------|-------------| | `--verbose` | No | `false` | Show binaries that are already up to date while checking for updates | -**What `update` does:** +**What `upgrade` does:** -`update` uses installed binary metadata (`go version -m -json`) plus the GitHub Releases API to find the latest release, then runs `go install @` when an update is available. It refreshes the cache with the latest fetched tag and always fetches fresh release data (it does not rely on cached latest-version values). +`upgrade` uses installed binary metadata (`go version -m -json`) plus the GitHub Releases API to find the latest release, then runs `go install @` when an update is available. It refreshes the cache with the latest fetched tag and always fetches fresh release data (it does not rely on cached latest-version values). diff --git a/internal/cmd/root.go b/internal/cmd/root.go index bb18a29..d56b74c 100644 --- a/internal/cmd/root.go +++ b/internal/cmd/root.go @@ -30,8 +30,8 @@ func Execute(version string) { runList(os.Args[2:]) case "check": runCheck(os.Args[2:]) - case "update": - runUpdate(os.Args[2:]) + case "upgrade": + runUpgrade(os.Args[2:]) case "--help", "-h", "help": printHelp() default: @@ -53,7 +53,7 @@ func printHelp() { fmt.Printf(" %sremove%s Remove a registered binary\n", output.Cyan, output.Reset) fmt.Printf(" %slist%s List registered binaries and installed versions\n", output.Cyan, output.Reset) fmt.Printf(" %scheck%s Check for available updates\n", output.Cyan, output.Reset) - fmt.Printf(" %supdate%s Update all binaries with available updates\n", output.Cyan, output.Reset) + fmt.Printf(" %supgrade%s Upgrade all binaries with available updates\n", output.Cyan, output.Reset) fmt.Println() fmt.Printf(" %sFlags:%s\n", output.Bold, output.Reset) fmt.Printf(" %s--version, -v%s Print version\n", output.Cyan, output.Reset) diff --git a/internal/cmd/update.go b/internal/cmd/upgrade.go similarity index 68% rename from internal/cmd/update.go rename to internal/cmd/upgrade.go index 2188d76..a0bc468 100644 --- a/internal/cmd/update.go +++ b/internal/cmd/upgrade.go @@ -15,11 +15,11 @@ import ( "github.com/UnitVectorY-Labs/gogitup/internal/output" ) -type updateOptions struct { +type upgradeOptions struct { Verbose bool } -type updateDependencies struct { +type upgradeDependencies struct { runner goversion.Runner ghClient github.Client installer installer.Installer @@ -27,20 +27,20 @@ type updateDependencies struct { errOut *output.Writer } -func parseUpdateOptions(args []string, stderr io.Writer) (updateOptions, error) { - fs := flag.NewFlagSet("update", flag.ContinueOnError) +func parseUpgradeOptions(args []string, stderr io.Writer) (upgradeOptions, error) { + fs := flag.NewFlagSet("upgrade", flag.ContinueOnError) fs.SetOutput(stderr) verboseFlag := fs.Bool("verbose", false, "Show binaries that are already up to date") if err := fs.Parse(args); err != nil { - return updateOptions{}, err + return upgradeOptions{}, err } - return updateOptions{Verbose: *verboseFlag}, nil + return upgradeOptions{Verbose: *verboseFlag}, nil } -func runUpdate(args []string) { - opts, err := parseUpdateOptions(args, output.ErrorWriter.Out) +func runUpgrade(args []string) { + opts, err := parseUpgradeOptions(args, output.ErrorWriter.Out) if err != nil { if errors.Is(err, flag.ErrHelp) { return @@ -70,14 +70,14 @@ func runUpdate(args []string) { runner := &goversion.DefaultRunner{} ghClient := github.NewDefaultClient(github.ResolveToken(cfg.GitHubAuth)) inst := installer.NewDefaultInstallerWithOptions(cfg.GOPROXY, cfg.CGOEnabled) - deps := updateDependencies{ + deps := upgradeDependencies{ runner: runner, ghClient: ghClient, installer: inst, out: output.DefaultWriter, errOut: output.ErrorWriter, } - updated := runUpdateApps(cfg, c, opts, deps) + updated := runUpgradeApps(cfg, c, opts, deps) // Save updated cache _ = cache.Save(cachePath, c) @@ -86,11 +86,11 @@ func runUpdate(args []string) { if updated == 0 { deps.out.Info("All binaries are up to date.") } else { - deps.out.Success(fmt.Sprintf("Updated %d binary(ies).", updated)) + deps.out.Success(fmt.Sprintf("Upgraded %d binary(ies).", updated)) } } -func runUpdateApps(cfg *config.Config, c *cache.Cache, opts updateOptions, deps updateDependencies) int { +func runUpgradeApps(cfg *config.Config, c *cache.Cache, opts upgradeOptions, deps upgradeDependencies) int { updated := 0 for _, app := range cfg.Apps { @@ -117,36 +117,36 @@ func runUpdateApps(cfg *config.Config, c *cache.Cache, opts updateOptions, deps if info.Version == latest { if opts.Verbose { - deps.out.Info(updateUpToDateMessage(app.Name, info.Version)) + deps.out.Info(upgradeUpToDateMessage(app.Name, info.Version)) } continue } - deps.out.StartProgress(updateProgressMessage(app.Name, info.Version, latest)) + deps.out.StartProgress(upgradeProgressMessage(app.Name, info.Version, latest)) _, err = deps.installer.Install(info.Path, latest) if err != nil { - deps.errOut.Error(fmt.Sprintf("Failed to update '%s': %v", app.Name, err)) + deps.errOut.Error(fmt.Sprintf("Failed to upgrade '%s': %v", app.Name, err)) continue } - deps.out.Success(updateSuccessMessage(app.Name, latest)) + deps.out.Success(upgradeSuccessMessage(app.Name, latest)) updated++ } return updated } -func updateUpToDateMessage(name, version string) string { +func upgradeUpToDateMessage(name, version string) string { return fmt.Sprintf("'%s' is already up to date (%s)", name, installedVersion(version)) } -func updateProgressMessage(name, currentVersion, latestVersion string) string { - return fmt.Sprintf("Updating '%s' from %s to %s", name, installedVersion(currentVersion), latestVersionLabel(latestVersion)) +func upgradeProgressMessage(name, currentVersion, latestVersion string) string { + return fmt.Sprintf("Upgrading '%s' from %s to %s", name, installedVersion(currentVersion), latestVersionLabel(latestVersion)) } -func updateSuccessMessage(name, version string) string { - return fmt.Sprintf("Updated '%s' to %s", name, installedVersion(version)) +func upgradeSuccessMessage(name, version string) string { + return fmt.Sprintf("Upgraded '%s' to %s", name, installedVersion(version)) } func installedVersion(version string) string { diff --git a/internal/cmd/update_test.go b/internal/cmd/upgrade_test.go similarity index 86% rename from internal/cmd/update_test.go rename to internal/cmd/upgrade_test.go index 7111aa7..06cf4da 100644 --- a/internal/cmd/update_test.go +++ b/internal/cmd/upgrade_test.go @@ -67,12 +67,12 @@ func (s *stubInstaller) Install(modulePath, version string) (string, error) { return "ok", nil } -func TestParseUpdateOptionsVerbose(t *testing.T) { +func TestParseUpgradeOptionsVerbose(t *testing.T) { var stderr bytes.Buffer - opts, err := parseUpdateOptions([]string{"--verbose"}, &stderr) + opts, err := parseUpgradeOptions([]string{"--verbose"}, &stderr) if err != nil { - t.Fatalf("parseUpdateOptions returned error: %v", err) + t.Fatalf("parseUpgradeOptions returned error: %v", err) } if !opts.Verbose { @@ -80,7 +80,7 @@ func TestParseUpdateOptionsVerbose(t *testing.T) { } } -func TestRunUpdateAppsSuppressesUpToDateEntriesByDefault(t *testing.T) { +func TestRunUpgradeAppsSuppressesUpToDateEntriesByDefault(t *testing.T) { cfg := &config.Config{ Apps: []config.App{ {Name: "current"}, @@ -104,7 +104,7 @@ func TestRunUpdateAppsSuppressesUpToDateEntriesByDefault(t *testing.T) { var stdout bytes.Buffer var stderr bytes.Buffer - updated := runUpdateApps(cfg, c, updateOptions{}, updateDependencies{ + updated := runUpgradeApps(cfg, c, upgradeOptions{}, upgradeDependencies{ runner: runner, ghClient: ghClient, installer: installer, @@ -119,12 +119,12 @@ func TestRunUpdateAppsSuppressesUpToDateEntriesByDefault(t *testing.T) { t.Fatalf("expected default output to suppress up-to-date entries, got %q", stdout.String()) } - progress := "Updating 'stale' from " + output.Green + "v1.0.0" + output.Reset + " to " + output.Cyan + "v1.1.0" + output.Reset + progress := "Upgrading 'stale' from " + output.Green + "v1.0.0" + output.Reset + " to " + output.Cyan + "v1.1.0" + output.Reset if !strings.Contains(stdout.String(), progress) { t.Fatalf("expected progress output %q, got %q", progress, stdout.String()) } - success := "Updated 'stale' to " + output.Green + "v1.1.0" + output.Reset + success := "Upgraded 'stale' to " + output.Green + "v1.1.0" + output.Reset if !strings.Contains(stdout.String(), success) { t.Fatalf("expected success output %q, got %q", success, stdout.String()) } @@ -151,7 +151,7 @@ func TestRunUpdateAppsSuppressesUpToDateEntriesByDefault(t *testing.T) { } } -func TestRunUpdateAppsVerboseIncludesUpToDateEntries(t *testing.T) { +func TestRunUpgradeAppsVerboseIncludesUpToDateEntries(t *testing.T) { cfg := &config.Config{ Apps: []config.App{ {Name: "current"}, @@ -175,7 +175,7 @@ func TestRunUpdateAppsVerboseIncludesUpToDateEntries(t *testing.T) { var stdout bytes.Buffer var stderr bytes.Buffer - updated := runUpdateApps(cfg, c, updateOptions{Verbose: true}, updateDependencies{ + updated := runUpgradeApps(cfg, c, upgradeOptions{Verbose: true}, upgradeDependencies{ runner: runner, ghClient: ghClient, installer: installer,