Comparing version 0.0.5 to 0.0.6
{ | ||
"name": "mvdan-sh", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "A shell parser and formatter (POSIX/Bash/mksh)", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -15,10 +15,17 @@ # mvdan-sh | ||
var p = syntax.NewParser() | ||
var parser = syntax.NewParser() | ||
var printer = syntax.NewPrinter() | ||
var src = "echo 'foo'" | ||
var f = p.Parse(src, "src.js") | ||
var f = parser.Parse(src, "src.js") | ||
// what kind of command did we parse? | ||
var stmt = f.StmtList.Stmts[0] | ||
var args = stmt.Cmd.Args | ||
console.log(args[0]) | ||
console.log(syntax.NodeType(stmt.Cmd)) // CallExpr | ||
// change 'foo' to 'bar' | ||
stmt.Cmd.Args[1].Parts[0].Value = "bar" | ||
// print the code back out | ||
console.log(printer.Print(f)) // echo 'bar' | ||
``` |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1693982
31181
31