Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Refs #4488 - Support supplying the minion task name as a positional a…

…rgument rather than --task=
  • Loading branch information...
commit 48b5299e998eadcbed5488e55d679c198565bd55 1 parent 0e326d5
Kiall Mac Innes authored March 30, 2012
3  classes/Kohana/Minion/CLI.php
@@ -67,7 +67,8 @@ public static function options($options = NULL)
67 67
 
68 68
 			if (substr($opt, 0, 2) !== '--')
69 69
 			{
70  
-				// This is not an option argument
  70
+				// This is a positional argument
  71
+				$values[] = $opt;
71 72
 				continue;
72 73
 			}
73 74
 
16  classes/Kohana/Minion/Task.php
@@ -59,12 +59,18 @@ public static function convert_class_to_task($class)
59 59
 	 */
60 60
 	public static function factory($options)
61 61
 	{
62  
-		$task = Arr::get($options, 'task');
63  
-		unset($options['task']);
64  
-
65  
-		// If we didn't get a valid task, generate the help
66  
-		if ( ! is_string($task))
  62
+		if (($task = Arr::get($options, 'task')) !== NULL)
  63
+		{
  64
+			unset($options['task']);
  65
+		}
  66
+		else if (($task = Arr::get($options, 0)) !== NULL)
  67
+		{
  68
+			// The first positional argument (aka 0) may be the task name
  69
+			unset($options[0]);
  70
+		}
  71
+		else
67 72
 		{
  73
+			// If we didn't get a valid task, generate the help
68 74
 			$task = 'help';
69 75
 		}
70 76
 

0 notes on commit 48b5299

Please sign in to comment.
Something went wrong with that request. Please try again.