Replies: 15 comments 37 replies
-
|
Beta Was this translation helpful? Give feedback.
-
Just to let you know that I am deeply thinking about #17 and #16. I'm gonna bring some ideas for us to talk about. I wish you a fantastic Saturday :) |
Beta Was this translation helpful? Give feedback.
-
Thanks, have a nice day too! |
Beta Was this translation helpful? Give feedback.
-
I can't remember everything from the past discussions, and I'm in a bit of hurry to read all, but this output thing has been on my mind in the past few days, and now that it's also requested in #48, I feel that it's time to actually implement some of these ideas. However, there are some bugs that need to be dealt with first. After fixing the bugs I'll start to implement at least this:
I'll try to implement it so that it's easy to later continue development with other ideas mentioned in this discussion. I'll edit #34 when I'll start this implementation, so it will contain details of what actually will be implemented in the first phase. |
Beta Was this translation helpful? Give feedback.
-
I recently registered an issue on this feature request, without seeing this discussion (shame on me!). Either way, I have some thoughts on usecases and stuff, so I'll just past it here as well: It would be very useful if one could launch an external program, and take the output from that program and enter it into the current note at the cursor. Example: Write a phone number, select it, call the external program which looks up the phone number in a database, sends back formatted name, address, phone and so on on StdOut, which then replace the selected text. It would also be great for writing "generators", where you use a GUI to enter information, do some stuff with that information, and then inserts it neatly formatted into the note. |
Beta Was this translation helpful? Give feedback.
-
It can happen to all of us! 🙂 And I'm not even sure if the Discussions section is meantioned in README.md. Maybe I should check and put it there if it's not there.
External GUIs/generators is a nice usage example. A user could create tool programs using whatever language/framework they want, and invoke it from Obsidian and get the output back to Obsidian. 👍 |
Beta Was this translation helpful? Give feedback.
-
This is the first thing ever inserted by Shell commands into caret position in current, active file. It's Windows' The file was originally empty, so next I'll test how it inserts in between text, and how replacing a selection works. |
Beta Was this translation helpful? Give feedback.
-
Hi @Troberg and @FelipeRearden ! I'd like to know your thoughts about what would you like to have as a default way to handle output (stdout), for those commands where a user does not explicitly define an output method? What would suit your use-cases the best? This default option will be applied to all your existing shell commands when you upgrade to Options:
This question concerns only the default value, so I left out the Current file, caret position option, as it would not make sense as a default. |
Beta Was this translation helpful? Give feedback.
-
Just for the record in between this long discussion: These are now implemented in Part 1 (#34) and released in
|
Beta Was this translation helpful? Give feedback.
-
Finally back home and able to test. Works beautifully, thanks! One more request on this one, and to be honest, I don't know if it's doable, and it's not very important, but still useful: It would be nice if StdOut is added to the document on the fly, not waiting until the shelled program exits. That would allow programs which can remain open and insert text as needed, for example a "text soundboard" (a program which inserts standard texts at the push of a button), or when triggered by external events. |
Beta Was this translation helpful? Give feedback.
-
It's time for part 2: #68 |
Beta Was this translation helpful? Give feedback.
-
About the option to apply linebreaks for the following:
Well, first of all, caret position output channel is already implemented, but it does not have the linebreak option. That's purely because I did not read @FelipeRearden's proposal accurately at the first time (sorry!), I only noticed the linebreak options for the top/bottom features. Secondly, I'm planning to postpone this linebreak setting, due to UI reasons. I still need to think carefully how I will add output channel specific settings to the UI:
I'm thinking about creating a new modal for these settings, that would be opened from the current extra options modal: This new modal is still just an idea, which may change. |
Beta Was this translation helpful? Give feedback.
-
These are now released. (Just for the record here too). |
Beta Was this translation helpful? Give feedback.
-
Currently, when outputting to status bar, if the output text is empty, and the status bar contains text from an old shell command execution, the old text will not be removed from the status bar, because empty output text is considered to be kind of "no output at all, so do nothing" thing. I think I should change this so that the status bar will be emptied if the newest output is empty. And of course emptying the status bar only means emptying the part of status bar that is controlled by SC, all other status bar content (e.g. word count) will stay intact. |
Beta Was this translation helpful? Give feedback.
-
I added a new idea to the list:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, most of the time any output text that shell commands might produce are just ignored, and not shown anywhere. The only exception to this is if a shell command fails to execute. Then the error message is shown for 20 seconds on the upper right corner. (The time is configurable in the plugin's settings).
Commands that produce useful output
There might be some beneficial use cases for regular output when a command executes successfully. For example:
ls
(Linux command) /dir
(Windows command).ls Folder
(Linux command) /cd Folder & dir
(Windows command).ls MyNote.md
(Linux command). Outputs the file name if the file exists, or nothing if it does not exist. Could be finetuned to get a better understandable output: File exists / File does not exist.ls {{date:YYYY-MM-DD}}
(Linux command). Outputs the folder name if the file/folder exists, or nothing if it does not exist. Could be finetuned too.git status
(Linux/Mac/Windows, if Git is installed). List files that are modified or deleted after the last Git commit, and files that are new (= files that are not stored in the Git repository).There could be a lot more examples.
Different ways to use the output text
One reason why Shell commands does not yet have a possibility to get the output text is that I haven't been able to figure out all the possible forms how a user might want to receive the output. It's not enough to display the output on a balloon in the top right corner for a limited amount of time. There needs to be options.
Ideas so far (these could be called channels or something).
Customisable for each command
Not a single way to handle outputs suit all commands. Some commands are used very often, in which case the UI should not require the user to click or hit a key to close an output modal. Some commands produce more output than others. Therefore, it's beneficial that the user can configure a different channel for each command.
How to treat errors?
Would there be any case where the user would want possible error messages to be part of other output text?
I need to think about this still. If there is a use case for this, I could offer the user two toggleable options:Direct possible error messages into the same channel that was chosen for normal output.Show possible error messages in a balloon at the top right corner (normal behavior).These two can be on at the same time: then errors can be shown both in a balloon and in another channel at the same time.Both of them can also be off at the same time: errors will be always ignored.
Edit 2021-10-07: The way I implemented error handling is quite different from my original thoughts. In short, the output channel for stderr can be chosen separately from the stdout channel. The same set of channels is available to stderr and stdout.
Beta Was this translation helpful? Give feedback.
All reactions