Still working on it...

This commit is contained in:
Ad5001 2016-09-23 21:52:41 +03:00
parent 76d4e60d53
commit d54dc7c799
3 changed files with 116 additions and 91 deletions

View file

@ -4,6 +4,12 @@ author: Ad5001
version: 1.0
api: [2.0.0]
main: Ad5001\Gitable\Main
commands: []
permissions: []
commands:
git:
description: "Main Gitable command"
usage: "/git <command> <parameters>"
permission: git.command.git
permissions:
git.command.git:
default: op
...

View file

@ -16,6 +16,9 @@ use pocketmine\event\Listener;
use pocketmine\plugin\PluginBase;
use pocketmine\utils\TextFormat as C;
use pocketmine\Server;
@ -31,6 +34,8 @@ use pocketmine\Player;
class Main extends PluginBase implements Listener {
protected $git;
const PREFIX = C::BLACK . "[" . C::LIGHT_GRAY . "Git" . C::BLACK . "] " . C::LIGHT_GRAY;
public function onEnable() {
@ -58,17 +63,16 @@ class Main extends PluginBase implements Listener {
case 'git':
if(count($args) >= 1) {
if(count($args) >= 2) {
if(isset(self::COMMANDS[$args[0]])) {
$cmd = $args[0];
unset($args[0]);
$sender->sendMessage($this->git->{self::COMMANDS[$cmd][0]}(implode(" ", $args)));
switch($args[0]) {
case "cd":
$this->git->cd($args[1]);
$sender->sendMessage("New path: " . $this->git->getDir());
break;
}
return true;
}

View file

@ -68,35 +68,50 @@ class Windows extends GitClient {
public function cd($path) : string {
return shell_exec("cd " . $path);
if(is_dir($path)) {
$dir = chdir($path);
$this->dir = getcwd();
return (string) $dir;
} else {
return "Directory $path not found !";
}
}
public function clone($from) : string {}
public function clone($from) : string {
}
public function log() : string {}
public function log() : string {
}
public function remove($path) : string {}
public function remove($path) : string {
}
public function move($path, $newpath) : string {}
public function move($path, $newpath) : string {
}
public function add($path) : string {}
public function add($path) : string {
}
public function diff($path) : string {}
public function diff($path) : string {
}
public function status($path) : string {}
public function status($path) : string {
}
public function remote($name, $url) : string {}
public function remote($name, $url) : string {
}
public function pull($to = "github", $from = "master") : string {}
public function pull($to = "github", $from = "master") : string {
}