feat(command): 调整spring-shell版本

使用一个正式版
This commit is contained in:
v-zhangjc9
2024-05-27 00:14:53 +08:00
parent a02ede8c7e
commit 1b75ccefd3
6 changed files with 11 additions and 14 deletions

View File

@@ -24,7 +24,7 @@ import org.springframework.shell.CompletionProposal;
import org.springframework.shell.standard.ShellComponent;
import org.springframework.shell.standard.ShellMethod;
import org.springframework.shell.standard.ShellOption;
import org.springframework.shell.standard.ValueProviderSupport;
import org.springframework.shell.standard.ValueProvider;
import org.springframework.shell.table.BorderStyle;
import org.springframework.shell.table.TableBuilder;
import org.springframework.shell.table.TableModelBuilder;
@@ -194,9 +194,9 @@ public class JobCommand {
ACCT_ITEM,
}
public static final class TableTypeValueProvider extends ValueProviderSupport {
public static final class TableTypeValueProvider implements ValueProvider {
@Override
public List<CompletionProposal> complete(MethodParameter parameter, CompletionContext context, String[] hints) {
public List<CompletionProposal> complete(CompletionContext context) {
return ListUtil.of(
new CompletionProposal("SMALL"),
new CompletionProposal("BIG"),
@@ -206,9 +206,9 @@ public class JobCommand {
}
}
public static final class DatabaseTypeValueProvider extends ValueProviderSupport {
public static final class DatabaseTypeValueProvider implements ValueProvider {
@Override
public List<CompletionProposal> complete(MethodParameter parameter, CompletionContext completionContext, String[] hints) {
public List<CompletionProposal> complete(CompletionContext completionContext) {
return ListUtil.of(
new CompletionProposal("UDAL"),
new CompletionProposal("TELEPG")

View File

@@ -3,7 +3,6 @@ package com.lanyuanxiaoyao.service.command.provider;
import com.lanyuanxiaoyao.service.forest.service.InfoService;
import java.util.List;
import java.util.Optional;
import org.springframework.core.MethodParameter;
import org.springframework.shell.CompletionContext;
import org.springframework.shell.CompletionProposal;
import org.springframework.stereotype.Component;
@@ -24,7 +23,7 @@ public class AliasProvider extends BaseValueProvider {
}
@Override
public List<CompletionProposal> complete(MethodParameter parameter, CompletionContext completionContext, String[] hints) {
public List<CompletionProposal> complete(CompletionContext completionContext) {
Optional<String> field = getField(completionContext.getWords(), "--flink-job-id");
return field.map(id -> infoService.simpleTableMetas(Long.parseLong(id))
.collect(info -> new CompletionProposal(info.getAlias()).description(info.getSchema()))

View File

@@ -2,13 +2,13 @@ package com.lanyuanxiaoyao.service.command.provider;
import java.util.List;
import java.util.Optional;
import org.springframework.shell.standard.ValueProviderSupport;
import org.springframework.shell.standard.ValueProvider;
/**
* @author ZhangJiacheng
* @date 2022-05-30
*/
public abstract class BaseValueProvider extends ValueProviderSupport {
public abstract class BaseValueProvider implements ValueProvider {
protected Optional<String> getField(List<String> words, String fieldName) {
boolean hasField = words.stream().anyMatch(word -> word.contains(fieldName));
if (hasField) {

View File

@@ -3,7 +3,6 @@ package com.lanyuanxiaoyao.service.command.provider;
import com.lanyuanxiaoyao.service.forest.service.InfoService;
import java.util.List;
import java.util.Optional;
import org.springframework.core.MethodParameter;
import org.springframework.shell.CompletionContext;
import org.springframework.shell.CompletionProposal;
import org.springframework.stereotype.Component;
@@ -24,7 +23,7 @@ public class FlinkJobIdProvider extends BaseValueProvider {
}
@Override
public List<CompletionProposal> complete(MethodParameter parameter, CompletionContext completionContext, String[] hints) {
public List<CompletionProposal> complete(CompletionContext completionContext) {
Optional<String> field = getField(completionContext.getWords(), "--table");
return field.map(id -> infoService.simpleTableMetas(field.get())
.collect(info -> new CompletionProposal(info.getFlinkJobId().toString()).description(info.getSchema()))

View File

@@ -4,7 +4,6 @@ import com.lanyuanxiaoyao.service.command.utils.SearchUtils;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.core.MethodParameter;
import org.springframework.shell.CompletionContext;
import org.springframework.shell.CompletionProposal;
@@ -14,7 +13,7 @@ import org.springframework.shell.CompletionProposal;
*/
public class SearchTypeValueProvider extends BaseValueProvider {
@Override
public List<CompletionProposal> complete(MethodParameter parameter, CompletionContext completionContext, String[] hints) {
public List<CompletionProposal> complete(CompletionContext completionContext) {
return Arrays.stream(SearchUtils.Type.values())
.map(type -> new CompletionProposal(type.name()))
.collect(Collectors.toList());