Ph0enixKM / Amber

💎 Amber the programming language compiled to bash
https://amber-lang.com
GNU General Public License v3.0
3.51k stars 67 forks source link

"Unclosed command literal" shows always the last line instead of the culprit #226

Open Mte90 opened 1 week ago

Mte90 commented 1 week ago

So this code has various issues:

pub func is_command(command: Text): Bool {
    if (unsafe $command -v "{command} > /dev/null) {
        return true
    }
    return false
}

pub fun make_executable(path: Text): Bool {
    if file_exist(origin) {
        unsafe $chmod +x "{path}"$
        return true
    }

    echo "The file {$path} doesn't exist!"
    return false
}

pub fun is_root(): Bool {
    id = unsafe $id -u
    if (id == 0) {
        return true
    }
    return false
} 

But amber just report:

 ERROR 
Unclosed command literal
at [unknown]:25:1

24| }
25| 

We have 2 issues: