Skip to content

Commit 6644ebf

Browse files
committed
Prepare release
1 parent f49109f commit 6644ebf

14 files changed

+219
-321
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<description>Command Line Interface for DataStax Astra</description>
88
<packaging>jar</packaging>
99
<inceptionYear>2022</inceptionYear>
10-
<version>0.2</version>
10+
<version>0.2.1</version>
1111
<url>https://github.com/datastax/astra-cli</url>
1212
<properties>
1313
<sonar.organization>clun-datastax</sonar.organization>

src/main/dist/astra-init.sh

+1-32
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
autoload -U +X compinit > /dev/null 2>&1 && compinit
55
autoload -U +X bashcompinit > /dev/null 2>&1 && bashcompinit
66

7-
87
# Generated by airline BashCompletionGenerator
98

109
containsElement () {
@@ -1071,7 +1070,7 @@ function _complete_astra_group_db_command_count() {
10711070
COMMANDS=$1
10721071

10731072
FLAG_OPTS="--no-color -v --verbose"
1074-
ARG_OPTS="--token -m --keyspace --config-file -query -o -maxErrors -encoding -t -skipRecords --config -cf -url --dsbulk-config -header --schema.query -delim -maxConcurrentQueries -conf -logDir --table --schema.mapping -k --output"
1073+
ARG_OPTS="--token --keyspace --config-file -query -o -encoding -t --config -cf --dsbulk-config --schema.query -maxConcurrentQueries -conf -logDir --table -k --output"
10751074

10761075
$( containsElement ${PREV_WORD} ${ARG_OPTS[@]} )
10771076
SAW_ARG=$?
@@ -1089,11 +1088,6 @@ function _complete_astra_group_db_command_count() {
10891088
echo ${COMPREPLY[@]}
10901089
return 0
10911090
;;
1092-
-maxErrors)
1093-
COMPREPLY=( $(compgen -W "${ARG_VALUES} ${ARG_GENERATED_VALUES}" -- ${CURR_WORD}) )
1094-
echo ${COMPREPLY[@]}
1095-
return 0
1096-
;;
10971091
-encoding)
10981092
COMPREPLY=( $(compgen -W "${ARG_VALUES} ${ARG_GENERATED_VALUES}" -- ${CURR_WORD}) )
10991093
echo ${COMPREPLY[@]}
@@ -1114,36 +1108,16 @@ function _complete_astra_group_db_command_count() {
11141108
echo ${COMPREPLY[@]}
11151109
return 0
11161110
;;
1117-
-skipRecords)
1118-
COMPREPLY=( $(compgen -W "${ARG_VALUES} ${ARG_GENERATED_VALUES}" -- ${CURR_WORD}) )
1119-
echo ${COMPREPLY[@]}
1120-
return 0
1121-
;;
11221111
-cf|--config-file)
11231112
COMPREPLY=( $(compgen -W "${ARG_VALUES} ${ARG_GENERATED_VALUES}" -- ${CURR_WORD}) )
11241113
echo ${COMPREPLY[@]}
11251114
return 0
11261115
;;
1127-
-url)
1128-
COMPREPLY=( $(compgen -W "${ARG_VALUES} ${ARG_GENERATED_VALUES}" -- ${CURR_WORD}) )
1129-
echo ${COMPREPLY[@]}
1130-
return 0
1131-
;;
11321116
--dsbulk-config)
11331117
COMPREPLY=( $(compgen -W "${ARG_VALUES} ${ARG_GENERATED_VALUES}" -- ${CURR_WORD}) )
11341118
echo ${COMPREPLY[@]}
11351119
return 0
11361120
;;
1137-
-header)
1138-
COMPREPLY=( $(compgen -W "${ARG_VALUES} ${ARG_GENERATED_VALUES}" -- ${CURR_WORD}) )
1139-
echo ${COMPREPLY[@]}
1140-
return 0
1141-
;;
1142-
-delim)
1143-
COMPREPLY=( $(compgen -W "${ARG_VALUES} ${ARG_GENERATED_VALUES}" -- ${CURR_WORD}) )
1144-
echo ${COMPREPLY[@]}
1145-
return 0
1146-
;;
11471121
-maxConcurrentQueries)
11481122
COMPREPLY=( $(compgen -W "${ARG_VALUES} ${ARG_GENERATED_VALUES}" -- ${CURR_WORD}) )
11491123
echo ${COMPREPLY[@]}
@@ -1154,11 +1128,6 @@ function _complete_astra_group_db_command_count() {
11541128
echo ${COMPREPLY[@]}
11551129
return 0
11561130
;;
1157-
-m|--schema.mapping)
1158-
COMPREPLY=( $(compgen -W "${ARG_VALUES} ${ARG_GENERATED_VALUES}" -- ${CURR_WORD}) )
1159-
echo ${COMPREPLY[@]}
1160-
return 0
1161-
;;
11621131
-o|--output)
11631132
COMPREPLY=( $(compgen -W "${ARG_VALUES} ${ARG_GENERATED_VALUES}" -- ${CURR_WORD}) )
11641133
echo ${COMPREPLY[@]}

