mirror of
https://github.com/daveberrys/guh.git
synced 2026-11-29 00:56:45 +08:00
exact version == print, delete comand
This commit is contained in:
1 parent
f5b73893b7
commit
d0cb8499df
3 files changed
+26
No files matched your search
@@ -0,0 +1,24 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var removeCmd = &cobra.Command{
|
||||
Use: "remove",
|
||||
Short: "Deletes the Guh binary",
|
||||
Args: cobra.NoArgs,
|
||||
RunE: func(cobraCmd *cobra.Command, args []string) error {
|
||||
fmt.Println("Deleting Guh binary...")
|
||||
fmt.Println("Goodbye, world!")
|
||||
|
||||
sysExec, _ := os.Executable()
|
||||
err := os.Remove(sysExec)
|
||||
if err != nil { return err }
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
@@ -10,6 +10,7 @@ func init() {
|
||||
cliCmd.AddCommand(updateCmd)
|
||||
cliCmd.AddCommand(versionCmd)
|
||||
cliCmd.AddCommand(installCmd)
|
||||
cliCmd.AddCommand(removeCmd)
|
||||
}
|
||||
|
||||
var cliCmd = &cobra.Command{
|
||||
|
||||
@@ -35,6 +35,7 @@ var updateCmd = &cobra.Command{
|
||||
guhGithubHash := commits[0].Sha[:7]
|
||||
|
||||
if guhGithubHash == Version {
|
||||
fmt.Println("Already up to date.")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user