File tree Expand file tree Collapse file tree 5 files changed +62
-1
lines changed Expand file tree Collapse file tree 5 files changed +62
-1
lines changed Original file line number Diff line number Diff line change 18
18
- [ ] This PR does not contain plagiarized content.
19
19
- [ ] The title of my pull request is a short description of the requested changes.
20
20
- [ ] I have updated the documentation accordingly (if required).
21
+ - [ ] Update the version of the ` CliVersion ` variable in ` cmd/version.go ` file (if their is a version change).
21
22
22
23
### 📄 Note to reviewers <!-- Add notes to reviewers if applicable -->
23
24
Original file line number Diff line number Diff line change 19
19
github-token : ${{ secrets.PA_TOKEN }}
20
20
output-file : " false"
21
21
skip-commit : " true"
22
-
22
+ create-summary : ' true '
23
23
outputs :
24
24
tag : ${{ steps.changelog.outputs.tag }}
25
25
Original file line number Diff line number Diff line change @@ -49,12 +49,15 @@ Available Commands:
49
49
help Help about any command
50
50
image Know details about an image (Please put your question in quotes)
51
51
search Ask a question and get a response (Please put your question in quotes)
52
+ update Update gencli to the latest version
53
+ version Know the installed version of gencli
52
54
53
55
Flags:
54
56
-h, --help help for gencli
55
57
```
56
58
57
59
> eg: gencli search "What is kubernetes" --words 525
60
+
58
61
> eg: gencli image "What is this image about?" --path /path/to/image.jpg --format jpg
59
62
60
63
### 📜 License
Original file line number Diff line number Diff line change
1
+ package cmd
2
+
3
+ import (
4
+ "fmt"
5
+ "os/exec"
6
+
7
+ "github.com/spf13/cobra"
8
+ )
9
+
10
+ // updateCmd represents the update command
11
+ var updateCmd = & cobra.Command {
12
+ Use : "update" ,
13
+ Short : "Update gencli to the latest version" ,
14
+ Long : `This command will help you to update gencli to the latest version.` ,
15
+ Run : func (cmd * cobra.Command , args []string ) {
16
+ update ()
17
+ },
18
+ }
19
+
20
+ func update () {
21
+ cmd := exec .Command ("go" , "install" , "github.com/Pradumnasaraf/gencli@latest" )
22
+ _ , err := cmd .Output ()
23
+
24
+ if err != nil {
25
+ fmt .Println ("Error executing command:" , err )
26
+ return
27
+ }
28
+
29
+ fmt .Printf ("CLI updated successfully to the latest version (If any). Current version is: %s\n " , CliVersion )
30
+ }
31
+
32
+ func init () {
33
+ rootCmd .AddCommand (updateCmd )
34
+ }
Original file line number Diff line number Diff line change
1
+ package cmd
2
+
3
+ import (
4
+ "fmt"
5
+
6
+ "github.com/spf13/cobra"
7
+ )
8
+
9
+ const CliVersion = "v1.4.0"
10
+
11
+ // versionCmd represents the version command
12
+ var versionCmd = & cobra.Command {
13
+ Use : "version" ,
14
+ Short : "Know the installed version of gencli" ,
15
+ Long : `This command will help you to know the installed version of gencli` ,
16
+ Run : func (cmd * cobra.Command , args []string ) {
17
+ fmt .Println ("gencli version:" , CliVersion )
18
+ },
19
+ }
20
+
21
+ func init () {
22
+ rootCmd .AddCommand (versionCmd )
23
+ }
You can’t perform that action at this time.
0 commit comments