src/main/java/com/dtsx/astra/cli/config/ServiceConfig.java

+6-13
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232

3333
/**
3434
* Group configuration actions.
35-
*
36-
* @author Cedrick LUNVEN (@clunven)
3735
*/
3836
public class ServiceConfig {
3937

@@ -107,22 +105,17 @@ public static List<String> listOrganizations(Map<String, Map<String, String>> se
107105
* organization name if exists
108106
*/
109107
public static Optional<String> findDefaultOrganizationName(Map<String, Map<String, String>> sections) {
110-
String defaultOrgName = null;
111108
if (sections.containsKey(AstraConfiguration.ASTRARC_DEFAULT)) {
112109
String defaultToken = sections
113110
.get(AstraConfiguration.ASTRARC_DEFAULT)
114111
.get(AstraRc.ASTRA_DB_APPLICATION_TOKEN);
115-
for (Entry<String, Map<String, String>> section : sections.entrySet()) {
116-
if (!section.getKey().equals(AstraConfiguration.ASTRARC_DEFAULT)) {
117-
if (defaultToken !=null &&
118-
defaultToken.equalsIgnoreCase(
119-
sections.get(section.getKey()).get(AstraRc.ASTRA_DB_APPLICATION_TOKEN))) {
120-
defaultOrgName = section.getKey();
121-
}
122-
}
123-
}
112+
return sections
113+
.entrySet().stream()
114+
.filter(e -> e.getValue().get(AstraRc.ASTRA_DB_APPLICATION_TOKEN).equals(defaultToken))
115+
.map(Entry::getKey)
116+
.findFirst();
124117
}
125-
return Optional.ofNullable(defaultOrgName);
118+
return Optional.empty();
126119
}
127120

128121
/**

src/main/java/com/dtsx/astra/cli/config/SetupCmd.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ public void execute() {
6666
try {
6767
createDefaultSection(token);
6868
valid_token = true;
69-
} catch(InvalidTokenException ite) {}
69+
} catch(InvalidTokenException ite) {
70+
LoggerShell.error("Your token in invalid please retry " + ite.getMessage());
71+
}
7072
}
7173
}
7274
}

src/main/java/com/dtsx/astra/cli/core/out/AstraCliConsole.java

+3-62
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,16 @@
1-
/*-
2-
* ----------LICENSE----------
3-
* Astra CLI
4-
* --
5-
* Copyright (C) 2022 - 2023 DataStax
6-
* --
7-
* Licensed under the Apache License, Version 2.0
8-
* You may not use this file except in compliance with the License.
9-
* You may obtain a copy of the License at
10-
*
11-
* http://www.apache.org/licenses/LICENSE-2.0
12-
*
13-
* Unless required by applicable law or agreed to in writing, software
14-
* distributed under the License is distributed on an "AS IS" BASIS,
15-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16-
* See the License for the specific language governing permissions and
17-
* limitations under the License.
18-
* ----------------
19-
*/
201
package com.dtsx.astra.cli.core.out;
212

223
/*-
23-
* ---LICENSE---
4+
* #%L
245
* Astra CLI
256
* --
267
* Copyright (C) 2022 - 2023 DataStax
278
* --
289
* Licensed under the Apache License, Version 2.0
29-
* You may not use this file except in compliance with the License.
30-
* You may obtain a copy of the License at
31-
*
32-
* http://www.apache.org/licenses/LICENSE-2.0
33-
*
34-
* Unless required by applicable law or agreed to in writing, software
35-
* distributed under the License is distributed on an "AS IS" BASIS,
36-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37-
* See the License for the specific language governing permissions and
38-
* limitations under the License.
39-
* ----------------
40-
*/
41-
42-
/*-
43-
* ========================LICENSE_START=================================
44-
* Astra CLI
45-
* %%
46-
* Copyright (C) 2022 - 2023 DataStax
47-
* %%
48-
* Licensed under the Apache License, Version 2.0 (the "License");
49-
* you may not use this file except in compliance with the License.
50-
* You may obtain a copy of the License at
51-
*
52-
* http://www.apache.org/licenses/LICENSE-2.0
53-
*
54-
* Unless required by applicable law or agreed to in writing, software
55-
* distributed under the License is distributed on an "AS IS" BASIS,
56-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
57-
* See the License for the specific language governing permissions and
58-
* limitations under the License.
59-
* =========================LICENSE_END==================================
60-
*/
61-
62-
/*-
63-
* #%L
64-
* Astra Cli
65-
* %%
66-
* Copyright (C) 2022 DataStax
67-
* %%
68-
* Licensed under the Apache License, Version 2.0 (the "License");
69-
* you may not use this file except in compliance with the License.
10+
* You may not use this file except in compliance with the License.
7011
* You may obtain a copy of the License at
7112
*
72-
* http://www.apache.org/licenses/LICENSE-2.0
13+
* http://www.apache.org/licenses/LICENSE-2.0
7314
*
7415
* Unless required by applicable law or agreed to in writing, software
7516
* distributed under the License is distributed on an "AS IS" BASIS,

src/main/java/com/dtsx/astra/cli/db/DbDeleteCmd.java

+3-62
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,16 @@
1-
/*-
2-
* ----------LICENSE----------
3-
* Astra CLI
4-
* --
5-
* Copyright (C) 2022 - 2023 DataStax
6-
* --
7-
* Licensed under the Apache License, Version 2.0
8-
* You may not use this file except in compliance with the License.
9-
* You may obtain a copy of the License at
10-
*
11-
* http://www.apache.org/licenses/LICENSE-2.0
12-
*
13-
* Unless required by applicable law or agreed to in writing, software
14-
* distributed under the License is distributed on an "AS IS" BASIS,
15-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16-
* See the License for the specific language governing permissions and
17-
* limitations under the License.
18-
* ----------------
19-
*/
201
package com.dtsx.astra.cli.db;
212

223
/*-
23-
* ---LICENSE---
4+
* #%L
245
* Astra CLI
256
* --
267
* Copyright (C) 2022 - 2023 DataStax
278
* --
289
* Licensed under the Apache License, Version 2.0
29-
* You may not use this file except in compliance with the License.
30-
* You may obtain a copy of the License at
31-
*
32-
* http://www.apache.org/licenses/LICENSE-2.0
33-
*
34-
* Unless required by applicable law or agreed to in writing, software
35-
* distributed under the License is distributed on an "AS IS" BASIS,
36-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37-
* See the License for the specific language governing permissions and
38-
* limitations under the License.
39-
* ----------------
40-
*/
41-
42-
/*-
43-
* ========================LICENSE_START=================================
44-
* Astra CLI
45-
* %%
46-
* Copyright (C) 2022 - 2023 DataStax
47-
* %%
48-
* Licensed under the Apache License, Version 2.0 (the "License");
49-
* you may not use this file except in compliance with the License.
50-
* You may obtain a copy of the License at
51-
*
52-
* http://www.apache.org/licenses/LICENSE-2.0
53-
*
54-
* Unless required by applicable law or agreed to in writing, software
55-
* distributed under the License is distributed on an "AS IS" BASIS,
56-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
57-
* See the License for the specific language governing permissions and
58-
* limitations under the License.
59-
* =========================LICENSE_END==================================
60-
*/
61-
62-
/*-
63-
* #%L
64-
* Astra Cli
65-
* %%
66-
* Copyright (C) 2022 DataStax
67-
* %%
68-
* Licensed under the Apache License, Version 2.0 (the "License");
69-
* you may not use this file except in compliance with the License.
10+
* You may not use this file except in compliance with the License.
7011
* You may obtain a copy of the License at
7112
*
72-
* http://www.apache.org/licenses/LICENSE-2.0
13+
* http://www.apache.org/licenses/LICENSE-2.0
7314
*
7415
* Unless required by applicable law or agreed to in writing, software
7516
* distributed under the License is distributed on an "AS IS" BASIS,

src/main/java/com/dtsx/astra/cli/db/dsbulk/AbstractDsbulkDataCmd.java

-86
This file was deleted.

src/main/java/com/dtsx/astra/cli/db/dsbulk/DbCountCmd.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* Load data into AstraDB.
2727
*/
2828
@Command(name = "count", description = "Count items for a table, a query")
29-
public class DbCountCmd extends AbstractDsbulkDataCmd {
29+
public class DbCountCmd extends AbstractDsbulkCmd {
3030

3131
/** {@inheritDoc} */
3232
@Override

0 commit comments

Comments
 (0)