dw-0 / kiauh

Klipper Installation And Update Helper
GNU General Public License v3.0
3.3k stars 474 forks source link

Feature Request: Access to home directory via `~/` for `[gcode_shell_command]` #484

Closed VIN-y closed 3 months ago

VIN-y commented 3 months ago

Is your feature request related to a problem? Please describe

To run a script, I will need to full directory starting from root: i.e: /home/pi/klipper_config/script.sh. This present a problem where the same [gcode_shell_command] cannot be put to another printer and just run. It will always require the user directory to be changed, from ../pi/.. to ../bob/.. for example.

Describe the solution you'd like

I would like to have an alias for the <user> home folder, much like in a normal Linux terminal command, where ~ can be used to for the home folder and the directory can be ~/klipper_config/script.sh. There is also the $USER alias, which make the directory looks like this: /home/$USER/klipper_config/script.sh .

Alternatively, if giving the user that kind of power is a cause of concern, as they can do extraordinary bad, like rm -rf ./* . It is worth considering only give the user access to ~/printer_data/config/. So that no matter what went wrong, it can be still be fixed via the web UI.

Describe alternatives you've considered

Placing my personal script in the ~/klipper folder. This would allow me to by pass the <user> home folder problem. as the script can be access via ./script.sh. However, that is still a bad idea, since it is where all the klipper's component live.

VIN-y commented 3 months ago

Never mind,

This can be achieved with bash -c '<command_that_need_directory>'