|
@@ -11,6 +11,14 @@ public class SimpleShell {
|
11
|
11
|
|
12
|
12
|
|
13
|
13
|
public static void prettyPrint(String output) {
|
|
14
|
+ ObjectMapper objectMapper = new ObjectMapper();
|
|
15
|
+ try {
|
|
16
|
+ Object json = objectMapper.readValue(output, Object.class);
|
|
17
|
+ String prettyPrint = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(json);
|
|
18
|
+ System.out.println(prettyPrint);
|
|
19
|
+ } catch (IOException e) {
|
|
20
|
+ e.printStackTrace();
|
|
21
|
+ }
|
14
|
22
|
// yep, make an effort to format things nicely, eh?
|
15
|
23
|
System.out.println(output);
|
16
|
24
|
}
|
|
@@ -21,6 +29,7 @@ public class SimpleShell {
|
21
|
29
|
BufferedReader console = new BufferedReader
|
22
|
30
|
(new InputStreamReader(System.in));
|
23
|
31
|
|
|
32
|
+ ObjectMapper mapper = new ObjectMapper();
|
24
|
33
|
ProcessBuilder pb = new ProcessBuilder();
|
25
|
34
|
List<String> history = new ArrayList<String>();
|
26
|
35
|
int index = 0;
|
|
@@ -61,11 +70,19 @@ public class SimpleShell {
|
61
|
70
|
// Specific Commands.
|
62
|
71
|
|
63
|
72
|
// ids
|
64
|
|
- if (list.contains("ids")) {
|
|
73
|
+ if (list.contains("ids") && list.size() == 1) {
|
65
|
74
|
String results = webber.get_ids();
|
66
|
75
|
SimpleShell.prettyPrint(results);
|
67
|
76
|
continue;
|
68
|
77
|
}
|
|
78
|
+ if (list.contains("ids") && list.size() == 3){
|
|
79
|
+ String name = list.get(1); //name
|
|
80
|
+ String github = list.get(2);
|
|
81
|
+ ID userID = new ID(name,github);
|
|
82
|
+ String newUserInfo = mapper.writeValueAsString(userID);
|
|
83
|
+ webber.MakeURLCall("/ids", "POST", newUserInfo);
|
|
84
|
+ continue;
|
|
85
|
+ }
|
69
|
86
|
|
70
|
87
|
// messages
|
71
|
88
|
if (list.contains("messages")) {
|