Add del alias for rm helper command
This commit is contained in:
@@ -84,7 +84,7 @@ class GitRepositoryRuntime(private val context: Context) {
|
||||
add("Native Git prototype:")
|
||||
add(" binary path: nativeLibraryDir/libgit.so")
|
||||
add(" selected ABI: ${Build.SUPPORTED_ABIS.firstOrNull() ?: "unknown"}")
|
||||
add(" helper commands: ls/dir, pwd, cat, touch, mkdir/md, cd.., rm, echo")
|
||||
add(" helper commands: ls/dir, pwd, cat, touch, mkdir/md, cd.., rm/del, echo")
|
||||
add(" visual editors: vi, nano, emacs, ed, ex")
|
||||
add(" git help <command>")
|
||||
}
|
||||
@@ -240,13 +240,13 @@ class GitRepositoryRuntime(private val context: Context) {
|
||||
}
|
||||
}
|
||||
}
|
||||
"rm" -> {
|
||||
"rm", "del" -> {
|
||||
val targets = tokens.drop(1)
|
||||
if (targets.isEmpty()) return currentRepo to listOf("usage: rm <path>")
|
||||
val errors = targets.mapNotNull { target ->
|
||||
val file = File(workingDir, target)
|
||||
if (!file.exists()) {
|
||||
"rm: $target: No such file or directory"
|
||||
"${tokens.first()}: $target: No such file or directory"
|
||||
} else {
|
||||
file.deleteRecursively()
|
||||
null
|
||||
|
||||
Reference in New Issue
Block a user