Compare commits
No commits in common. "8cf41b0614995cc5ac6939e9714f4f8279427ce1" and "4b430213d54dce524509c3e2bf3954bffdf4cea1" have entirely different histories.
8cf41b0614
...
4b430213d5
18
Makefile
18
Makefile
@ -1,17 +1,11 @@
|
|||||||
all:
|
all:
|
||||||
go build .
|
go run main.go tree.go test_files/test.md
|
||||||
|
|
||||||
run:
|
|
||||||
go run . test_files/test.md
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
go run . test_files/test.md
|
go run main.go tree.go test_files/test.md
|
||||||
go run . test_files/README.md
|
go run main.go tree.go test_files/README.md
|
||||||
go run . test_files/weird_headers.md
|
go run main.go tree.go test_files/weird_headers.md
|
||||||
go run . test_files/audio.md
|
go run main.go tree.go test_files/audio.md
|
||||||
|
|
||||||
install:
|
|
||||||
cp -v mdtoc /usr/local/bin/.
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
go clean
|
rm -vf main
|
||||||
|
13
main.go
13
main.go
@ -61,19 +61,8 @@ func parse_file(file_name string) []heading {
|
|||||||
return headings
|
return headings
|
||||||
}
|
}
|
||||||
|
|
||||||
func usage() {
|
|
||||||
fmt.Printf("Usage: mdtoc [FILE]\n")
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var file_name string = ""
|
file_name := os.Args[1]
|
||||||
|
|
||||||
if len(os.Args) == 2 {
|
|
||||||
file_name = os.Args[1]
|
|
||||||
} else {
|
|
||||||
usage()
|
|
||||||
}
|
|
||||||
|
|
||||||
var headings []heading = nil
|
var headings []heading = nil
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user