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
351 stars 11 forks source link

Test the plugin on Macintosh #1

Closed Taitava closed 3 years ago

Taitava commented 3 years ago

I do not own a Mac, so I can't test this myself.

Just test that this plugin is able to run shell commands on Mac. You can decide yourself what commands you want to test/execute. Please report here the following details:

Just to clarify: I'm not only looking for reports if the plugin does not work; you can also report if you notice that the plugin does work on Mac, because I do not have that information at the moment.

Thank you for helping me!

skipadu commented 3 years ago

Thanks for creating this plugin! It was not yet available to be installed through the Obsidian, so I installed it manually to plugins directory of my vault to test this on macOS.

Versions

macOS: 11.5.2 Obsidian: 0.12.5 obsidian-shellcommands: 0.1.0

Commands tested

Opening Firefox with searching the selection from Duckduckgo.

open -a firefox https://duckduckgo.com/?q={{selection}}

Creating folders if not existing and then creating daily note for current day.

Here is context to see which kind of directory structure I have for daily notes:

vault_root
├── daily_notes
│ └── 2021
│   └──  08
│     ├── 2021-08-28.md
│     ├── 2021-08-29.md
│     ├── 2021-08-30.md
mkdir -p daily_notes/{{date:YYYY}}/{{date:MM}} && touch daily_notes/{{date:YYYY}}/{{date:MM}}/{{date:YYYY-MM-DD}}.md

Results

Both commands worked as expected when used them through the Obsidian's command palette (Cmd + P)

Taitava commented 3 years ago

Thank you for testing, fellow Finn! 🙂

Is it ok if I put your GitHub username and link to the README.md in the Tested platforms section when I put Mac version info there? 🙂

Edit: Yea the plugin is not yet available via the normal installation process, but it should be soon. I didn't actually expect people to find this plugin so early, I planned to write a post about this in the forum once it's available via the normal installation process, but nice to see that people have explored the Obsidian releases repository and found this plugin already. 👍

skipadu commented 3 years ago

Thank you for testing, fellow Finn! 🙂 Is it ok if I put your GitHub username and link to the README.md in the Tested platforms section when I put Mac version info there? 🙂

🇫🇮 Yes, that would be nice 😊

Taitava commented 3 years ago

Yes, that would be nice 😊

Added! 🙂

Even though I closed this issue, testing on Mac can still be performed in the future whenever new versions of Shell commands are released. Tests can be done by anyone, and results can be posted to this issue even though it's closed. I will then update README.md accordning to new tests and also add the tester's GitHub name and GitHub link next to the test record. 👍

FelipeRearden commented 3 years ago

Release 0.2.0 MacOS 11.1 Obsidian: 0.12.15

Status: ✅

Shell Commands tested:

Mac Keyboard Shortcuts:

echo "tell application \"System Events\" to key code 76" | osascript -> Press ENTER

echo "tell application \"System Events\" to key code 48" | osascript -> Press TAB

echo "tell application \"System Events\" to key code 9 using command down" | osascript -> Paste

echo "tell application \"System Events\" to key code 8 using command down" | osascript -> Copy

Text Insertion to Clipboard

echo Hello World | pbcopy -> Copy "Hello World" to the Clipboard and go to newline

printf "Hello World" | pbcopy -> Copy "Hello World" to the Clipboard and stays in the same line

Obsidian URI

open "obsidian://advanced-uri?vault=Test&workspace=WK1" -> open workspace

open "obsidian://advanced-uri?vault=Test&filepath=Pasta4%252Fregex.md"-> open file

Taitava commented 3 years ago

Thanks a lot! I updated README.md.

FelipeRearden commented 3 years ago

Release 0.3.0 MacOS 11.1 Obsidian: 0.12.15

Status: ✅

Shell Commands tested:

Mac Keyboard Shortcuts:

echo "tell application \"System Events\" to key code 76" | osascript -> Press ENTER

echo "tell application \"System Events\" to key code 48" | osascript -> Press TAB

echo "tell application \"System Events\" to key code 9 using command down" | osascript -> Paste

echo "tell application \"System Events\" to key code 8 using command down" | osascript -> Copy

