Compare commits

..

No commits in common. "8cf41b0614995cc5ac6939e9714f4f8279427ce1" and "4b430213d54dce524509c3e2bf3954bffdf4cea1" have entirely different histories.

2 changed files with 7 additions and 24 deletions

View File

@ -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
View File

@ -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