|
@@ -1,5 +1,5 @@
|
1
|
|
-import okhttp3.Request;
|
2
|
|
-import okhttp3.Response;
|
|
1
|
+
|
|
2
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
3
|
3
|
|
4
|
4
|
import java.io.BufferedReader;
|
5
|
5
|
import java.io.IOException;
|
|
@@ -12,11 +12,17 @@ public class SimpleShell {
|
12
|
12
|
|
13
|
13
|
|
14
|
14
|
public static void prettyPrint(String output) {
|
15
|
|
- // yep, make an effort to format things nicely, eh?
|
16
|
|
- System.out.println(output);
|
|
15
|
+ ObjectMapper objectMapper = new ObjectMapper();
|
|
16
|
+ try{
|
|
17
|
+ Object json = objectMapper.readValue(output, Object.class);
|
|
18
|
+ String prettyPrint = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(json);
|
|
19
|
+ System.out.println(prettyPrint);
|
|
20
|
+ } catch (IOException e) {
|
|
21
|
+ e.printStackTrace();
|
|
22
|
+ }
|
17
|
23
|
}
|
18
|
24
|
public static void main(String[] args) throws java.io.IOException {
|
19
|
|
-
|
|
25
|
+ ObjectMapper objectMapper = new ObjectMapper();
|
20
|
26
|
YouAreEll webber = new YouAreEll();
|
21
|
27
|
String commandLine;
|
22
|
28
|
BufferedReader console = new BufferedReader
|
|
@@ -62,7 +68,7 @@ public class SimpleShell {
|
62
|
68
|
// Specific Commands.
|
63
|
69
|
|
64
|
70
|
// ids
|
65
|
|
- if (list.contains("ids")) {
|
|
71
|
+ if (list.contains("ids") && list.size() == 1) {
|
66
|
72
|
String results = webber.get_ids();
|
67
|
73
|
SimpleShell.prettyPrint(results);
|
68
|
74
|
continue;
|
|
@@ -76,6 +82,16 @@ public class SimpleShell {
|
76
|
82
|
}
|
77
|
83
|
// you need to add a bunch more.
|
78
|
84
|
|
|
85
|
+
|
|
86
|
+ if (list.contains("ids") && list.size() == 3){
|
|
87
|
+ String name = list.get(1);
|
|
88
|
+ String gitHubId = list.get(2);
|
|
89
|
+ User newUserId = new User(name, gitHubId);
|
|
90
|
+ String newIdInfo = objectMapper.writeValueAsString(newUserId);
|
|
91
|
+ webber.MakeURLCall("/ids","POST", newIdInfo);
|
|
92
|
+ continue;
|
|
93
|
+ }
|
|
94
|
+
|
79
|
95
|
// create
|
80
|
96
|
// send message
|
81
|
97
|
//
|