Skip to content

Commit

Permalink
feat: add no permissions warning
Browse files Browse the repository at this point in the history
  • Loading branch information
steveiliop56 committed Sep 10, 2024
1 parent 648a331 commit 0984401
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
14 changes: 7 additions & 7 deletions cmd/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ func init() {
}

var updateCmd = &cobra.Command{
Use: "update",
Use: "update [version]",
Short: "Update to the latest version",
Long: "Use this command to update your runtipi instance to the latest version",
Run: func(cmd *cobra.Command, args []string) {
// Checks args
if len(args) == 0 {
fmt.Printf("%s Please provide a version to update too, you can use latest, nightly or a specific tag\n", constants.Red("✗"))
os.Exit(1)
Args: cobra.MinimumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
// Permission Warning
if noPermissions {
fmt.Printf("%s No permissions mode enabled, you may face issues with Runtipi\n", constants.Yellow("⚠"))
}

// Root folder
Expand Down Expand Up @@ -56,7 +56,7 @@ var updateCmd = &cobra.Command{
os.Exit(1)
}

spinner.PrintUpdate(fmt.Sprintf("Updating from %s to %s", constants.Blue(currentVersion), constants.Blue(version)))
spinner.Update(fmt.Sprintf("Updating from %s to %s", constants.Blue(currentVersion), constants.Blue(version)))

// Validate
spinner.SetMessage("Validating version")
Expand Down
6 changes: 6 additions & 0 deletions internal/commands/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@ import (
"path"

"github.com/Delta456/box-cli-maker"
"github.com/steveiliop56/runtipi-cli-go/internal/constants"
"github.com/steveiliop56/runtipi-cli-go/internal/env"
"github.com/steveiliop56/runtipi-cli-go/internal/spinner"
"github.com/steveiliop56/runtipi-cli-go/internal/system"
)

func Start(envFile string, noPermissions bool) {
// Permission Warning
if noPermissions {
fmt.Printf("%s No permissions mode enabled, you may face issues with Runtipi\n", constants.Yellow("⚠"))
}

// Docker check
spinner.SetMessage("Checking user permissions")
spinner.Start()
Expand Down
4 changes: 2 additions & 2 deletions internal/spinner/spinner.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ func Fail(message string) {
s.Start()
}

func PrintUpdate(message string) {
func Update(message string) {
s.Stop()
fmt.Printf("%s %s\n", constants.Blue("↑"), message)
s.Start()
}
}

0 comments on commit 0984401

Please sign in to comment.