Skip to content

Commit 47a714c

Browse files
author
Fletcher Aksel
committed
show raw sources with show sources command.
Signed-off-by: Fletcher Aksel <[email protected]>
1 parent e28d802 commit 47a714c

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

cmd/show.go

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"fmt"
55
"os"
66

7-
"gettrackers/internal/fetch"
87
"gettrackers/internal/filter"
8+
"gettrackers/internal/paths"
99

1010
"github.com/spf13/cobra"
1111
)
@@ -35,15 +35,22 @@ func init() {
3535
}
3636

3737
func runShowSources(cmd *cobra.Command, args []string) error {
38-
urls, err := fetch.LoadCache()
38+
// Read and output the raw cache file content (unfiltered)
39+
cacheFile, err := paths.GetCacheFile()
3940
if err != nil {
40-
return fmt.Errorf("failed to load cache: %w", err)
41+
return fmt.Errorf("failed to get cache file path: %w", err)
4142
}
4243

43-
for _, url := range urls {
44-
fmt.Println(url)
44+
data, err := os.ReadFile(cacheFile)
45+
if err != nil {
46+
if os.IsNotExist(err) {
47+
return fmt.Errorf("cache file does not exist")
48+
}
49+
return fmt.Errorf("failed to read cache file: %w", err)
4550
}
4651

52+
// Output the raw cache file content
53+
fmt.Print(string(data))
4754
return nil
4855
}
4956

main.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@ func main() {
1111
os.Exit(1)
1212
}
1313
}
14-

0 commit comments

Comments
 (0)