Jump to content

Recommended Posts

Since I love Ruby's fast syntax and ease of use maybe as much as I love Alfred, I decided to give Alfred the power to interpret Ruby, inspired by Altre's Python Interpreter.

Ruby Interpreter also stores the last executed commands so you can re-use them and modify them later (set how much history you want to keep in Alfred Variables).





Download from Packal

Edited by dettogatto
Link to comment

Thanks for the cool tool. History seems to break right away when I try to use it though. Here is the error in debugger:

[2016-06-23 09:48:59][ERROR: input.scriptfilter] XML Parse Error 'The operation couldn’t be completed. (NSXMLParserErrorDomain error 65.)'. Row (null), Col (null): 'attributes construct error' in XML:
<?xml version="1.0"?>
	<item arg="" valid="NO" type="text">
	<subtitle>Write some valid code to execute it</subtitle>
	<subtitle mod="cmd">Write some valid code to execute it</subtitle>

		<item valid="NO" type="text" autocomplete=""asdaD".reverse">
		<subtitle>History item: enter to use</subtitle>
		<subtitle mod="cmd">History item: enter to use</subtitle>

Seems to be a parsing issue.

Link to comment
Right here: <item valid="NO" type="text" autocomplete=""asdaD".reverse">
There are quotation marks within the quotation marks.
It looks like the workflow doesn't use a real XML library, which it really should.
The header is also suboptimal: <?xml version="1.0"?>
Should be: <?xml version="1.0" encoding="utf-8"?>


Otherwise the workflow will die in flames when given non-ASCII input.
Link to comment

Thank you for the feedback! Being new with Alfred every input that makes me learn something new is welcome!

I didn't want to use XML libraries to avoid dependancies...

I just found out that I already fixed the history issue, but, having some problems with PackAl, I wasn't able to update to the latest version.

Try to update it now, everything should work, otherwise let me know!

Edited by dettogatto
Link to comment

I didn't want to use XML libraries to avoid dependancies...



Unfortunately, generating valid XML isn't as simple as it looks. If you don't use a library, it's very likely that you/your users are going to keep running into issues with invalid XML, like the one above.


Doesn't Ruby have an XML library built in? What about JSON? Alfred 3 understands JSON, too.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...