Skip to content

Commit

Permalink
ignoring some things for know
Browse files Browse the repository at this point in the history
the ignored things are printed
  • Loading branch information
burner committed Dec 18, 2020
1 parent 0de5776 commit ab3cc10
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
17 changes: 12 additions & 5 deletions testdata/source/dud/testdata/inlinetestdatagen.d
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,14 @@ PackageVersion toPackageVersion(JSONValue j, string prefix = "") @trusted {
PackageDep pd;
pd.name = key;
if(value.type == JSONType.string) {
pd.ver = value.get!string().parseVersionRange();
string s = value.get!string();
if(s.startsWith("v")) {
continue;
}
pd.ver = s.parseVersionRange();
ret.pkgDeps ~= pd;
} else {
writefln("%s %s", key, value.toString());
writefln("dep %s %s", key, value.toString());
}
}
} else if(deps.type != JSONType.null_) {
Expand All @@ -138,7 +142,7 @@ PackageVersion toPackageVersion(JSONValue j, string prefix = "") @trusted {
td.ver = value.get!string().parseVersionRange();
ret.toolDeps ~= td;
} else {
writefln("%s %s", key, value.toString());
writefln("tool %s %s", key, value.toString());
}
}
} else if(toolChain.type != JSONType.null_) {
Expand Down Expand Up @@ -257,7 +261,11 @@ Package toPackage(JSONValue jv) {
auto versions = jv.getNested(["versions"]);
if(versions.type == JSONType.array) {
foreach(JSONValue value; versions.arrayNoRef()) {
ret.versions ~= value.toPackageVersion("packageDescription");
try {
ret.versions ~= value.toPackageVersion("packageDescription");
} catch(Exception e) {
writeln(e.toString());
}
}
}
return ret;
Expand Down Expand Up @@ -403,5 +411,4 @@ unittest {
}
]`);
Package[string] pkgs = toPackages(jv);
writeln(pkgs);
}
13 changes: 11 additions & 2 deletions testdata/source/dud/testdata/main.d
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ import std.getopt;
import std.file : readText;

import dud.descriptiongetter.code;
import dud.testdata.inlinetestdatagen;

private struct Options {
bool getCodeDump;
string outFilename;
string inFilename;
string dOutFilename;
}

version(App):
Expand All @@ -23,8 +25,10 @@ void main(string[] args) {
"o|outFilename", "The filename of the output of the trimed dump",
&options.outFilename,
"i|inFilename", "In filename to a code.dlang.org dump.json file",
&options.inFilename
);
&options.inFilename,
"d|dOutFilename", "The filename of the file to write a D source file "
~ "repesentation of the inFilename too",
&options.dOutFilename);

if(helpWanted.helpWanted) {
defaultGetoptPrinter("CLI to handle the code.dlang.org api dump",
Expand All @@ -50,4 +54,9 @@ void main(string[] args) {
} else {
writeln(shorter.toPrettyString());
}

if(!options.dOutFilename.empty) {
//auto f = File(options.dOutFilename, "w");
writeln(toPackages(shorter));
}
}

0 comments on commit ab3cc10

Please sign in to comment.