Open loynoir opened 1 year ago
We already have the --to-json
flag, for example shfmt --to-json <<<'foo $bar'
. There is no jsonschema, but the types are the nodes you can see in https://pkg.go.dev/mvdan.cc/sh/v3/syntax.
There's also --from-json
, which ingests the same kind of AST in json form.
@mvdan
The jsonschema
request is for generating type definition.
For example, my use case, typescript have great tool to generate type definition from jsonschema.
As swagger
and openapi
use jsonschema, there should be tools to generate type definition for other language too.
Sure, I'll look at a jsonschema.
There is https://www.npmjs.com/package/@sinclair/typebox in typescript ecosystem, which write code to get jsonchema and typescript definition at the same time with no need to compile.
I guess there might be something similar within golang system?
feat
reason
I guess shellcheck and shfmt might be the largest two shellscript-AST-related repos. (Are they?)
Some shellscript AST parser I found seems incomplete.
It would be awesome to re-use
shellcheck
AST orshfmt
AST, from other language.So no need to workaround some other incomplete shellscript AST parsers.
related
https://github.com/koalaman/shellcheck/issues/2676