mirror of
https://codeberg.org/PGPainless/cert-d-pgpainless.git
synced 2024-12-22 13:17:58 +01:00
Implement very basic list command
This commit is contained in:
parent
6a16d0cff5
commit
3267a330bf
4 changed files with 54 additions and 1 deletions
|
@ -12,6 +12,7 @@ import pgp.cert_d.cli.commands.Export;
|
||||||
import pgp.cert_d.cli.commands.Get;
|
import pgp.cert_d.cli.commands.Get;
|
||||||
import pgp.cert_d.cli.commands.Insert;
|
import pgp.cert_d.cli.commands.Insert;
|
||||||
import pgp.cert_d.cli.commands.Import;
|
import pgp.cert_d.cli.commands.Import;
|
||||||
|
import pgp.cert_d.cli.commands.List;
|
||||||
import pgp.cert_d.cli.commands.Setup;
|
import pgp.cert_d.cli.commands.Setup;
|
||||||
import pgp.cert_d.jdbc.sqlite.DatabaseSubkeyLookup;
|
import pgp.cert_d.jdbc.sqlite.DatabaseSubkeyLookup;
|
||||||
import pgp.cert_d.jdbc.sqlite.SqliteSubkeyLookupDaoImpl;
|
import pgp.cert_d.jdbc.sqlite.SqliteSubkeyLookupDaoImpl;
|
||||||
|
@ -32,7 +33,8 @@ import java.sql.SQLException;
|
||||||
Insert.class,
|
Insert.class,
|
||||||
Import.class,
|
Import.class,
|
||||||
Get.class,
|
Get.class,
|
||||||
Setup.class
|
Setup.class,
|
||||||
|
List.class
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
public class PGPCertDCli {
|
public class PGPCertDCli {
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
// SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
package pgp.cert_d.cli.commands;
|
||||||
|
|
||||||
|
import pgp.cert_d.cli.PGPCertDCli;
|
||||||
|
import pgp.certificate_store.Certificate;
|
||||||
|
import picocli.CommandLine;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
@CommandLine.Command(name = "list",
|
||||||
|
resourceBundle = "msg_list"
|
||||||
|
)
|
||||||
|
public class List implements Runnable {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Iterator<Certificate> certificates = PGPCertDCli.getCertificateDirectory()
|
||||||
|
.getCertificates();
|
||||||
|
while (certificates.hasNext()) {
|
||||||
|
Certificate certificate = certificates.next();
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
|
System.out.println(certificate.getFingerprint());
|
||||||
|
// CHECKSTYLE:ON
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
pgpainless-cert-d-cli/src/main/resources/msg_list.properties
Normal file
11
pgpainless-cert-d-cli/src/main/resources/msg_list.properties
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
# SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
usage.header=List all certificates in the directory
|
||||||
|
store=Overwrite the default certificate directory path
|
||||||
|
|
||||||
|
# Generic TODO: Remove when bumping picocli to 4.7.0
|
||||||
|
usage.synopsisHeading=Usage:\u0020
|
||||||
|
usage.commandListHeading = %nCommands:%n
|
||||||
|
usage.optionListHeading = %nOptions:%n
|
||||||
|
usage.footerHeading=Powered by picocli%n
|
|
@ -0,0 +1,11 @@
|
||||||
|
# SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
usage.header=Liste alle Zertifikate im Verzeichnis auf
|
||||||
|
store=Überschreibe den Standardpfad des Zertifikatsverzeichnisses
|
||||||
|
|
||||||
|
# Generic TODO: Remove when bumping picocli to 4.7.0
|
||||||
|
usage.synopsisHeading=Aufruf:\u0020
|
||||||
|
usage.commandListHeading=%nBefehle:%n
|
||||||
|
usage.optionListHeading = %nOptionen:%n
|
||||||
|
usage.footerHeading=Powered by Picocli%n
|
Loading…
Reference in a new issue