add filename handling
This commit is contained in:
parent
7584ed171f
commit
ebc25651f0
20
build.go
20
build.go
@ -127,8 +127,13 @@ func testCleanup() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GfmrunActionFunc(_ *cli.Context) error {
|
func GfmrunActionFunc(c *cli.Context) error {
|
||||||
file, err := os.Open("README.md")
|
filename := c.Args().Get(0)
|
||||||
|
if filename == "" {
|
||||||
|
filename = "README.md"
|
||||||
|
}
|
||||||
|
|
||||||
|
file, err := os.Open(filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -146,11 +151,16 @@ func GfmrunActionFunc(_ *cli.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return runCmd("gfmrun", "-c", fmt.Sprint(counter), "-s", "README.md")
|
return runCmd("gfmrun", "-c", fmt.Sprint(counter), "-s", filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TocActionFunc(_ *cli.Context) error {
|
func TocActionFunc(c *cli.Context) error {
|
||||||
err := runCmd("node_modules/.bin/markdown-toc", "-i", "README.md")
|
filename := c.Args().Get(0)
|
||||||
|
if filename == "" {
|
||||||
|
filename = "README.md"
|
||||||
|
}
|
||||||
|
|
||||||
|
err := runCmd("node_modules/.bin/markdown-toc", "-i", filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user