mirror of
https://codeberg.org/PGPainless/sop-java.git
synced 2024-12-06 14:02:07 +01:00
Kotlin conversion: ListProfiles
This commit is contained in:
parent
6c14f249bb
commit
145cadef4f
2 changed files with 34 additions and 43 deletions
|
@ -1,43 +0,0 @@
|
|||
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package sop.operation;
|
||||
|
||||
import sop.Profile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Subcommand to list supported profiles of other subcommands.
|
||||
*/
|
||||
public interface ListProfiles {
|
||||
|
||||
/**
|
||||
* Provide the name of the subcommand for which profiles shall be listed.
|
||||
* The returned list of profiles MUST NOT contain more than 4 entries.
|
||||
*
|
||||
* @param command command name (e.g. <pre>generate-key</pre>)
|
||||
* @return list of profiles.
|
||||
*/
|
||||
List<Profile> subcommand(String command);
|
||||
|
||||
/**
|
||||
* Return a list of {@link Profile Profiles} supported by the {@link GenerateKey} implementation.
|
||||
*
|
||||
* @return profiles
|
||||
*/
|
||||
default List<Profile> generateKey() {
|
||||
return subcommand("generate-key");
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of {@link Profile Profiles} supported by the {@link Encrypt} implementation.
|
||||
*
|
||||
* @return profiles
|
||||
*/
|
||||
default List<Profile> encrypt() {
|
||||
return subcommand("encrypt");
|
||||
}
|
||||
|
||||
}
|
34
sop-java/src/main/kotlin/sop/operation/ListProfiles.kt
Normal file
34
sop-java/src/main/kotlin/sop/operation/ListProfiles.kt
Normal file
|
@ -0,0 +1,34 @@
|
|||
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package sop.operation
|
||||
|
||||
import sop.Profile
|
||||
|
||||
/** Subcommand to list supported profiles of other subcommands. */
|
||||
interface ListProfiles {
|
||||
|
||||
/**
|
||||
* Provide the name of the subcommand for which profiles shall be listed. The returned list of
|
||||
* profiles MUST NOT contain more than 4 entries.
|
||||
*
|
||||
* @param command command name (e.g. `generate-key`)
|
||||
* @return list of profiles.
|
||||
*/
|
||||
fun subcommand(command: String): List<Profile>
|
||||
|
||||
/**
|
||||
* Return a list of [Profiles][Profile] supported by the [GenerateKey] implementation.
|
||||
*
|
||||
* @return profiles
|
||||
*/
|
||||
fun generateKey(): List<Profile> = subcommand("generate-key")
|
||||
|
||||
/**
|
||||
* Return a list of [Profiles][Profile] supported by the [Encrypt] implementation.
|
||||
*
|
||||
* @return profiles
|
||||
*/
|
||||
fun encrypt(): List<Profile> = subcommand("encrypt")
|
||||
}
|
Loading…
Reference in a new issue