-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: add command to update fer to latest version (#14)
Co-authored-by: Samuel Mulatua <[email protected]>
- Loading branch information
Showing
3 changed files
with
44 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package console | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"os/exec" | ||
|
||
"github.com/kumparan/fer/installer" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var updateCmd = &cobra.Command{ | ||
Use: "update", | ||
Short: "update fer", | ||
Long: `update fer to latest version`, | ||
Run: updateVersion, | ||
} | ||
|
||
func updateVersion(cmd *cobra.Command, args []string) { | ||
updateCommand := exec.Command("go", "get", "-u", "github.com/kumparan/fer") | ||
PrintInfo("Updating fer...") | ||
err := updateCommand.Run() | ||
if err != nil { | ||
installer.ProgressBar(1) | ||
fmt.Println("Failed updating fer") | ||
fmt.Println(err) | ||
os.Exit(1) | ||
} | ||
|
||
installer.ProgressBar(100) | ||
|
||
PrintSuccess("Success updating fer!") | ||
} |