Jump to content

View any text file in "View in Alfred"


Recommended Posts

The new file action "View in Alfred" is not offered for every text file. Example: In Finder go to /etc/apache2/httpd.conf and action it with Afred.

 

Likewise my own files, which I created with vim and do not have one of the usual suffixes or metadata to indicate a text file.

 

I built a workaround with a new file action workflow which runs

file -bI "$query"

to get the (guessed) mime-type of the file, e.g. text/plain; charset=us-ascii and match this string with regex ^text.* .

 

If successful, the file is offered to Alfred's Text View.

 

This works well so far, but perhaps my solution is unnecessary. In addition, this gives me an additional action in the already quite long selection list. Furthermore, I do not know what my workflow is supposed do if no text file is diagnosed by the file command.

 

I would definitely prefer "View in Alfred" to make more of an effort to recognize text files.

 

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...