Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Eric Duminil
RegionChooser
Commits
b5d693f8
Commit
b5d693f8
authored
Oct 07, 2022
by
Eric Duminil
Browse files
TRying to read stdin
parent
bc0f1e69
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/eu/simstadt/regionchooser/RegionChooserCommandLineInterface.java
View file @
b5d693f8
...
...
@@ -2,6 +2,7 @@
import
java.nio.file.Path
;
import
java.util.List
;
import
java.util.Scanner
;
import
java.util.concurrent.Callable
;
import
picocli.CommandLine
;
import
picocli.CommandLine.Command
;
...
...
@@ -31,9 +32,21 @@ public Integer call() throws Exception { // your business logic goes here...
System
.
out
.
print
(
"in "
);
System
.
out
.
println
(
srsName
+
" coordinates."
);
if
(
System
.
in
.
available
()
==
0
)
{
System
.
out
.
println
(
"OH NOEs, NO INPUT!"
);
}
else
{
System
.
out
.
println
(
"Here's standard input:"
);
System
.
out
.
println
(
getInput
());
System
.
out
.
println
(
"Done"
);
}
return
0
;
}
private
static
String
getInput
()
{
Scanner
myObj
=
new
Scanner
(
System
.
in
);
return
myObj
.
nextLine
();
}
// this example implements Callable, so parsing, error handling and handling user
// requests for usage help or version help can be done with one line of code.
public
static
void
main
(
String
...
args
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment