diff options
| author | Alexander Karatarakis <alex@karatarakis.com> | 2018-01-17 14:54:27 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-01-17 14:54:27 -0800 |
| commit | 8e773df065096fe81e3d888b6b844cbecfbc18e6 (patch) | |
| tree | c3c1a6f3ff9b039ba23c9a06e36b92955f26097c | |
| parent | 28c5c6ae4601c323cbd57a13da03b9047dc282ad (diff) | |
| parent | 0fde60e467ba756ddaaae389f1969a826268dc5d (diff) | |
| download | vcpkg-8e773df065096fe81e3d888b6b844cbecfbc18e6.tar.gz vcpkg-8e773df065096fe81e3d888b6b844cbecfbc18e6.zip | |
Merge pull request #2552 from ryanfitzsimon/master
Add output option to export
| -rw-r--r-- | toolsrc/src/vcpkg/export.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/toolsrc/src/vcpkg/export.cpp b/toolsrc/src/vcpkg/export.cpp index e3221a12f..d15df95d2 100644 --- a/toolsrc/src/vcpkg/export.cpp +++ b/toolsrc/src/vcpkg/export.cpp @@ -251,6 +251,8 @@ namespace vcpkg::Export bool zip; bool seven_zip; + Optional<std::string> maybe_output; + Optional<std::string> maybe_nuget_id; Optional<std::string> maybe_nuget_version; @@ -258,6 +260,7 @@ namespace vcpkg::Export std::vector<PackageSpec> specs; }; + static const std::string OPTION_OUTPUT = "--output"; static const std::string OPTION_DRY_RUN = "--dry-run"; static const std::string OPTION_RAW = "--raw"; static const std::string OPTION_NUGET = "--nuget"; @@ -280,8 +283,13 @@ namespace vcpkg::Export {OPTION_ZIP, "Export to a zip file"}, {OPTION_SEVEN_ZIP, "Export to a 7zip (.7z) file"}, }}; - static const std::array<CommandSetting, 7> EXPORT_SETTINGS = {{ - {OPTION_NUGET_ID, "Specify the id for the exported NuGet package"}, + + static const std::string EXPORT_SETTINGS_NUGET_ID_HELP_TEXT = + Strings::format("Specify the id for the exported NuGet package (overrides %s)", OPTION_OUTPUT); + + static const std::array<CommandSetting, 8> EXPORT_SETTINGS = {{ + {OPTION_OUTPUT, "Specify the output name (used to construct filename)"}, + {OPTION_NUGET_ID, EXPORT_SETTINGS_NUGET_ID_HELP_TEXT}, {OPTION_NUGET_VERSION, "Specify the version for the exported NuGet package"}, {OPTION_IFW_REPOSITORY_URL, "Specify the remote repository URL for the online installer"}, {OPTION_IFW_PACKAGES_DIR_PATH, "Specify the temporary directory path for the repacked packages"}, @@ -316,6 +324,8 @@ namespace vcpkg::Export ret.zip = options.switches.find(OPTION_ZIP) != options.switches.cend(); ret.seven_zip = options.switches.find(OPTION_SEVEN_ZIP) != options.switches.cend(); + ret.maybe_output = maybe_lookup(options.settings, OPTION_OUTPUT); + if (!ret.raw && !ret.nuget && !ret.ifw && !ret.zip && !ret.seven_zip && !ret.dry_run) { System::println(System::Color::error, @@ -520,7 +530,7 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console Checks::exit_success(VCPKG_LINE_INFO); } - std::string export_id = create_export_id(); + std::string export_id = opts.maybe_output.value_or(create_export_id()); if (opts.raw || opts.nuget || opts.zip || opts.seven_zip) { |
