Browse Source

Clean up sdist-create output

default_compile_flags
vector-of-bool 3 years ago
parent
commit
c960646256
2 changed files with 17 additions and 8 deletions
  1. +17
    -7
      src/dds/cli/cmd/sdist_create.cpp
  2. +0
    -1
      src/dds/sdist/dist.cpp

+ 17
- 7
src/dds/cli/cmd/sdist_create.cpp View File



#include <boost/leaf/common.hpp> #include <boost/leaf/common.hpp>
#include <boost/leaf/handle_exception.hpp> #include <boost/leaf/handle_exception.hpp>
#include <fansi/styled.hpp>
#include <fmt/core.h> #include <fmt/core.h>


using namespace fansi::literals;

namespace dds::cli::cmd { namespace dds::cli::cmd {


int sdist_create(const options& opts) { int sdist_create(const options& opts) {
auto default_filename = fmt::format("{}.tar.gz", pkg_man.id.to_string()); auto default_filename = fmt::format("{}.tar.gz", pkg_man.id.to_string());
auto filepath = opts.out_path.value_or(fs::current_path() / default_filename); auto filepath = opts.out_path.value_or(fs::current_path() / default_filename);
create_sdist_targz(filepath, params); create_sdist_targz(filepath, params);
dds_log(info,
"Created source dirtribution archive: .bold.cyan[{}]"_styled,
filepath.string());
return 0; return 0;
}, },
[&](boost::leaf::bad_result, e_missing_file missing, e_human_message msg) { [&](boost::leaf::bad_result, e_missing_file missing, e_human_message msg) {
dds_log(error,
"A required file is missing for creating a source distribution for [{}]",
params.project_dir.string());
dds_log(error, "Error: {}", msg.value);
dds_log(error, "Missing file: {}", missing.path.string());
dds_log(
error,
"A required file is missing for creating a source distribution for [.bold.yellow[{}]]"_styled,
params.project_dir.string());
dds_log(error, "Error: .bold.yellow[{}]"_styled, msg.value);
dds_log(error, "Missing file: .bold.red[{}]"_styled, missing.path.string());
write_error_marker("no-package-json5"); write_error_marker("no-package-json5");
return 1; return 1;
}, },
[&](std::error_code ec, e_human_message msg, boost::leaf::e_file_name file) { [&](std::error_code ec, e_human_message msg, boost::leaf::e_file_name file) {
dds_log(error, "Error: {}", msg.value);
dds_log(error, "Failed to access file [{}]: {}", file.value, ec.message());
dds_log(error, "Error: .bold.red[{}]"_styled, msg.value);
dds_log(error,
"Failed to access file [.bold.red[{}]]: .br.yellow[{}]",
file.value,
ec.message());
write_error_marker("failed-package-json5-scan"); write_error_marker("failed-package-json5-scan");
return 1; return 1;
}); });

+ 0
- 1
src/dds/sdist/dist.cpp View File



auto pkg_man = package_manifest::load_from_file(*man_path); auto pkg_man = package_manifest::load_from_file(*man_path);
sdist_export_file(out, params.project_dir, *man_path); sdist_export_file(out, params.project_dir, *man_path);
dds_log(info, "Generated export as {}", pkg_man.id.to_string());
return sdist::from_directory(out); return sdist::from_directory(out);
} }



Loading…
Cancel
Save