refactor
[m6w6/seekat] / examples / cli.php
diff --git a/examples/cli.php b/examples/cli.php
new file mode 100644 (file)
index 0000000..650ca85
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+
+require_once __DIR__."/../vendor/autoload.php";
+
+$api = new seekat\API([
+       "Authorization" => "token ".getenv("GITHUB_TOKEN")
+]);
+array_shift($argv);
+
+($self = function($api) use(&$self) {
+       global $argv;
+
+       while (null !== ($arg = array_shift($argv))) {
+               if ("." === $arg) {
+                       $api->then($self);
+                       return;
+               }
+               $api = $api->$arg;
+       }
+
+       echo $api, "\n";
+})($api);
+
+$api->send();