Giter Site home page Giter Site logo

alfred-cheat's Introduction

Alfred-cheat

Start writing your very own cheat sheets in your way and make them searchable using Alfred!

Demo

Every sheet shown in the demo should be your knowledge base and is totally customizable.

...loading demo gif

About & Acknowledgement

This project was initally inspired by cheat. I attempted to wrap around it but failed because that project wasn't intended to be wrapped around. So this project ended up a separate one. These two projects serve similar purpose in different working environments. With the help of alfred, your efficiency in searching your cheat sheets will be significantly boosted. And the better news is, you're in complete control of your cheat sheets unlike tldr (It's good though if you want it "just work").

I built this workflow because:

  1. I want faster searching than the original cheat because that project is commandline based. Sometimes I want a very quick view and don't wanna popup a shell.

  2. I want to build my own knowledge base instead of community-driven cheat sheets like tldr does.

Disclaimer:

All codes in directory workflow are dependencies from this project. They're not my work and is the only "dependency" for this project. Since it's included in this repo, the workflow user doesn't have to concern about dependencies.

Download via release

How it works

  1. You define a directory to store your cheat sheets, which are essentially text files. And name the file the command your wanna record. e.g, nmap, top, tar etc. (tips: you can start with the cheat sheets provided by cheat)

  2. You write your cheat sheet according to the rules (very intuitive and tolerant) bit by bit.

  3. Tell the workflow where that directory is and start searching.

Usage

First, you need to specify your sheet directory like this. Otherwise, it doesn't work. Both absolute or relative path will work.

Then, you're good to go.

  • To list all your cheat: cheat

  • To search and list the content of one of your cheat: cheat <sheet name>. Fuzzy search and autocomplete is supported.

  • To search in a specific sheet indexed by some keyword: cheat <sheet name> <keyword>.

  • To search across all your sheets for some keyword: cheat --search <keyword>

  • When you find your desired record and you wanna paste it directly to the app you're using (e.g., Terminal or iTerm2), hit Enter. This behavior can be changed in the Alfred setting (#3).

  • If you like to just copy, hit cmd-c.

Parsing rule

It's not even a rule... You just need to remember two things when writing your cheat sheet:

  1. Comment first, then the command.

  2. Separate each comment, command pair with 2 newlines. (one newline visually)

That's it.

e.g. this cheat sheet is called demosheet. Its content is the following:

# This is a one line comment. 
command one goes here.

# This is a second comment for the second command
# Yes we can have multiple line comment.
# But remember only the last line will be considered "command".
command two goes here

#
command three: in rare cases you don't have any comment, keep an empty # above.

# Any failed parsing will be ignored, like this line because it isn't associated with a command

or this line because it's a single line.

The above sheet will be parsed like this:

Compatibility

This workflow works out of the box (zero dependencies). It's tested on macOS 10.14.5 Mojave with Alfred 4. You need the powerpack to get it working. I believe it works with Alfred3 on any macOS after 10.10 Yosemite but that hasn't been tested. Report an issue if there's a problem.

Contribution

Any idea of improvement will be welcomed. But I don't wanna add the feature of modifying cheat sheet right in Alfred because it's what it supposed to do. Use vim or other editors you like.

alfred-cheat's People

Contributors

wayneyaoo avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.