Skip to content

Commit a5f154a

Browse files
committed
added following command:
- rm
1 parent 2add4d6 commit a5f154a

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

commandline/library/lSystem.php

+7
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ static function fileExists($file){
2424
return file_exists($file);
2525
}
2626

27+
/*
28+
* returns the if a file exists
29+
*/
30+
static function isFile($file){
31+
return is_file($file);
32+
}
33+
2734
/*
2835
* returns the if a file exists
2936
*/

commandline/programms/rm/init.php

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
function rmMain($args, $command){
3+
lCommand::write("> $command");
4+
if(count($args)==1){
5+
$file = lSystem::getPWD()."/".$args[0];
6+
if(lSystem::fileExists($file)){
7+
if(lSystem::isFile($file)){
8+
unlink($file);
9+
}else{
10+
lCommand::write("this is a directory and cannot be removed with this command");
11+
}
12+
}else{
13+
lCommand::write("this file does not exists");
14+
}
15+
}else{
16+
lCommand::write("to remove a file, call \"rm [file]\"");
17+
}
18+
}
19+
?>

0 commit comments

Comments
 (0)