Don't have a Github account yet, so I'll just push a few PHP commands I translated in Xitram keyword file basing on that template:
file_put_contents(file,data) =>
writef(file,data)
Code:
<?php
class writef implements keywords{
private $error = NULL; //We will store errors here
public function error(){ //This will be called when some error is found
return $this->error;
}
public function syntax($string){
if(empty($string)){
$this->error .= "Syntax error. \"writef\" requires additional arguments.";
return false;
}
return true;
}
public function run($string){
file_put_contents $string;
}
}
?>
mkdir(dirname, mode, 2 args I can't remember what they do) =>
newd(dirname,mode,arg3,arg4)
Code:
<?php
class newd implements keywords{
private $error = NULL; //We will store errors here
public function error(){ //This will be called when some error is found
return $this->error;
}
public function syntax($string){
if(empty($string)){
$this->error .= "Too few arguments for 'newd'.";
return false;
}
return true;
}
public function run($string){
mkdir $string;
}
}
?>
I've used two different error messages, I think the latter is the better one (the one for newd).
You shall probably use the same error style for all commands, of course, so choose well.
P.S: I know it's not much, I'll try for something more tomorrow.