blinksh / blink

Blink Mobile Shell for iOS (Mosh based)
https://blink.sh
GNU General Public License v3.0
6.19k stars 578 forks source link

Feature Request: iOS Shortcuts #1023

Closed acminor closed 2 years ago

acminor commented 4 years ago

It would be nice to implement iOS shortcut functionality. This would (I assume) allow starting a connection without retyping or searching through history for the command.

I know because iOS restrictions, you probably cannot implement the running of shell scripts. So, this may be an alternative. Currently, I am using ed to create a file with the command which I can cat and retype or copy and paste if I cannot find the command with reverse-isearch.

cloin commented 4 years ago

a-shell does a nice job of this https://holzschu.github.io/a-Shell_iOS/

ariez-xyz commented 4 years ago

I would love a shortcut that takes a string and executes it as a command in Blink. I need to scp images a lot and that would really improve this workflow.

christippett commented 2 years ago

While native integration with Shortcuts would be nice, you can achieve similar functionality by calling Blink’s X-Callback-URL from within a Shortcut, e.g. blinkshell://run?key=<URLKey>&cmd=<URLEncodedCommand> (don’t forget to URL encode the command string).

I’m using exactly this method to send a wake-on-lan command to a device selected in an earlier Shortcuts step. Works great!

Send WoL

iilyak commented 2 years ago

@christippett Nice hack!!! Do you know any way to get output or status of the command?

iilyak commented 2 years ago

I am curious if there is a way to integrate a-Shell_iOS/ and blink. I want to use shortcuts to run script in a-shell which would prepare some files and then I want to trigger blink command to upload these files to the server. The reason is:

christippett commented 2 years ago

@christippett Nice hack!!! Do you know any way to get output or status of the command?

The built-in Open X-Callback URL action caters for that I'm pretty sure. I'm not using the output for anything in my example, but you can see there's an option to to parse a success or failed operation.

image

Open X-Callback URL

Performs the specified x-callback-url action. The x-success, x-cancel and x-error parameters will be added automatically. 
carloscabanero commented 2 years ago

As it has been mentioned already, although we do not have support for Shortcuts app, we do provide a X-Callback URL that becomes very handy. This plus piping can work on a few very cool scenarios, that I wanted to do a short video about. Here are some notes and additional tricks:

I'm going to move this to Discussions, as there are a lot of tips here.

As per the feature request itself, we will see what we can do to put this in the roadmap sooner, and make things easier through better Shortcuts hooks.