mirror of
https://codeberg.org/PGPainless/wkd-java.git
synced 2024-11-24 00:02:06 +01:00
Rename 'fetch' subcommand to 'get'
This commit is contained in:
parent
c0652b6162
commit
7f067c55e5
4 changed files with 13 additions and 11 deletions
|
@ -6,13 +6,15 @@ package pgp.wkd.cli;
|
||||||
|
|
||||||
import pgp.wkd.exception.CertNotFetchableException;
|
import pgp.wkd.exception.CertNotFetchableException;
|
||||||
import pgp.wkd.exception.RejectedCertificateException;
|
import pgp.wkd.exception.RejectedCertificateException;
|
||||||
import pgp.wkd.cli.command.Fetch;
|
import pgp.wkd.cli.command.GetCmd;
|
||||||
import picocli.CommandLine;
|
import picocli.CommandLine;
|
||||||
|
|
||||||
@CommandLine.Command(
|
@CommandLine.Command(
|
||||||
|
name = "wkd",
|
||||||
|
description = "Interact with the Web Key Directory",
|
||||||
subcommands = {
|
subcommands = {
|
||||||
CommandLine.HelpCommand.class,
|
CommandLine.HelpCommand.class,
|
||||||
Fetch.class
|
GetCmd.class
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
public class WKDCLI {
|
public class WKDCLI {
|
||||||
|
|
|
@ -20,10 +20,10 @@ import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
||||||
@CommandLine.Command(
|
@CommandLine.Command(
|
||||||
name = "fetch",
|
name = "get",
|
||||||
description = "Fetch an OpenPGP Certificate via the Web Key Directory"
|
description = "Get an OpenPGP Certificate via the Web Key Directory"
|
||||||
)
|
)
|
||||||
public class Fetch implements Runnable {
|
public class GetCmd implements Runnable {
|
||||||
|
|
||||||
@CommandLine.Parameters(
|
@CommandLine.Parameters(
|
||||||
index = "0",
|
index = "0",
|
||||||
|
@ -67,7 +67,7 @@ public class Fetch implements Runnable {
|
||||||
throw new NullPointerException("CertificateDiscoverer cannot be null.");
|
throw new NullPointerException("CertificateDiscoverer cannot be null.");
|
||||||
}
|
}
|
||||||
|
|
||||||
Fetch.discoverer = discoverer;
|
GetCmd.discoverer = discoverer;
|
||||||
}
|
}
|
||||||
|
|
||||||
private WKDAddress addressFromUserId(String userId) {
|
private WKDAddress addressFromUserId(String userId) {
|
|
@ -12,7 +12,7 @@ import pgp.wkd.cli.WKDCLI;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
@Disabled("For privacy reasons")
|
@Disabled("For privacy reasons")
|
||||||
public class TestFetchKeysFromGithubPages extends RedirectSystemStreamsTest {
|
public class TestGetKeysFromGithubPages extends RedirectSystemStreamsTest {
|
||||||
|
|
||||||
// Valid WKD publication.
|
// Valid WKD publication.
|
||||||
// Cert is available at https://pgpainless.github.io/.well-known/openpgpkey/hu/eprjcbeppbna3f6xabhtpddzpn41nknw
|
// Cert is available at https://pgpainless.github.io/.well-known/openpgpkey/hu/eprjcbeppbna3f6xabhtpddzpn41nknw
|
|
@ -10,7 +10,7 @@ import org.junit.jupiter.api.DynamicTest;
|
||||||
import org.junit.jupiter.api.TestFactory;
|
import org.junit.jupiter.api.TestFactory;
|
||||||
import pgp.wkd.cli.PGPainlessCertificateParser;
|
import pgp.wkd.cli.PGPainlessCertificateParser;
|
||||||
import pgp.wkd.cli.WKDCLI;
|
import pgp.wkd.cli.WKDCLI;
|
||||||
import pgp.wkd.cli.command.Fetch;
|
import pgp.wkd.cli.command.GetCmd;
|
||||||
import pgp.wkd.discovery.CertificateDiscoverer;
|
import pgp.wkd.discovery.CertificateDiscoverer;
|
||||||
import pgp.wkd.discovery.ValidatingCertificateDiscoverer;
|
import pgp.wkd.discovery.ValidatingCertificateDiscoverer;
|
||||||
import pgp.wkd.discovery.DiscoveryMethod;
|
import pgp.wkd.discovery.DiscoveryMethod;
|
||||||
|
@ -45,7 +45,7 @@ public class TestSuiteTestRunner {
|
||||||
// Fetch certificates from a local directory instead of the internetzzz.
|
// Fetch certificates from a local directory instead of the internetzzz.
|
||||||
CertificateDiscoverer discoverer = new ValidatingCertificateDiscoverer(
|
CertificateDiscoverer discoverer = new ValidatingCertificateDiscoverer(
|
||||||
new PGPainlessCertificateParser(), new DirectoryBasedCertificateFetcher(tempPath));
|
new PGPainlessCertificateParser(), new DirectoryBasedCertificateFetcher(tempPath));
|
||||||
Fetch.setCertificateDiscoverer(discoverer);
|
GetCmd.setCertificateDiscoverer(discoverer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestFactory
|
@TestFactory
|
||||||
|
@ -61,7 +61,7 @@ public class TestSuiteTestRunner {
|
||||||
|
|
||||||
String mail = testCase.getLookupMailAddress();
|
String mail = testCase.getLookupMailAddress();
|
||||||
int exitCode = WKDCLI.execute(new String[] {
|
int exitCode = WKDCLI.execute(new String[] {
|
||||||
"fetch", "--armor", mail
|
"get", "--armor", mail
|
||||||
});
|
});
|
||||||
|
|
||||||
if (testCase.isExpectSuccess()) {
|
if (testCase.isExpectSuccess()) {
|
||||||
|
@ -74,6 +74,6 @@ public class TestSuiteTestRunner {
|
||||||
|
|
||||||
@AfterAll
|
@AfterAll
|
||||||
public static void reset() {
|
public static void reset() {
|
||||||
Fetch.setCertificateDiscoverer(Fetch.DEFAULT_DISCOVERER);
|
GetCmd.setCertificateDiscoverer(GetCmd.DEFAULT_DISCOVERER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue