void exec_new()

in include/poac/subcmd/new.hpp [37:56]


        void exec_new(const std::string& dirname) {
            namespace exception = core::exception;
            namespace fs = boost::filesystem;
            namespace path = io::file::path;
            namespace ftmpl = util::ftemplate;
            namespace naming = core::naming;

            naming::validate_package_name(dirname);
            fs::create_directories(dirname);
            std::ofstream ofs;
            std::map<fs::path, std::string> file{
                {".gitignore", ftmpl::_gitignore},
                {"main.cpp",   ftmpl::main_cpp},
                {"poac.yml",   ftmpl::poac_yml(dirname)},
                {"README.md",  ftmpl::README_md(dirname)}
            };
            for (const auto& [name, text] : file)
                path::write_to_file(ofs, (fs::path(dirname) / name).string(), text);
            echo_info(dirname);
        }