diff --git a/source/dub/commandline.d b/source/dub/commandline.d index 519f384..5b1a208 100644 --- a/source/dub/commandline.d +++ b/source/dub/commandline.d @@ -770,7 +770,8 @@ "will be printed instead (by default, formatted for the current compiler).", "", "The --data=VALUE option can be specified multiple times to retrieve " - "several pieces of information at once. The data will be output in " + "several pieces of information at once. A comma-separated list is " + "also acceptable (ex: --data=dflags,libs). The data will be output in " "the same order requested on the command line.", "", "The accepted values for --data=VALUE are:", @@ -802,8 +803,9 @@ args.getopt("data", &m_data, [ "Just list the values of a particular build setting, either for this "~ - "package alone or recursively including all dependencies. See "~ - "above for more details and accepted possibilities for VALUE." + "package alone or recursively including all dependencies. Accepts a "~ + "comma-separated list. See above for more details and accepted "~ + "possibilities for VALUE." ]); args.getopt("data-list", &m_dataList, [ diff --git a/source/dub/dub.d b/source/dub/dub.d index 1280a26..f3b5848 100644 --- a/source/dub/dub.d +++ b/source/dub/dub.d @@ -444,8 +444,17 @@ { import std.stdio; import std.ascii : newline; + + // Split comma-separated lists + string[] requestedDataSplit = + requestedData + .map!(a => a.splitter(",").map!strip) + .joiner() + .array(); + + auto data = m_project.listBuildSettings(platform, config, buildType, + requestedDataSplit, formattingCompiler, nullDelim); - auto data = m_project.listBuildSettings(platform, config, buildType, requestedData, formattingCompiler, nullDelim); write( data.joiner(nullDelim? "\0" : newline) ); if(!nullDelim) writeln(); diff --git a/test/4-describe-data-dmd.sh b/test/4-describe-data-dmd.sh index 5806fcd..849ee35 100755 --- a/test/4-describe-data-dmd.sh +++ b/test/4-describe-data-dmd.sh @@ -14,10 +14,8 @@ if ! $DUB describe --compiler=dmd \ --data=main-source-file \ - --data=dflags \ - --data=lflags \ - --data=libs \ - --data=lib-files \ + --data=dflags,lflags \ + --data=libs,lib-files \ --data=source-files \ --data=versions \ --data=debug-versions \ diff --git a/test/4-describe-data-list.sh b/test/4-describe-data-list.sh index d82cef1..4d76d64 100755 --- a/test/4-describe-data-list.sh +++ b/test/4-describe-data-list.sh @@ -13,19 +13,13 @@ trap cleanup EXIT if ! $DUB describe --compiler=$COMPILER --data-list \ - --data=target-type \ - --data=target-path \ - --data=target-name \ - --data=working-directory \ + '--data= target-type , target-path , target-name ' \ + '--data= working-directory ' \ --data=main-source-file \ - --data=dflags \ - --data=lflags \ - --data=libs \ - --data=lib-files \ - --data=source-files \ - --data=copy-files \ - --data=versions \ - --data=debug-versions \ + '--data=dflags,lflags' \ + '--data=libs, lib-files' \ + '--data=source-files, copy-files' \ + '--data=versions, debug-versions' \ --data=import-paths \ --data=string-import-paths \ --data=import-files \ @@ -34,8 +28,7 @@ --data=post-generate-commands \ --data=pre-build-commands \ --data=post-build-commands \ - --data=requirements \ - --data=options \ + '--data=requirements, options' \ > "$temp_file"; then die 'Printing project data failed!' fi