Skip to content

Commit 3a510da

Browse files
committed
Move command line utils to package
Closes dnsjava#52
1 parent 089e796 commit 3a510da

File tree

6 files changed

+40
-0
lines changed

6 files changed

+40
-0
lines changed

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
{maven-resources},
105105
META-INF/LICENSE=LICENSE
106106
</Include-Resource>
107+
<Main-Class>org.xbill.DNS.tools.Tools</Main-Class>
107108
</instructions>
108109
</configuration>
109110
</plugin>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// SPDX-License-Identifier: BSD-2-Clause
2+
package org.xbill.DNS.tools;
3+
4+
public class Tools {
5+
public static void main(String[] args) throws Exception {
6+
if (args == null || args.length == 0) {
7+
System.out.println("Usage: <command> <options>");
8+
System.out.println(" Commands:");
9+
System.out.println(" dig");
10+
System.out.println(" jnamed");
11+
System.out.println(" lookup");
12+
System.out.println(" update");
13+
System.exit(1);
14+
return;
15+
}
16+
17+
String program = args[0];
18+
String[] programArgs = new String[args.length - 1];
19+
System.arraycopy(args, 1, programArgs, 0, args.length - 1);
20+
switch (program) {
21+
case "dig":
22+
dig.main(programArgs);
23+
break;
24+
case "jnamed":
25+
jnamed.main(programArgs);
26+
break;
27+
case "lookup":
28+
lookup.main(programArgs);
29+
break;
30+
case "update":
31+
update.main(programArgs);
32+
break;
33+
}
34+
}
35+
}

src/main/java/dig.java renamed to src/main/java/org/xbill/DNS/tools/dig.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Copyright (c) 1999-2004 Brian Wellington (bwelling@xbill.org)
2+
package org.xbill.DNS.tools;
23

34
import java.io.IOException;
45
import java.net.InetAddress;

src/main/java/jnamed.java renamed to src/main/java/org/xbill/DNS/tools/jnamed.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Copyright (c) 1999-2004 Brian Wellington (bwelling@xbill.org)
2+
package org.xbill.DNS.tools;
23

34
import java.io.BufferedReader;
45
import java.io.DataInputStream;

src/main/java/lookup.java renamed to src/main/java/org/xbill/DNS/tools/lookup.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Copyright (c) 1999-2004 Brian Wellington (bwelling@xbill.org)
2+
package org.xbill.DNS.tools;
23

34
import org.xbill.DNS.Lookup;
45
import org.xbill.DNS.Name;

src/main/java/update.java renamed to src/main/java/org/xbill/DNS/tools/update.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Copyright (c) 1999-2004 Brian Wellington (bwelling@xbill.org)
2+
package org.xbill.DNS.tools;
23

34
import java.io.BufferedReader;
45
import java.io.FileInputStream;

0 commit comments

Comments
 (0)