Skip to content

Commit 5b02149

Browse files
committed
Add VSCode settings for Java build configuration
1 parent 66aee71 commit 5b02149

File tree

2 files changed

+3
-90
lines changed

2 files changed

+3
-90
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"java.configuration.updateBuildConfiguration": "interactive"
3+
}

src/main/java/com/mycmd/commands/TimeoutCommand.java

Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -2,95 +2,6 @@
22

33
import com.mycmd.Command;
44
import com.mycmd.ShellContext;
5-
<<<<<<< HEAD
6-
7-
import java.io.IOException;
8-
9-
/**
10-
* Delays execution for a specified time period.
11-
*
12-
* Usage:
13-
* - timeout /T 10 : Wait 10 seconds
14-
* - timeout 5 : Wait 5 seconds
15-
*/
16-
public class TimeoutCommand implements Command {
17-
18-
@Override
19-
public void execute(String[] args, ShellContext context) throws IOException {
20-
if (args.length == 0) {
21-
System.out.println("TIMEOUT [/T] timeout [/NOBREAK]");
22-
System.out.println("\nDescription:");
23-
System.out.println(" This utility accepts a timeout parameter to wait for the specified");
24-
System.out.println(" time period (in seconds) or until any key is pressed. It also accepts");
25-
System.out.println(" a parameter to ignore the key press.");
26-
System.out.println("\nParameter List:");
27-
System.out.println(" /T timeout Specifies the number of seconds to wait.");
28-
System.out.println(" Valid range is -1 to 99999 seconds.");
29-
System.out.println(" /NOBREAK Ignore key presses and wait specified time.");
30-
return;
31-
}
32-
33-
int seconds = 0;
34-
boolean noBreak = false;
35-
36-
for (int i = 0; i < args.length; i++) {
37-
String arg = args[i].toUpperCase();
38-
39-
if (arg.equals("/T") && i + 1 < args.length) {
40-
try {
41-
seconds = Integer.parseInt(args[++i]);
42-
} catch (NumberFormatException e) {
43-
System.out.println("ERROR: Invalid argument/option - '" + args[i] + "'.");
44-
return;
45-
}
46-
} else if (arg.equals("/NOBREAK")) {
47-
noBreak = true;
48-
} else {
49-
try {
50-
seconds = Integer.parseInt(arg);
51-
} catch (NumberFormatException e) {
52-
System.out.println("ERROR: Invalid argument/option - '" + arg + "'.");
53-
return;
54-
}
55-
}
56-
}
57-
58-
if (seconds < 0) {
59-
System.out.println("Waiting forever - press any key to continue...");
60-
try {
61-
System.in.read();
62-
} catch (IOException e) {
63-
// Ignore
64-
}
65-
} else {
66-
System.out.println("Waiting for " + seconds + " seconds, press a key to continue ...");
67-
68-
try {
69-
long startTime = System.currentTimeMillis();
70-
long endTime = startTime + (seconds * 1000L);
71-
72-
while (System.currentTimeMillis() < endTime) {
73-
if (!noBreak && System.in.available() > 0) {
74-
System.in.read();
75-
break;
76-
}
77-
Thread.sleep(100);
78-
}
79-
} catch (InterruptedException | IOException e) {
80-
System.out.println("Timeout interrupted.");
81-
}
82-
}
83-
}
84-
85-
@Override
86-
public String description() {
87-
return "Delays execution for a specified time period.";
88-
}
89-
90-
@Override
91-
public String usage() {
92-
return "timeout [/T] seconds [/NOBREAK]";
93-
=======
945
import java.io.IOException;
956
import java.util.concurrent.atomic.AtomicBoolean;
967

@@ -273,6 +184,5 @@ public String usage() {
273184
+ "timeout /t <seconds>\n"
274185
+ "timeout /t <seconds> /nobreak\n"
275186
+ "timeout /t -1";
276-
>>>>>>> upstream/main
277187
}
278188
}

0 commit comments

Comments
 (0)