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

Sudo block #220

Open Mte90 opened 1 week ago

Mte90 commented 1 week ago

An idea could be that every command inside this block get prefix with sudo.

Another can be like a check if the script is running as root or not, like a function user_is_root.

b1ek commented 1 week ago

like as to add sudo as built in?

Mte90 commented 1 week ago

Something like

sudo {
  apt install etc
} 
Ph0enixKM commented 1 week ago

This could be added to command modifiers:

sudo silent unsafe $ my_cmd $?

// or
unsafe sudo {
    $apt install cmd$
}
Ph0enixKM commented 1 week ago

The things is... what to do when people don't have sudo installed? This is not a built-in command and someone could have an alternative to that like doas

Mte90 commented 1 week ago

I think that Amber in that case will add on the first sudo usage (whatever the implementation is), block the execution if sudo is not available on top of the script