nfischer / shelljs-transpiler

:shell: Easily transpile Bash to ShellJS
https://nfischer.github.io/shelljs-transpiler/
MIT License
74 stars 8 forks source link

Unable to parse script #34

Open sasgithub opened 6 years ago

sasgithub commented 6 years ago

First attempted use of sh2js and it gives me;

Unable to parse script Line 26, col 26: 25 | function isint {

26 | expr $1 + 0 >/dev/null 2>&1 && return 0 ^ 27 | return 1 Expected "}" Please include this output in the bug report

The "}" it's looking for is on the next line;

# isint -  is integer?
function isint {
  expr $1 + 0 >/dev/null 2>&1 && return 0
  return 1
}
#


I agree that the above is ugly.
nfischer commented 6 years ago

Do simpler functions work? How about:

function sayHello {
  echo "hello"
  return 0
}

This is probably because we don't support && and || yet (issue #19). I haven't worked on this project in a while unfortunately. Let me know if you're interested in adding support for that feature.

sasgithub commented 6 years ago

It does indeed work for simple functions.

If I get some time I will take a look at what's required to add && and ||.

Is there a list of what all is left to implement?

nfischer commented 6 years ago

If I get some time I will take a look at what's required to add && and ||.

Cool! I'll post some thoughts on #19.

Is there a list of what all is left to implement?

Unfortunately no. I've filed github issues for the most obvious missing features. I would recommend playing with the web playground to get a feel for the state of the project.