Text Insertion to Clipboard

echo Hello World | pbcopy -> Copy "Hello World" to the Clipboard and go to newline

printf "Hello World" | pbcopy -> Copy "Hello World" to the Clipboard and stays in the same line

Obsidian URI

open "obsidian://advanced-uri?vault=Test&workspace=WK1" -> open workspace

open "obsidian://advanced-uri?vault=Test&filepath=Pasta4%252Fregex.md"-> open file

&& Operator

printf "Hello World" | pbcopy && echo "tell application \"System Events\" to key code 9 using command down" | osascript -> copy and paste in single Shell Command

Append Text/Clipboard to Files

echo "Hello World" >> /Users/user/vault_folder/MyNotes.md -> append "Hello World" to end of the note MyNotes.md

FelipeRearden commented 2 years ago

Release 0.4.1 MacOS 11.1 Obsidian: 0.12.15

Status: ✅

Shell Commands tested:

Mac Keyboard Shortcuts:

echo "tell application \"System Events\" to key code 76" | osascript -> Press ENTER

echo "tell application \"System Events\" to key code 48" | osascript -> Press TAB

echo "tell application \"System Events\" to key code 9 using command down" | osascript -> Paste

echo "tell application \"System Events\" to key code 8 using command down" | osascript -> Copy

Text Insertion to Clipboard

echo Hello World | pbcopy -> Copy "Hello World" to the Clipboard and go to newline

printf "Hello World" | pbcopy -> Copy "Hello World" to the Clipboard and stays in the same line

Open Obsidian Hidden Folder

open "User/login/Vault/.obsidian/snippets" -> open Snippets Folder

Append Text/Clipboard to Files

echo "Hello World" >> /Users/user/vault_folder/MyNotes.md -> append "Hello World" to end of the note MyNotes.md

FelipeRearden commented 2 years ago

Release 0.5.0 MacOS 11.1 Obsidian: 0.12.15

Status: ✅

Shell Commands tested:

Mac Keyboard Shortcuts:

echo "tell application \"System Events\" to key code 76" | osascript -> Press ENTER

echo "tell application \"System Events\" to key code 48" | osascript -> Press TAB

echo "tell application \"System Events\" to key code 9 using command down" | osascript -> Paste

echo "tell application \"System Events\" to key code 8 using command down" | osascript -> Copy

Text Insertion to Clipboard

echo Hello World | pbcopy -> Copy "Hello World" to the Clipboard and go to newline

printf "Hello World" | pbcopy -> Copy "Hello World" to the Clipboard and stays in the same line

Open Obsidian Hidden Folder

open "User/login/Vault/.obsidian/snippets" -> open Snippets Folder

Append Text/Clipboard to Files

echo "Hello World" >> /Users/user/vault_folder/MyNotes.md -> append "Hello World" to end of the note MyNotes.md

Tags

printf "{{tags:,}}," | pbcopy -> Copy All Tags from the Active Note to the Clipboard

Taitava commented 2 years ago

0.5.1 is now released, but it contains so small changes that I don't think a Mac test is needed. I've done full tests on Windows & Linux, so I guess it's enough. 🙂 And 0.6.0 is under development, so Mac test can be done when it's released.

FelipeRearden commented 2 years ago

Thanks for the information @Taitava !!!

OK. I will wait until 0.6.0 for a complete MacOS test

Have a great day!

FelipeRearden commented 2 years ago

Release 0.6.0 MacOS 11.1 Obsidian: 0.12.15

Status: ✅

Shell Commands tested:

Mac Keyboard Shortcuts:

echo "tell application \"System Events\" to key code 76" | osascript -> Press ENTER

echo "tell application \"System Events\" to key code 48" | osascript -> Press TAB

echo "tell application \"System Events\" to key code 9 using command down" | osascript -> Paste

echo "tell application \"System Events\" to key code 8 using command down" | osascript -> Copy

Text Insertion to Clipboard

echo Hello World | pbcopy -> Copy "Hello World" to the Clipboard and go to newline

printf "Hello World" | pbcopy -> Copy "Hello World" to the Clipboard and stays in the same line

