GithubHelp home page GithubHelp logo

isometry / alfred-pipe Goto Github PK

View Code? Open in Web Editor NEW
30.0 3.0 1.0 37 KB

Alfred workflow to pass selected text or clipboard through arbitrary shell one-liners

License: MIT License

Python 98.90% Makefile 1.10%
pipe alfred workflow alfred-workflow clipboard oneliners

alfred-pipe's Introduction

pipe transformation workflow for Alfred

An Alfred workflow enabling easy transformation of the current contents of the clipboard by piping through arbitrary shell one-liners.

Requirements

Usage

Trigger the workflow by hotkey or keyword (default=|, override with the keyword variable) followed by an arbitrarily simple or complex shell one-liner to transform the contents of the clipboard in-place; optionally use the Cmd-modifier to immediately paste the results into the foreground app, or the Alt-modifier to show the results in large type.

Two hotkeys are configurable:

  • transform the current contents of the clipboard (like the keyword); recommended hotkey: Ctrl-Cmd-\
  • transform the current selection in the foreground app; recommended hotkey: Ctrl-Cmd-C

When triggered via hotkey, the leading keyword (e.g. |) is not required.

Examples

  • Transform to UPPERCASE: | perl -nle 'print uc' or | tr a-z A-Z
  • Base64 encode: | base64
  • Base64 decode: | base64 --decode
  • Top 10 unique lines with counts: | sort | uniq -c | sort -rn | head -10

Built-ins

A number of example pipelines (including those above) are built-in.

Built-ins can be disabled en-mass by setting the load_builtins variable to any value other than yes.

Aliases

To save repetitive typing, custom aliases can be defined with the following syntax:

| alias NAME=PIPE | LINE @@@

The trailing @@@ (override with the alias_terminator variable) terminates the alias definition and causes it to be saved.

Examples

  • | alias tac=sed '1!G;h;$!d' @@@
  • | alias top10=sort | uniq -c | sort -rn | head -10 @@@

Alias removal

Any custom alias can be removed with:

| alias NAME=@@@

Contributions & Thanks

  • ctwise

alfred-pipe's People

Contributors

isometry avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

Forkers

arbal

alfred-pipe's Issues

Typing "2 characters query" results in error

The images will explain the issue better.

CleanShot -  (Finder) - 28 April 2023 at 12 55 29

CleanShot -  (Finder) - 28 April 2023 at 12 55 40

CleanShot -  (Finder) - 28 April 2023 at 12 55 50

Pipe[Script Filter] Queuing argument 'ba'
[12:50:03.302] Pipe[Script Filter] Script with argv 'ba' finished
[12:50:03.307] ERROR: Pipe[Script Filter] Code 1: Traceback (most recent call last):
  File "/Users/XYZ/Alfred.alfredpreferences/workflows/user.workflow.FBDAEC5D-F9C3-4F35-826F-D389441A644A/pipe.py", line 150, in <module>
    print(complete())
          ^^^^^^^^^^
  File "/Users/XYZ/Alfred.alfredpreferences/workflows/user.workflow.FBDAEC5D-F9C3-4F35-826F-D389441A644A/pipe.py", line 146, in complete
    return alfred.xml(results, maxresults=max_results)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/XYZ/Alfred.alfredpreferences/workflows/user.workflow.FBDAEC5D-F9C3-4F35-826F-D389441A644A/alfred.py", line 65, in xml
    root.append(item.xml())
                ^^^^^^^^^^
  File "/Users/XYZ/Alfred.alfredpreferences/workflows/user.workflow.FBDAEC5D-F9C3-4F35-826F-D389441A644A/alfred.py", line 32, in xml
    SubElement(item, attribute, attributes).text = value
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: SubElement() argument 3 must be dict, not str

Python3 support for use on macOS 12.3+

As of macOS 12.3 Apple has removed python2.7 which this workflow is hardcoded to. Are there plans to migrate to python 3 or is this workflow abandoned?

cannot pass argument

TBH I am not sure why this isn't working for me. I enter "|" and all is good

screen shot 2018-11-11 at 04 13 41

but as soon as I want to add the pipe command it turns into a search

screen shot 2018-11-11 at 04 14 36

Given that the workflow expects an argument I am not sure what is going on

screen shot 2018-11-11 at 04 15 19

Any thoughts?
This is with Alfred 3.7

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.