Jump to content
Terminal

Alfred-Man - Man Pages Search, View (Terminal, PDF, HTML)

Recommended Posts

Alfred-Man

This workflow was inspired by Unix man page workflow

A Unix man page search workflow that supports opening it with the default application (Terminal.app, iTerm2.app), Generating a PDF or HTML and opening them with your default application. PDF and HTML files are generated once when you request them, and then are updated if you open them and their timestamp is 30 day or older.

 

Features

  • Fast
  • PDF, Terminal, HTML Support
  • Auto Update, Thanks deanishe

image.thumb.png.a872d659052e2ee3735a604f1d515bc9.png

Usage

  1. Keyword: ;man
  2. Enter defaults to opening in terminal
  3. CMD + Enter opens as PDF
  4. Option + Enter opens as HTML

 

Updates

 

Version 1.2.1

 - Resolved a issue where random symbols weren't stripped from the description. Thanks @gingerbeardman for reporting this issue.

 

Version 1.2.0

 - Moved pdf/html storage to the workflow cache directory

 

Download

Github Repo 

 

Direct Download

Notes

PDF and HTML file update mechanisms may be revisited to determine a better solution. Right now, they are generated and then kept in the workflow directory. Perhaps they should use the cache directory.

 

Looking to add searching just as Unix man workflow. Such as section specific searches.

 

Edited by Terminal

Share this post


Link to post
On 1/12/2020 at 4:23 AM, Terminal said:

Right now, they are generated and then kept in the workflow directory. Perhaps they should use the cache directory.

 

The definitely should. You could also make a case for having them in the Workflow’s Data directory (though I’d consider the Cache more appropriate), but the Workflow’s directory is the wrong place as it will sync with the Workflow, taking up more space in the user’s sync solution and getting overwritten when upgrading the Workflow.

Share this post


Link to post
5 minutes ago, vitor said:

 

The definitely should. You could also make a case for having them in the Workflow’s Data directory (though I’d consider the Cache more appropriate), but the Workflow’s directory is the wrong place as it will sync with the Workflow, taking up more space in the user’s sync solution and getting overwritten when upgrading the Workflow.


you are completely correct. I’ll have to see if awgo supports retrieving the cache directory. Else I’ll need to figure out a way. 

Share this post


Link to post
Just now, Terminal said:

I’ll have to see if awgo supports retrieving the cache directory.

 

I would bet a body part that it does. @deanishe cares about correctness and that’s too important a detail to leave out.

Share this post


Link to post
35 minutes ago, vitor said:

 

I would bet a body part that it does. @deanishe cares about correctness and that’s too important a detail to leave out.


sure does have that function.  Working on a update now. Along with a few that fixes. 

Share this post


Link to post

I've just switched to this workflow from the one you were inspired by. So far working great, thanks!

 

What annoyed me about the old workflow was that every so often it would reindex, and of course you only notice those several seconds when you are in a hurry to look something up and it takes me out of my work zone.

 

I wonder if it's possible to present the Man page in a Quicklook panel? I usually go with the Terminal approach, but it's not ideal in that it often clutters up my terminal session. I don't like HTML and PDF for similar reasons, and moreso because their apps are even slower to open than Terminal.

Edited by gingerbeardman

Share this post


Link to post

Some command have strange output obscuring their description, see. automation_trampoline(8)

 

I also dislike the icon, it's too busy. But I'll just paste over my own choice.

 

Screen shot 2020-01-15 at 21.20.45.png

Edited by gingerbeardman

Share this post


Link to post
20 minutes ago, gingerbeardman said:

I've just switched to this workflow from the one you were inspired by. So far working great, thanks!

 

What annoyed me about the old workflow was that every so often it would reindex, and of course you only notice those several seconds when you are in a hurry to look something up and it takes me out of my work zone.

 

I wonder if it's possible to present the Man page in a Quicklook panel? I usually go with the Terminal approach, but it's not ideal in that it often clutters up my terminal session. I don't like HTML and PDF for similar reasons, and moreso because their apps are even slower to open than Terminal.

 

18 minutes ago, gingerbeardman said:

Some command have strange output obscuring their description, see. automation_trampoline(8)

 

I also dislike the icon, it's too busy. But I'll just paste over my own choice.

 

Screen shot 2020-01-15 at 21.20.45.png

 

9 minutes ago, gingerbeardman said:

Here's the icon I am using, I claim no ownership.

 

 

man.png


This is all very valuable feedback. Expect update to resolve these issues within a day. Thankfully, this workflow will auto update!

 

As for your quick look question, that’s an idea. I’ll research it and see if I can get it working !

Share this post


Link to post
13 minutes ago, gingerbeardman said:

I wonder if it's possible to present the Man page in a Quicklook panel?

 

That would require a Quicklook plugin that handles troff (the format man pages are written in).

 

The only realistic alternative, AFAIK, is for the workflow to start an HTTP server that generates the HTML versions on demand.

Share this post


Link to post
6 minutes ago, deanishe said:

 

That would require a Quicklook plugin that handles troff (the format man pages are written in).

 

The only realistic alternative, AFAIK, is for the workflow to start an HTTP server that generates the HTML versions on demand.


Currently I do generate a html file and then it’s cached for 30 days. I could make the cache time configurable, but it is already able to build on demand the. Open in a default browser. 
 

hmmm solutions solutions. 

Share this post


Link to post
2 minutes ago, Terminal said:

Currently I do generate a html file and then it’s cached for 30 days.

 

The problem is that the Quicklook feature relies on the quicklookurl or arg field of each feedback item (i.e. Alfred doesn't call your code again to get the Quicklook version). So you either need to generate the HTML versions in advance before returning the results, or point quicklookurl at a local webserver that can generate them on demand (or load a cached version).

 

I used the webserver approach to generate previews of events in my Google Calendar workflow. If you decide to go that route, you might be able to crib something useful from that workflow. The preview server shuts itself down after 60s without a request.

Share this post


Link to post
1 hour ago, deanishe said:

 

The problem is that the Quicklook feature relies on the quicklookurl or arg field of each feedback item (i.e. Alfred doesn't call your code again to get the Quicklook version). So you either need to generate the HTML versions in advance before returning the results, or point quicklookurl at a local webserver that can generate them on demand (or load a cached version).

 

I used the webserver approach to generate previews of events in my Google Calendar workflow. If you decide to go that route, you might be able to crib something useful from that workflow. The preview server shuts itself down after 60s without a request.


Ah I was misunderstanding you. I’ll have a look! Thanks!

Share this post


Link to post
4 hours ago, gingerbeardman said:

Some command have strange output obscuring their description, see. automation_trampoline(8)

 

I also dislike the icon, it's too busy. But I'll just paste over my own choice.

 

Screen shot 2020-01-15 at 21.20.45.png

 

 

Funny thing is that is shows up with a man command. So it wasn't the workflow it's self. Anyway, using a regex pattern that strings all random chars from the beginning and end of the descriptions. And since its caching, I didn't notice a noticeable impact on performance. You can either type man workflow:update to trigger the update and then man workflow:delcache to rebuild your cache, or just wait for them to trigger themselves.

 

 

man -k -P cat . | grep automation_trampoline


attach_automation_image(8), -(8) - ."====================== attach_automation_image attach and initialize disk images for automation_trampoline(8) ." ."
automation_trampoline(8), -(8) - ."====================== automation_trampoline runs automation on boot ." ." ." ."
makewhatis: /usr/lib/./libgutenprint.2.dylib: No such file or directory

 

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...