... This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. ... If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. (.require [library [lux (.except) [abstract ["[0]" monad (.only do)]] [control [try (.only Try)] [concurrency ["[0]" async (.only Async)]]] [data [text ["%" \\format (.only format)]]] [world ["[0]" file (.only Path)] ["[0]" console (.only Console)]]]] ["[0]" /// [command (.only Command)] ["[1]" profile] ["[1][0]" action (.only Action)]]) (def (clean_files! fs root) (-> (file.System Async) Path (Async (Try Any))) (do [! ///action.monad] [_ (|> root (of fs directory_files) (of ! each (monad.each ! (of fs delete))) (of ! conjoint))] (in []))) (def .public success (-> ///.Target Text) (|>> (format "Successfully cleaned target directory: "))) (def .public (do! console fs profile) (-> (Console Async) (file.System Async) (Command Any)) (do [! async.monad] [.let [target (the ///.#target profile)] ? (of fs directory? target) _ (let [! ///action.monad] (if ? (loop (again [root target]) (do ! [_ (..clean_files! fs root) _ (|> root (of fs sub_directories) (of ! each (monad.each ! again)) (of ! conjoint))] (of fs delete root))) (of ! in [])))] (console.write_line (..success target) console)))