diff options
| author | Ryan Fitzsimon <ryanfitzsimon@outlook.com> | 2018-01-12 14:14:23 +1000 |
|---|---|---|
| committer | Ryan Fitzsimon <ryanfitzsimon@outlook.com> | 2018-01-12 14:14:23 +1000 |
| commit | c14f2b36e44526300f0ea7f828d09eefb77a3ad5 (patch) | |
| tree | d53ee9723ff187b89a9784492d378e55990aec79 | |
| parent | 6bdc3bf9eb5cc93e579cddcbb01c41e991082c8c (diff) | |
| download | vcpkg-c14f2b36e44526300f0ea7f828d09eefb77a3ad5.tar.gz vcpkg-c14f2b36e44526300f0ea7f828d09eefb77a3ad5.zip | |
Add output option to export
- The '--output=...' option allows the date/time string used in
exported filenames to be overridden
| -rw-r--r-- | toolsrc/src/vcpkg/export.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/toolsrc/src/vcpkg/export.cpp b/toolsrc/src/vcpkg/export.cpp index e3221a12f..66e6af5b6 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,9 @@ 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::array<CommandSetting, 8> EXPORT_SETTINGS = {{ + {OPTION_OUTPUT, "Specify the output name (used to construct filename)"}, + {OPTION_NUGET_ID, "Specify the id for the exported NuGet package (overrides " + OPTION_OUTPUT + ")"}, {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 +320,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 +526,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) { |
