refactor: rename updater package to update
This commit is contained in:
+2
-2
@@ -7,7 +7,7 @@ import (
|
|||||||
"slices"
|
"slices"
|
||||||
|
|
||||||
"github.com/mathismqn/godeez/internal/buildinfo"
|
"github.com/mathismqn/godeez/internal/buildinfo"
|
||||||
"github.com/mathismqn/godeez/internal/updater"
|
"github.com/mathismqn/godeez/internal/update"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"golang.org/x/term"
|
"golang.org/x/term"
|
||||||
)
|
)
|
||||||
@@ -19,7 +19,7 @@ func Execute(ctx context.Context) error {
|
|||||||
|
|
||||||
var notice <-chan string
|
var notice <-chan string
|
||||||
if wantsUpdateNotice(root) {
|
if wantsUpdateNotice(root) {
|
||||||
notice = updater.StartCheck(ctx)
|
notice = update.StartCheck(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
err := root.ExecuteContext(ctx)
|
err := root.ExecuteContext(ctx)
|
||||||
|
|||||||
+4
-4
@@ -7,7 +7,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/mathismqn/godeez/internal/buildinfo"
|
"github.com/mathismqn/godeez/internal/buildinfo"
|
||||||
"github.com/mathismqn/godeez/internal/updater"
|
"github.com/mathismqn/godeez/internal/update"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -39,11 +39,11 @@ func newUpdateCmd() *cobra.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func runUpdate(ctx context.Context, opts *updateOptions) error {
|
func runUpdate(ctx context.Context, opts *updateOptions) error {
|
||||||
if err := updater.CheckUpdatable(); err != nil {
|
if err := update.CheckUpdatable(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
u := updater.New()
|
u := update.New()
|
||||||
u.Out = os.Stdout
|
u.Out = os.Stdout
|
||||||
current := buildinfo.Version()
|
current := buildinfo.Version()
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ func runUpdate(ctx context.Context, opts *updateOptions) error {
|
|||||||
latest := release.Version()
|
latest := release.Version()
|
||||||
fmt.Printf("Current: %s\nLatest: %s\n", current, latest)
|
fmt.Printf("Current: %s\nLatest: %s\n", current, latest)
|
||||||
|
|
||||||
if !updater.IsNewer(current, latest) && !opts.force {
|
if !update.IsNewer(current, latest) && !opts.force {
|
||||||
fmt.Println("Already up to date.")
|
fmt.Println("Already up to date.")
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package updater
|
package update
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package updater
|
package update
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package updater
|
package update
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package updater
|
package update
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package updater
|
package update
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
Reference in New Issue
Block a user