Skip to content

willfarrell/alfred-debugger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

alfred-debugger

A little script to help you write your Alfred Workflows. In the case your script has an error, Alfred defautls to searching your query in a search engine. To catch these errors you can run them in Terminal, and see what the errors are quickly and easily.

Install

cp alfred /usr/local/bin/alfred
chmod +x /usr/local/bin/alfred

# Add `alias alfred=/usr/local/bin/alfred` to `~/.bashrc`
# or
# Add `/usr/local/bin` to `$PATH`, if you use homebrew it should already be there

Options

alfred [options] [-f] <file> [-q] <query>
alfred <file> <query>

  -f  --file     Filename of php file (ex 'script.php')
  -h  --help     Show help options (what you're viewing now)
  -q  --query    Value to replace {query} with
  -v  --version  Return version of script

Running

Just run alfred <file> <query>.

Sample

In Alfred create a Script Filter with the following code.

// PHP
$query = urlencode("{query}");
require("sample.php");

Right-click the workflow in Alfred, click Show in Finder. Create a new file sample.php that will be include by the code above.

<?php
// sample.php

//error_reporting(0); // uncomment to hide all errors
require_once('workflows.php');
$w = new Workflows();

if (!isset($query)) {
	$query = <<<EOD
{query}
EOD;
}

$w->result( 'debug', $query, "Your query was '$query'", '', 'icon.png', 'yes' );

echo $w->toxml();
?>

Open terminal to the open folder and run $ alfred -f sample.php -q helloworld. If all works ok you can be sure your Alfred Workflow will too. Go ahdea and try it out now, and have fun making new workflows.

About

A little script to help you write your Alfred Workflows.

Resources

License

Stars

Watchers

Forks

Packages

No packages published