daniel-sc / bash-shell-to-bat-converter

Converter for bash shell scripts to windows batch files.
https://daniel-sc.github.io/bash-shell-to-bat-converter
MIT License
229 stars 45 forks source link

switch cases #52

Closed shadichy closed 2 years ago

shadichy commented 2 years ago

original:

    case "$1" in
        "Darwin")
            javaFolder=~/"Library/Application Support/minecraft"
            bedrockFolder=~/"Library/Application Support/mcpelauncher/games/com.mojang"
            ;;
        *)
            javaFolder=~/".minecraft"
            bedrockFolder=~/".var/app/io.mrarm.mcpelauncher/data/mcpelauncher/games/com.mojang"
            [[ ! -d "${bedrockFolder}" ]] && bedrockFolder=~/".local/share/mcpelauncher/games/com.mojang"
            ;;
    esac

error code:

REM UNKNOWN: {"type":"Case","clause":{"text":"\"$1\"","expansion":[{"loc":{"start":1,"end":2},"parameter":1,"type":"ParameterExpansion","kind":"positional"}],"type":"Word"},"cases":[{"type":"CaseItem","pattern":[{"text":"Darwin","type":"Word"}],"body":{"type":"CompoundList","commands":[{"type":"Command","prefix":[{"text":"javaFolder=~/Library/Application Support/minecraft","type":"AssignmentWord"}]},{"type":"Command","prefix":[{"text":"bedrockFolder=~/Library/Application Support/mcpelauncher/games/com.mojang","type":"AssignmentWord"}]}]}},{"type":"CaseItem","pattern":[{"text":"*","type":"Word"}],"body":{"type":"CompoundList","commands":[{"type":"Command","prefix":[{"text":"javaFolder=~/.minecraft","type":"AssignmentWord"}]},{"type":"Command","prefix":[{"text":"bedrockFolder=~/.var/app/io.mrarm.mcpelauncher/data/mcpelauncher/games/com.mojang","type":"AssignmentWord"}]},{"type":"LogicalExpression","op":"and","left":{"type":"Command","name":{"text":"[[","type":"Word"},"suffix":[{"text":"!","type":"Word"},{"text":"-d","type":"Word"},{"text":"\"${bedrockFolder}\"","expansion":[{"loc":{"start":1,"end":16},"parameter":"bedrockFolder","type":"ParameterExpansion"}],"type":"Word"},{"text":"]]","type":"Word"}]},"right":{"type":"Command","prefix":[{"text":"bedrockFolder=~/.local/share/mcpelauncher/games/com.mojang","type":"AssignmentWord"}]}}]}}]}
shadichy commented 2 years ago

wait i can literally set variables to windows folder why would i need this ? :))

daniel-sc commented 2 years ago

Not sure if I understood your last comment - but "switch/case" is not yet supported. I'll add it when I find time :)

shadichy commented 2 years ago

thanks bro