Created
November 1, 2017 21:07
-
-
Save jkinkead/faac54c15b300d9adfdb56e70ff6ab69 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Arguments for an execution of 'rm'. Now with sorted flags! | |
data class RmOptions(val path: String, val force: Boolean, val recursive: Boolean) | |
val options: RmOptions = getOptions() | |
// (oops) | |
val (path, recursive, force) = options | |
val args = ArrayList<String>() | |
if (recursive) { | |
args.append("-r") | |
} | |
if (force) { | |
args.append("-f") | |
} | |
args.append(path) | |
// Remove using the system. | |
Process = ProcessBuilder(args).start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment