Jump to content

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
Link to comment
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.

Link to comment
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. 

Link to comment

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
Link to comment
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 !

Link to comment
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.

Link to comment
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. 

Link to comment
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.

Link to comment
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!

Link to comment
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

 

Link to comment
  • 2 years later...

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