void clean()

in include/poac/subcmd/cache.hpp [20:40]


        void clean(const std::vector<std::string>& argv) {
            namespace fs = boost::filesystem;
            if (argv.empty()) {
                // TODO: print help (on 0.6.0)
                std::cout << "Usage: poac cache clean <pkg-name> [-a | --all]" << std::endl;
            }
            else if (util::argparse::use(argv, "-a", "--all")) {
                fs::remove_all(io::file::path::poac_cache_dir);
            }
            else {
                for (const auto &v : argv) {
                    const fs::path pkg = io::file::path::poac_cache_dir / v;
                    if (io::file::path::validate_dir(pkg)) {
                        fs::remove_all(pkg);
                        std::cout << v << " is deleted" << std::endl;
                    } else {
                        std::cout << io::cli::red << v << " not found" << io::cli::reset << std::endl;
                    }
                }
            }
        }