diff options
| author | Fuwn <[email protected]> | 2021-06-02 22:00:56 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-06-02 22:00:56 +0000 |
| commit | ad26693e9db220162cf446a99b7ec7a92ae94779 (patch) | |
| tree | 5305395657ffa97bd27cbbc32590353f349cb66c /src/cli.rs | |
| parent | refactor(cli): new subcommand matching format (diff) | |
| download | nitrous-ad26693e9db220162cf446a99b7ec7a92ae94779.tar.xz nitrous-ad26693e9db220162cf446a99b7ec7a92ae94779.zip | |
feat(cli): clean command
Diffstat (limited to 'src/cli.rs')
| -rw-r--r-- | src/cli.rs | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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") |