Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mangles indentation after "do case" #64

Open
diachedelic opened this issue Aug 19, 2020 · 0 comments
Open

mangles indentation after "do case" #64

diachedelic opened this issue Aug 19, 2020 · 0 comments

Comments

@diachedelic
Copy link

Looks like having the do and case statements adjacent on the same line confounds beautysh.

Fails

$ scripts/beautysh.py - <<EOF
> #!/bin/bash
> while getopts "h" OPT; do case $OPT in
> *) true ;;
> esac
> done
> 
> fn() {
>   echo not indented
> }
> EOF
File (stdin): error: indent/outdent mismatch: -1.
#!/bin/bash
while getopts "h" OPT; do case  in
    *) true ;;
esac
done

fn() {
echo not indented
}

Succeeds

$ scripts/beautysh.py - <<EOF
> #!/bin/bash
> while getopts "h" OPT; do
>   case $OPT in
>     *) true ;;
>   esac
> done
> 
> fn() {
>   echo indented
> }
> EOF
#!/bin/bash
while getopts "h" OPT; do
    case  in
        *) true ;;
    esac
done

fn() {
    echo indented ok
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant