Giter Site home page Giter Site logo

alfred-cheat.sh's Introduction

alfred-cheat.sh's People

Contributors

chrisgrieser avatar gohoyer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

alfred-cheat.sh's Issues

Parse error for some commands

for some cases, there is an error preventing output, e.g. for grep

[17:12:05.120] Cheat.sh[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.106A141A-3913-414E-B430-2E558AB69A17%3E7F66BB95-7AC3-4BF1-A8DD-14B8ADEEB77C)] Queuing argument '(null)'
[17:12:05.214] Cheat.sh[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.106A141A-3913-414E-B430-2E558AB69A17%3E7F66BB95-7AC3-4BF1-A8DD-14B8ADEEB77C)] Script with argv '(null)' finished
[17:12:05.217] Cheat.sh[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.106A141A-3913-414E-B430-2E558AB69A17%3E7F66BB95-7AC3-4BF1-A8DD-14B8ADEEB77C)] { "items": [ { "uid": "2to3", "title": "2to3", "arg": "2to3", "autocomplete": "2to3" }, { "uid": "7z", "title": "7z", "arg": "7z", "autocomplete": "7z" }, { "uid": "7za", "title": "7za", "arg": "7za", "autocomplete": "7za" }, { "uid": "7zr", "title": "7zr", "arg": "7zr", "autocomplete": "7zr" }, { "uid": "Bash-Snippets", "title": "Bash-Snippets", "arg": "Bash-Snippets", "autocomplete": "Bash-Snippets" } [truncated]
[17:12:07.804] Cheat.sh[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.106A141A-3913-414E-B430-2E558AB69A17%3E7F66BB95-7AC3-4BF1-A8DD-14B8ADEEB77C)] Processing complete
[17:12:07.806] Cheat.sh[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.106A141A-3913-414E-B430-2E558AB69A17%3E7F66BB95-7AC3-4BF1-A8DD-14B8ADEEB77C)] Passing output 'grep' to [Conditional](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.106A141A-3913-414E-B430-2E558AB69A17%3E197108F9-9FD4-4644-A545-9D7927FDFE2F)
[17:12:07.807] Cheat.sh[[Conditional](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.106A141A-3913-414E-B430-2E558AB69A17%3E197108F9-9FD4-4644-A545-9D7927FDFE2F)] Processing complete
[17:12:07.808] Cheat.sh[[Conditional](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.106A141A-3913-414E-B430-2E558AB69A17%3E197108F9-9FD4-4644-A545-9D7927FDFE2F)] Passing output 'grep' to [Arg and Vars](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.106A141A-3913-414E-B430-2E558AB69A17%3E6F8A780A-1AC2-4106-8E25-A9178B3B7DD2)
[17:12:07.808] Cheat.sh[[Arg and Vars](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.106A141A-3913-414E-B430-2E558AB69A17%3E6F8A780A-1AC2-4106-8E25-A9178B3B7DD2)] Processing complete
[17:12:07.809] Cheat.sh[[Arg and Vars](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.106A141A-3913-414E-B430-2E558AB69A17%3E6F8A780A-1AC2-4106-8E25-A9178B3B7DD2)] Passing output '' to [Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.106A141A-3913-414E-B430-2E558AB69A17%3EFD01CC80-8A50-48E9-A263-8BD198C61CD4)
[17:12:07.837] Cheat.sh[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.106A141A-3913-414E-B430-2E558AB69A17%3EFD01CC80-8A50-48E9-A263-8BD198C61CD4)] Queuing argument '(null)'
[17:12:07.997] Cheat.sh[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.106A141A-3913-414E-B430-2E558AB69A17%3EFD01CC80-8A50-48E9-A263-8BD198C61CD4)] Script with argv '(null)' finished
[17:12:08.014] STDERR: Cheat.sh[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.106A141A-3913-414E-B430-2E558AB69A17%3EFD01CC80-8A50-48E9-A263-8BD198C61CD4)] parse error: Invalid escape at line 1, column 1275

error while updating: bad substitution

Even with the Fix for jq (#2), the update function still does not work properly, leaving the available_commands file empty. However, I am not really certain what causes it? ๐Ÿค”

I get the following error in the debugging log:

[00:52:46.167] Cheat.sh[List Filter] Processing complete
[00:52:46.167] Cheat.sh[List Filter] Passing output 'update' to Arg and Vars
[00:52:46.168] Cheat.sh[Arg and Vars] Processing complete
[00:52:46.168] Cheat.sh[Arg and Vars] Passing output '' to Conditional
[00:52:46.169] Cheat.sh[Conditional] Processing complete
[00:52:46.169] Cheat.sh[Conditional] Passing output '' to Large Type
[00:52:46.171] Cheat.sh[Conditional] Passing output '' to Run Script
[00:52:46.397] ERROR: Cheat.sh[Run Script] /Users/chrisgrieser/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/1E83FEBD-A43F-46BE-9111-654BF5971C58:43: bad substitution
[00:52:46.404] Cheat.sh[Run Script] Processing complete

Covering other jq locations

thanks for the nice workflow!

I tried using it, however I got an error with jq. You can fix that by adding the following line at the top:

export PATH=/usr/local/bin/:/opt/homebrew/bin/:$PATH

on M1 Macs, HomeBrew installs jq at /opt/homebrew/bin/, and adding that to the PATH ensures that you can use jq like in the shell, without worrying where a user has installed it.

#!/bin/zsh
export PATH=/usr/local/bin/:/opt/homebrew/bin/:$PATH

{{...}}

json_array=$(printf '%s
' "${cheat_list[@]}" | grep -v ":\|/" | jq -R . | jq -s .)

# Format the output as Script Filter Json Format
# shellcheck disable=SC2016
jq -n --argjson item "$json_array" -f <(echo '{"items":[$item[] as $name | {"uid":$name,"title":$name,"arg":$name,"autocomplete":$name}]}')

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.