Generate route with prefix (#1200)
* Generate route with prefix * Update api convert * Remove TrimSpace * Update path join * Format code * Format code Co-authored-by: anqiansong <anqiansong@bytedance.com>
This commit is contained in:
@@ -42,14 +42,15 @@ func DocCommand(c *cli.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, path := range files {
|
||||
api, err := parser.Parse(path)
|
||||
for _, p := range files {
|
||||
api, err := parser.Parse(p)
|
||||
if err != nil {
|
||||
return fmt.Errorf("parse file: %s, err: %s", path, err.Error())
|
||||
return fmt.Errorf("parse file: %s, err: %s", p, err.Error())
|
||||
}
|
||||
|
||||
err = genDoc(api, filepath.Dir(filepath.Join(outputDir, path[len(dir):])),
|
||||
strings.Replace(path[len(filepath.Dir(path)):], ".api", ".md", 1))
|
||||
api.Service = api.Service.JoinPrefix()
|
||||
err = genDoc(api, filepath.Dir(filepath.Join(outputDir, p[len(dir):])),
|
||||
strings.Replace(p[len(filepath.Dir(p)):], ".api", ".md", 1))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user