added markdown output
This commit is contained in:
parent
164d84c391
commit
688a65b4c9
1 changed files with 10 additions and 1 deletions
11
cmd/root.go
11
cmd/root.go
|
|
@ -47,7 +47,7 @@ Usage:
|
||||||
path, _ := cmd.Flags().GetString("path")
|
path, _ := cmd.Flags().GetString("path")
|
||||||
if path != "" {
|
if path != "" {
|
||||||
comments := readFileTree(path)
|
comments := readFileTree(path)
|
||||||
fmt.Println(comments)
|
mdTableFormatter(comments)
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("ERROR: No path provided, please provide path using the -p flag")
|
fmt.Println("ERROR: No path provided, please provide path using the -p flag")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|
@ -138,3 +138,12 @@ func readFileTree(path string) []Comment {
|
||||||
})
|
})
|
||||||
return comments
|
return comments
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func mdTableFormatter(comments []Comment) {
|
||||||
|
fmt.Println("| File Path | Line Number | Priority | Task |")
|
||||||
|
fmt.Println("| --------- | ----------- | -------- | ---- |")
|
||||||
|
for _, comment := range comments {
|
||||||
|
// You can access each `comment` here
|
||||||
|
fmt.Printf("| %s | %d | %d | %s |\n",comment.FilePath,comment.LineNumber,comment.Priority,comment.Task)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue