2017 © Pedro Peláez
 

library alfred-workflow-helper

Helper for building alfred workflows in PHP

image

dayjo/alfred-workflow-helper

Helper for building alfred workflows in PHP

  • Wednesday, February 28, 2018
  • by Dayjo
  • Repository
  • 1 Watchers
  • 1 Stars
  • 42 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 15 Versions
  • 0 % Grown

The README.md

Workflow Class

Specify list of commands i.e., (*1)

$Workflow = new AlfredWorkflow();
$Workflow->addCommand( new AlfredWorkflowCommand(
  [
    'prefix' => '*', // default (no extra command, i.e. "keyword myTask"
    'command' => TimeTracker@trackTime
  ]
) );
  1. User enters the workflow Keyword List of possible commands are output.

Example Uses;

<?php
spl_autoload_register(function ($class_name) {
    $class_name = str_replace("\\", DIRECTORY_SEPARATOR, $class_name);
    include  $class_name . '.php';
});

use Alfred\Workflow as Workflow;
use Alfred\Command as Command;
use Alfred\ItemList as ItemList;
use Alfred\Item as Item;

$Workflow = new Workflow();

$Workflow->addCommand(new Command(
  [
    'prefix' => '', // default (no extra command, i.e. "keyword myTask"
    'command' => function ($input) {
        $tasks = ['joel','dayjo'];

        $List = new ItemList;
        foreach ($tasks as $task) {
            if (stristr($task, $input)) {
                $List->add(new Item([
                    'title' => 'Start Tracking "' . $task. '"',
                    'arg' => 'start ' . $task,
                    'autocomplete' => $task])
                );
            }
        }

        echo $List->output();
    }
  ]
));

$Workflow->run();
<?php
spl_autoload_register(function ($class_name) {
    $class_name = str_replace("\\", DIRECTORY_SEPARATOR, $class_name);
    include  $class_name . '.php';
});
//
// spl_autoload_extensions(".php"); // comma-separated list
//     spl_autoload_register();

use Alfred\Workflow as Workflow;
use Alfred\Command as Command;
use Alfred\ItemList as ItemList;
use Alfred\Item as Item;

$Workflow = new Workflow();

$Workflow->addCommand(new Command(
  [
    'prefix' => 'start', // default (no extra command, i.e. "keyword myTask"
    'command' => function ($input) {
        echo "STARTING $input";
    }
  ]
));

$Workflow->run();

The Versions

28/02 2018

dev-development

dev-development

Helper for building alfred workflows in PHP

  Sources   Download

MIT

The Requires

 

by Joel Day

28/02 2018

dev-master

9999999-dev

Helper for building alfred workflows in PHP

  Sources   Download

MIT

The Requires

 

by Joel Day

28/02 2018

v0.3.1

0.3.1.0

Helper for building alfred workflows in PHP

  Sources   Download

MIT

The Requires

 

by Joel Day

17/01 2018

v0.3.0

0.3.0.0

Helper for building alfred workflows in PHP

  Sources   Download

MIT

The Requires

 

by Joel Day

17/01 2018

dev-release/v0.3.0

dev-release/v0.3.0

Helper for building alfred workflows in PHP

  Sources   Download

MIT

The Requires

 

by Joel Day

11/01 2018

v0.2.3

0.2.3.0

Helper for building alfred workflows in PHP

  Sources   Download

MIT

The Requires

 

by Joel Day

10/01 2018

v0.2.2

0.2.2.0

Helper for building alfred workflows in PHP

  Sources   Download

MIT

The Requires

 

by Joel Day

09/01 2018

v0.2.1

0.2.1.0

Helper for building alfred workflows in PHP

  Sources   Download

MIT

The Requires

 

by Joel Day

09/01 2018

v0.2.0

0.2.0.0

Helper for building alfred workflows in PHP

  Sources   Download

MIT

The Requires

 

by Joel Day

03/01 2018

dev-release/v0.2.0

dev-release/v0.2.0

Helper for building alfred workflows in PHP

  Sources   Download

MIT

by Joel Day

03/01 2018

v0.1.6

0.1.6.0

Helper for building alfred workflows in PHP

  Sources   Download

MIT

by Joel Day

02/10 2017

v0.1.5

0.1.5.0

Helper for building alfred workflows in PHP

  Sources   Download

MIT

by Joel Day

02/10 2017

v0.1.3

0.1.3.0

Helper for building alfred workflows in PHP

  Sources   Download

MIT

by Joel Day

02/10 2017

v0.1.4

0.1.4.0

Helper for building alfred workflows in PHP

  Sources   Download

MIT

by Joel Day

02/10 2017

v0.1.0

0.1.0.0

Helper for building alfred workflows in PHP

  Sources   Download

MIT

by Joel Day