Open Obsidian Hidden Folder

open "User/login/Vault/.obsidian/snippets" -> open Snippets Folder

Append Text/Clipboard to Files

echo "Hello World" >> /Users/user/vault_folder/MyNotes.md -> append "Hello World" to end of the note MyNotes.md

Tags

printf "{{tags:,}}," | pbcopy -> Copy All Tags from the Active Note to the Clipboard

Output Channels

echo "tags: "["{{tags:,}}"] -> copy {{tags}} to the clipboard using Clipboard

printf "Hello World" -> append text to the current file using Current File: TOP

echo "Hello World" -> append text to the and of the file Current File: BOTTOM

printf "Hello World" -> insert text to the caret position Current File: Caret Position

echo "Hello World" -> create a notification ballon using Notification

Taitava commented 2 years ago

Thanks a lot! 🙂 I updated README.md.

Taitava commented 2 years ago

No need to test 0.6.1 on Mac, it contains so tiny change, and worked well on Windows & Linux.

FelipeRearden commented 2 years ago

No need to test 0.6.1 on Mac, it contains so tiny change, and worked well on Windows & Linux.

Thanks for information @Taitava ! I'm sorry for my absence this past week. I have a problem here at my house and I'm only on mobile until the next Monday! I'm catching all of you messages now :)

Have a great day!

Taitava commented 2 years ago

No worries! 🙂 I can't expect you to be always around, its always voluntary! 😎 You have been really, really helpful already, and have used a lot of your time for this plugin. I appreciate it! 🌞

FelipeRearden commented 2 years ago

No worries! 🙂 I can't expect you to be always around, its always voluntary! 😎 You have been really, really helpful already, and have used a lot of your time for this plugin. I appreciate it! 🌞

Thanks @Taitava !!! I will always try to do my best to help you with this plugin!

As I said before, I really love this plugin and it changed my Obsidian life :) The amount of workflows that now are available to me is beacause you decideed to create this for us :)

Based on our conversations, we have so many features ahead that I have this myself duty to give my little help testing the new features :) 🌞

Taitava commented 2 years ago

Thanks @Taitava !!! I will always try to do my best to help you with this plugin!

Thanks! 🙂

As I said before, I really love this plugin and it changed my Obsidian life :) The amount of workflows that now are available to me is beacause you decideed to create this for us :)

That's still nice to hear! 🙂 I started this because I wanted just to be able to quickly and easily open Git applications (a really simple use case, without any variables, output handling or other "extras"), so it's nice to see that something that starts from a very little thing, can become an essential part of someone else's workflow in a very different way. 😎

Based on our conversations, we have so many features ahead that I have this myself duty to give my little help testing the new features :) 🌞

Yea, we'll have a lot of cool stuff still coming. The OS & shell support thing (#76) plus variable escaping (#11) have taken so much time from me that I will be glad when those will be finally released and out of the way of other stuff like events, preactions, autocomplete and {{note_content}} & {{file_content}} variables. Especially #11 has been a really important thing to increase the quality of this plugin that I didn't want to postpone it anymore. And #76 is good for my testing vault so I can more easily customise test commands for different operating systems. I don't know if #76 is useful for others than me, but I do have for example a school vault that resides both on my Linux machine and Windows machine, and I sync it via Git. That vault has some OS specific commands. I don't know how many Obsidian users sync their vaults between machines that have different OS's. Syncing between computer and mobile may be one thing, but now in case of SC, we're only talking about syncing between computers, as mobile is not supported by SC.

FelipeRearden commented 2 years ago

That's still nice to hear! 🙂 I started this because I wanted just to be able to quickly and easily open Git applications (a really simple use case, without any variables, output handling or other "extras"), so it's nice to see that something that starts from a very little thing, can become an essential part of someone else's workflow in a very different way. 😎

😃 For me, that the magic of SC everyone have a different workflow :)

And I'm sorry for bring more and more features 😄 😄 😄 😄 😄 😄 😄 😄 😄 😄

