Jump to content
fleaf5

create a cheat sheet for myself

Recommended Posts

Hi I think this should be a very simple task.

1. I have a folder: eg ~/manuals/ where I store all the different notes and manuals I write for my self. All the files ends with .man

2. I often need to check the contents of these files. eg. the usage of mask with python, etc

 

The workflow I want is like below:

1. I want to use the keyword ??, and run sth like "?? mask"

2. and then I want to run a command line: grep -A 4 mask ~/manuals/*.man

3. I want the result to be returned to alfred and shown in the window

 

However, I could not figure out the return part and never see the returned post notification.

Could anyone help me? Thanks very much!!!

 

 

Share this post


Link to post

Welcome @fleaf5,

 

How exactly (visually) are you envisioning this? Because you’re asking for multiple results to be returned, but each result will have five lines (grep -A 4). Since Alfred can only display one line per result (technically two if we include the subtitle) and lines have a finite length, I don’t see the results being too useful.

Share this post


Link to post
15 hours ago, vitor said:

Welcome @fleaf5,

 

How exactly (visually) are you envisioning this? Because you’re asking for multiple results to be returned, but each result will have five lines (grep -A 4). Since Alfred can only display one line per result (technically two if we include the subtitle) and lines have a finite length, I don’t see the results being too useful.

Hi Victor,

Thanks for the reply! Because I document all my manuals in the format with #mask: and then some tips. So if I do grep -A 4 \#mask usually only return one result with 5 lines of brief explanation.  So it should work. (if better, could it pass two argument like mask, 6 indicating the line number?

 

BTW, it will also be helpful to recommend other ways to check for my personal notes.

 

Best

Share this post


Link to post
5 minutes ago, fleaf5 said:

Because I document all my manuals in the format with #mask: and then some tips. So if I do grep -A 4 \#mask usually only return one result with 5 lines of brief explanation.  So it should work.

 

My question isn’t why you do it that way; I understand why.

 

My question is how you’re thinking that’ll work visually. Since Alfred results are limited to one line, and you want each search to output five lines, it means that each of your searches will take up five Alfred results (and be truncated if the lines are too long). That will definitely look weird and be inefficient — Alfred only shows nine results at a time, meaning that you won’t even see two full matches from your search at a time.

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