Slightly better commandLine in Java example.
GitOrigin-RevId: 0df474b7b9f4ded67c9c6a61fe07f68433522644
This commit is contained in:
parent
3abf2ef88e
commit
be3a1b51a6
@ -51,6 +51,7 @@ public final class Example {
|
|||||||
|
|
||||||
private static final Console console = System.console();
|
private static final Console console = System.console();
|
||||||
private static final String newLine = System.getProperty("line.separator");
|
private static final String newLine = System.getProperty("line.separator");
|
||||||
|
private static final String commandsLine = "Enter command (gcs - GetChats, gc <chatId> - GetChat, me - GetMe, sm <chatId> <message> - SendMessage, lo - LogOut, q - Quit): ";
|
||||||
|
|
||||||
static {
|
static {
|
||||||
System.loadLibrary("tdjni");
|
System.loadLibrary("tdjni");
|
||||||
@ -59,6 +60,10 @@ public final class Example {
|
|||||||
private static void print(String str) {
|
private static void print(String str) {
|
||||||
System.out.println();
|
System.out.println();
|
||||||
System.out.println(str);
|
System.out.println(str);
|
||||||
|
if (haveAuthorization)
|
||||||
|
{
|
||||||
|
System.out.print(commandsLine);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setChatOrder(TdApi.Chat chat, long order) {
|
private static void setChatOrder(TdApi.Chat chat, long order) {
|
||||||
@ -162,7 +167,7 @@ public final class Example {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void getCommand() {
|
private static void getCommand() {
|
||||||
String command = console.readLine("Enter command (gcs - GetChats, gc <chatId> - GetChat, me - GetMe, sm <chatId> <message> - SendMessage, lo - LogOut, q - Quit): ");
|
String command = console.readLine(commandsLine);
|
||||||
String[] commands = command.split(" ", 2);
|
String[] commands = command.split(" ", 2);
|
||||||
try {
|
try {
|
||||||
switch (commands[0]) {
|
switch (commands[0]) {
|
||||||
|
Loading…
Reference in New Issue
Block a user