001/* 002 * SPDX-FileCopyrightText: none 003 * SPDX-License-Identifier: CC0-1.0 004 */ 005 006package gov.nist.secauto.metaschema.cli.processor.command; 007 008import gov.nist.secauto.metaschema.cli.processor.CLIProcessor.CallingContext; 009 010import org.apache.commons.cli.CommandLine; 011 012import edu.umd.cs.findbugs.annotations.NonNull; 013 014public interface ICommandExecutor { 015 void execute() throws CommandExecutionException; 016 017 @NonNull 018 static ICommandExecutor using( 019 @NonNull CallingContext callingContext, 020 @NonNull CommandLine commandLine, 021 @NonNull ExecutionFunction function) { 022 return () -> function.execute(callingContext, commandLine); 023 } 024 025 @FunctionalInterface 026 interface ExecutionFunction { 027 void execute( 028 @NonNull CallingContext callingContext, 029 @NonNull CommandLine commandLine) throws CommandExecutionException; 030 } 031}