Jump to content

create a cheat sheet for myself


fleaf5

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

 

 

Link to comment

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.

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

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

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