Skip to content

Commit d50df94

Browse files
replace if else with a switch
1 parent b61db97 commit d50df94

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

src/main/java/com/datastax/cdm/CassandraDatasetManager.java

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -92,23 +92,26 @@ public static void main(String[] args) throws IOException, ParseException, Inter
9292
}
9393

9494
// connect to the cluster via the driver
95+
switch (args[0]) {
96+
case "install":
97+
cdm.install(args[1]);
98+
break;
99+
case "list":
100+
cdm.list();
101+
break;
102+
case "new":
103+
cdm.new_dataset(args[1]);
104+
break;
105+
case "dump":
106+
cdm.dump();
107+
break;
108+
case "update":
109+
cdm.update();
110+
break;
111+
default:
112+
System.out.println("Not sure what to do.");
95113

96-
if(args[0].equals("install")) {
97-
cdm.install(args[1]);
98-
} else if (args[0].equals("list")) {
99-
cdm.list();
100-
} else if (args[0].equals("new")) {
101-
cdm.new_dataset(args[1]);
102-
} else if (args[0].equals("dump")) {
103-
cdm.dump();
104-
} else if (args[0].equals("update")) {
105-
cdm.update();
106-
} else {
107-
System.out.println("Not sure what to do.");
108114
}
109-
110-
// load data using cqlsh for now
111-
112115
System.out.println("Finished.");
113116
}
114117

@@ -232,6 +235,7 @@ void install(String name) throws IOException, InterruptedException, GitAPIExcept
232235
session.execute("DROP KEYSPACE IF EXISTS " + config.keyspace);
233236
session.execute(createKeyspace.toString());
234237
cluster.close();
238+
235239
}
236240

237241
System.out.println("Schema: " + schema);

0 commit comments

Comments
 (0)