aboutsummaryrefslogtreecommitdiff
path: root/src/cli.rs
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-06-02 22:00:56 +0000
committerFuwn <[email protected]>2021-06-02 22:00:56 +0000
commitad26693e9db220162cf446a99b7ec7a92ae94779 (patch)
tree5305395657ffa97bd27cbbc32590353f349cb66c /src/cli.rs
parentrefactor(cli): new subcommand matching format (diff)
downloadnitrous-ad26693e9db220162cf446a99b7ec7a92ae94779.tar.xz
nitrous-ad26693e9db220162cf446a99b7ec7a92ae94779.zip
feat(cli): clean command
Diffstat (limited to 'src/cli.rs')
-rw-r--r--src/cli.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/cli.rs b/src/cli.rs
index 1dd4631..c89d6f2 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -81,6 +81,19 @@ impl Cli {
.unwrap_or("null"),
)
.await,
+ ("clean", _) => {
+ for dir in vec![".nitrous/check/", ".nitrous/"] {
+ let file_type = if dir.ends_with('/') {
+ "directory"
+ } else {
+ "file"
+ };
+ info!("cleaning {}: {}", file_type, dir);
+ if let Err(e) = std::fs::remove_dir_all(dir) {
+ warn!("cannot delete {}: {}: {}", file_type, dir, e);
+ }
+ }
+ },
_ => unreachable!(),
}
}
@@ -131,6 +144,8 @@ impl Cli {
.takes_value(true)
.index(2),
]),
+ SubCommand::with_name("clean")
+ .about("Delete Nitrous-generated files/ directories which are NOT critical."),
])
.arg(
Arg::with_name("debug")