Merge pull request 'Apply Patch' (#1) from usage into master
Reviewed-on: #1
This commit is contained in:
commit
8cf41b0614
18
Makefile
18
Makefile
@ -1,11 +1,17 @@
|
||||
all:
|
||||
go run main.go tree.go test_files/test.md
|
||||
go build .
|
||||
|
||||
run:
|
||||
go run . test_files/test.md
|
||||
|
||||
test:
|
||||
go run main.go tree.go test_files/test.md
|
||||
go run main.go tree.go test_files/README.md
|
||||
go run main.go tree.go test_files/weird_headers.md
|
||||
go run main.go tree.go test_files/audio.md
|
||||
go run . test_files/test.md
|
||||
go run . test_files/README.md
|
||||
go run . test_files/weird_headers.md
|
||||
go run . test_files/audio.md
|
||||
|
||||
install:
|
||||
cp -v mdtoc /usr/local/bin/.
|
||||
|
||||
clean:
|
||||
rm -vf main
|
||||
go clean
|
||||
|
13
main.go
13
main.go
@ -61,8 +61,19 @@ func parse_file(file_name string) []heading {
|
||||
return headings
|
||||
}
|
||||
|
||||
func usage() {
|
||||
fmt.Printf("Usage: mdtoc [FILE]\n")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
func main() {
|
||||
file_name := os.Args[1]
|
||||
var file_name string = ""
|
||||
|
||||
if len(os.Args) == 2 {
|
||||
file_name = os.Args[1]
|
||||
} else {
|
||||
usage()
|
||||
}
|
||||
|
||||
var headings []heading = nil
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user