Yea, we'll have a lot of cool stuff still coming. The OS & shell support thing (#76) plus variable escaping (#11) have taken so much time from me that I will be glad when those will be finally released and out of the way of other stuff like events, preactions, autocomplete and {{note_content}} & {{file_content}} variables. Especially #11 has been a really important thing to increase the quality of this plugin that I didn't want to postpone it anymore. And #76 is good for my testing vault so I can more easily customise test commands for different operating systems. I don't know if #76 is useful for others than me, but I do have for example a school vault that resides both on my Linux machine and Windows machine, and I sync it via Git. That vault has some OS specific commands. I don't know how many Obsidian users sync their vaults between machines that have different OS's. Syncing between computer and mobile may be one thing, but now in case of SC, we're only talking about syncing between computers, as mobile is not supported by SC.

As you know I'm not an expert but I read all post from you and I understood your ideas for these new features in #76 and #11 .

In my country we would talk this as changing the pipes in a house. It's crucial and important and nobody sees :)

I saw something about SC on iOS but I need some time to understand what I saw and share with you. There is an app that is a Terminal for iOS but I didn't understood yet.

events, preactions, autocomplete and {{note_content}} & {{file_content}} variables will be an amazing features. Will get SC into another level of reach for Obsidian users :)

Taitava commented 2 years ago

The most important thing to test is that special characters escaping in variable values works ok (\ added in front of special characters on Mac). If these escapings cause any problems, let's figure them out 🙂. You don't need to test changing the shell (I guess as a Mac user your shell is either Bash or Zsh), because I guess there's not much benefit from it on Mac. On Windows, the default shell is CMD which is a nightmare and PowerShell would be a better choice. In addition to changing from CMD to PowerShell on Windows, the ability to change the shell is good for users who know differences between different shells and who have some really special need to use explicitly a specific shell. (Was this explanation understandable at all? 😆 ) Maybe you can try making OS specific commands at some point, but that's only needed if you synchronise a vault (+ SC settings) between your Mac and Windows machine, but I don't know if you do that kind of stuff, so it's not so important.

In my country we would talk this as changing the pipes in a house. It's crucial and important and nobody sees :)

True 🙂

I saw something about SC on iOS but I need some time to understand what I saw and share with you. There is an app that is a Terminal for iOS but I didn't understood yet.

👍

gapmiss commented 2 years ago

macOS test report

Environment

Shell Commands v0.14.0 Obsidian v0.15.9 (installer version: v0.15.9) macOS Monterey 12.4 (21F79)

Commands tested

# Open in VSCodium
codium --goto {{file_path:absolute}}:{{caret_position}}

# New Note
# prompt modal for note title
echo "" >> {{!_noteTitle}}.md
open "obsidian://advanced-uri?vault=CiO&filepath={{!_noteTitle}}"

# New Note from Clipboard
# prompt modal for note title
echo {{clipboard}} >> {{!_noteTitle}}.md
open "obsidian://advanced-uri?vault=CiO&filepath={{!_noteTitle}}"

Results

Everything tested works as expected. Only issue found:

line-breaks(\n) do NOT get converted to actual line-breaks in the markdown

In the "New Note from Clipboard" command, with the Clipboard:

Shell Commands v0.14.0
Obsidian v0.15.9 (installer version: v0.15.9)
macOS Monterey 12.4 (21F79)

resulting markdown:

Shell Commands v0.14.0\nObsidian v0.15.9 (installer version: v0.15.9)\nmacOS Monterey 12.4 (21F79)\n
Taitava commented 2 years ago

Thank you for the report @gapmiss !

I didn't know about the newline bug, good that you brought it up! I created a new discussion for it: #250 . The nature of this bug feels like something that I can't be certain how to fix it "blindly", so I probably need to get my hands on a Mac myself so that I can try out possible fixes before I know "this fixes it". Luckily a friend of mine has just ordered a MacBook, I can ask if I can borrow it. Otherwise I can try to look up if there are online macOS testing platforms that allow installing custom software.


Edit 2022-12-03: Actually, my current understanding is that this is not a bug, and there doesn't seem to be anything to change in SC. The problem is that echo should be called with option -e to make it understand newlines. Read more: