This repository was archived by the owner on Oct 3, 2023. It is now read-only.
Commit 343f135 1 parent f167540 commit 343f135 Copy full SHA for 343f135
File tree 5 files changed +47
-2
lines changed
5 files changed +47
-2
lines changed Original file line number Diff line number Diff line change 7
7
8
8
"gopkg.in/yaml.v3"
9
9
10
+ log "github.com/sirupsen/logrus"
10
11
"github.com/spf13/cobra"
11
12
)
12
13
@@ -25,6 +26,14 @@ var describeCmd = &cobra.Command{
25
26
Long : header + "\n Show detailed information about tools" ,
26
27
Args : cobra .ExactArgs (1 ),
27
28
ValidArgs : tools .GetNames (),
29
+ PreRunE : func (cmd * cobra.Command , args []string ) error {
30
+ if fileExists (prefix + "/" + metadataFile ) {
31
+ log .Tracef ("Loaded metadata file from %s" , prefix + "/" + metadataFile )
32
+ loadMetadata ()
33
+ }
34
+
35
+ return nil
36
+ },
28
37
RunE : func (cmd * cobra.Command , args []string ) error {
29
38
assertMetadataFileExists ()
30
39
assertMetadataIsLoaded ()
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package main
3
3
import (
4
4
"fmt"
5
5
6
+ log "github.com/sirupsen/logrus"
6
7
"github.com/spf13/cobra"
7
8
//log "github.com/sirupsen/logrus"
8
9
//"github.com/fatih/color"
@@ -18,6 +19,14 @@ var inspectCmd = &cobra.Command{
18
19
Long : header + "\n Inspect tools" ,
19
20
Args : cobra .ExactArgs (1 ),
20
21
ValidArgs : tools .GetNames (),
22
+ PreRunE : func (cmd * cobra.Command , args []string ) error {
23
+ if fileExists (prefix + "/" + metadataFile ) {
24
+ log .Tracef ("Loaded metadata file from %s" , prefix + "/" + metadataFile )
25
+ loadMetadata ()
26
+ }
27
+
28
+ return nil
29
+ },
21
30
RunE : func (cmd * cobra.Command , args []string ) error {
22
31
assertMetadataFileExists ()
23
32
assertMetadataIsLoaded ()
Original file line number Diff line number Diff line change 1
1
package main
2
2
3
3
import (
4
+ log "github.com/sirupsen/logrus"
4
5
"github.com/spf13/cobra"
5
6
)
6
7
@@ -14,7 +15,15 @@ var listCmd = &cobra.Command{
14
15
Short : "List tools" ,
15
16
Long : header + "\n List tools" ,
16
17
Args : cobra .NoArgs ,
17
- RunE : func (cmd * cobra.Command , args []string ) error {
18
+ PreRunE : func (cmd * cobra.Command , args []string ) error {
19
+ if fileExists (prefix + "/" + metadataFile ) {
20
+ log .Tracef ("Loaded metadata file from %s" , prefix + "/" + metadataFile )
21
+ loadMetadata ()
22
+ }
23
+
24
+ return nil
25
+ },
26
+ RunE : func (cmd * cobra.Command , args []string ) error {
18
27
assertMetadataFileExists ()
19
28
assertMetadataIsLoaded ()
20
29
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package main
3
3
import (
4
4
"fmt"
5
5
6
+ log "github.com/sirupsen/logrus"
6
7
"github.com/spf13/cobra"
7
8
)
8
9
@@ -24,6 +25,14 @@ var searchCmd = &cobra.Command{
24
25
Long : header + "\n Search for tools" ,
25
26
Args : cobra .ExactArgs (1 ),
26
27
ValidArgs : tools .GetNames (),
28
+ PreRunE : func (cmd * cobra.Command , args []string ) error {
29
+ if fileExists (prefix + "/" + metadataFile ) {
30
+ log .Tracef ("Loaded metadata file from %s" , prefix + "/" + metadataFile )
31
+ loadMetadata ()
32
+ }
33
+
34
+ return nil
35
+ },
27
36
RunE : func (cmd * cobra.Command , args []string ) error {
28
37
assertMetadataFileExists ()
29
38
assertMetadataIsLoaded ()
Original file line number Diff line number Diff line change 5
5
"sort"
6
6
7
7
"github.com/jedib0t/go-pretty/v6/table"
8
+ log "github.com/sirupsen/logrus"
8
9
"github.com/spf13/cobra"
9
10
)
10
11
@@ -18,7 +19,15 @@ var tagsCmd = &cobra.Command{
18
19
Short : "List tags" ,
19
20
Long : header + "\n List tags" ,
20
21
Args : cobra .NoArgs ,
21
- RunE : func (cmd * cobra.Command , args []string ) error {
22
+ PreRunE : func (cmd * cobra.Command , args []string ) error {
23
+ if fileExists (prefix + "/" + metadataFile ) {
24
+ log .Tracef ("Loaded metadata file from %s" , prefix + "/" + metadataFile )
25
+ loadMetadata ()
26
+ }
27
+
28
+ return nil
29
+ },
30
+ RunE : func (cmd * cobra.Command , args []string ) error {
22
31
assertMetadataFileExists ()
23
32
assertMetadataIsLoaded ()
24
33
You can’t perform that action at this time.
0 commit comments