未验证 提交 a7ccd7f3 编写于 作者: P Phodal HUANG

docs: add format for json

上级 36e4b483
......@@ -49,4 +49,5 @@ language/java
language/g4/*.tokens
language/g4/*.go
language/g4/*.interp
coca
\ No newline at end of file
coca
deps.json
......@@ -2,11 +2,10 @@ package cmd
import (
"encoding/json"
"fmt"
"github.com/spf13/cobra"
. "../adapter/call"
. "../adapter/identifier"
. "../utils"
)
var collCmd *cobra.Command = &cobra.Command{
......@@ -20,14 +19,9 @@ var collCmd *cobra.Command = &cobra.Command{
callApp := new(JavaCallApp)
callNodes := callApp.AnalysisPath(importPath)
cModel, _ := json.Marshal(callNodes)
cModel, _ := json.MarshalIndent(callNodes, "", "\t")
identifierApp := new(JavaIdentifierApp)
identNodes := identifierApp.AnalysisPath(importPath)
iNodes, _ := json.Marshal(identNodes)
fmt.Println(string(cModel))
fmt.Println(string(iNodes))
WriteToFile("deps.json", string(cModel))
}
},
}
......
......@@ -7,7 +7,7 @@ import (
"os"
)
func WriteFile(fileName string, payload string) {
func WriteToFile(fileName string, payload string) {
_ = ioutil.WriteFile(fileName, []byte(payload), 0644)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册