Taitava / obsidian-shellcommands

Execute system commands via hotkeys or command palette in Obsidian (https://obsidian.md). Some automated events are also supported, and execution via URI links.
GNU General Public License v3.0
348 stars 11 forks source link

`sh` is not recognised as a shell #281

Closed Taitava closed 1 year ago

Taitava commented 1 year ago

Discussed in https://github.com/Taitava/obsidian-shellcommands/discussions/280

Originally posted by tttienthinh October 31, 2022

I am on Ubuntu.
When I use Environment Linux (Use system default (sh)) : It returns error EscapeValue() : Unrecognised shell: sh


I should add case "sh": to: https://github.com/Taitava/obsidian-shellcommands/blob/2bbc0124a46852dd65bc88971078f839b80c0f85/src/variables/escapers/EscapeValue.ts#L29-L34


Added 2022-11-05

I noticed that also isShellSupported() needs changes, too. The function has currently a bug that allowed sh to pass as shell because it matched with the end letters of bash. I do want to accept sh, but I want to do it explicitly, not by accident 🙂. So I'm going to change the isShellSupported() function in a way that:

  1. It will be more strict when matching shells (compare whole file name, not just end of file name).
  2. I'll make the function notice sh explicitly.

Here's the current, problematic form of the function: https://github.com/Taitava/obsidian-shellcommands/blob/2bbc0124a46852dd65bc88971078f839b80c0f85/src/Shell.ts#L48-L58 (The line 52 is accidentally too lenient.)

Taitava commented 1 year ago

I removed the bug label as I now consider the addition of sh support more of a change rather than a fix.

Taitava commented 1 year ago

This is now done and will be released in 0.17.0.

Taitava commented 1 year ago

Released now.