Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mbe-tools
TTool
Commits
3888ccf4
Commit
3888ccf4
authored
Mar 14, 2019
by
Ludovic Apvrille
Browse files
Resolving bug on TTool-cli
parent
f803506f
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/cli/Help.java
View file @
3888ccf4
...
...
@@ -96,6 +96,7 @@ public class Help extends Command {
s
+=
c
.
getShortCommand
()
+
"\t"
+
c
.
getCommand
()
+
"\t"
+
c
.
getDescription
()
+
"\n"
;
}
interpreter
.
print
(
s
);
TraceManager
.
addDev
(
"Info on command"
);
return
null
;
}
...
...
src/main/java/cli/Interpreter.java
View file @
3888ccf4
...
...
@@ -141,6 +141,7 @@ public class Interpreter implements Runnable {
private
void
executeLine
(
String
line
,
int
cptLine
,
boolean
exitOnError
)
{
// Comment
TraceManager
.
addDev
(
"Executing line:"
+
line
);
line
=
line
.
trim
();
if
(
line
.
length
()
==
0
)
{
...
...
@@ -167,28 +168,42 @@ public class Interpreter implements Runnable {
}
TraceManager
.
addDev
(
"Handling line: "
+
lineWithNoVariable
);
String
[]
commandInfo
=
lineWithNoVariable
.
split
(
" "
);
if
((
commandInfo
==
null
)
||
(
commandInfo
.
length
<
1
)){
System
.
out
.
println
(
"Empty command"
);
if
(
exitOnError
)
{
System
.
exit
(-
1
);
}
}
// Analyze current line
error
=
""
;
for
(
Command
c:
commands
)
{
if
(
lineWithNoVariable
.
compareTo
(
c
.
getCommand
())
==
0
)
{
if
(
commandInfo
[
0
]
.
compareTo
(
c
.
getCommand
())
==
0
)
{
error
=
c
.
executeCommand
(
lineWithNoVariable
.
substring
(
c
.
getCommand
().
length
(),
lineWithNoVariable
.
length
()).
trim
(),
this
);
TraceManager
.
addDev
(
"Command executed"
);
break
;
}
if
(
lineWithNoVariable
.
compareTo
(
c
.
getShortCommand
())
==
0
)
{
if
(
commandInfo
[
0
]
.
compareTo
(
c
.
getShortCommand
())
==
0
)
{
error
=
c
.
executeCommand
(
lineWithNoVariable
.
substring
(
c
.
getShortCommand
().
length
(),
lineWithNoVariable
.
length
()).
trim
(),
this
);
TraceManager
.
addDev
(
"Short Command executed"
);
break
;
}
}
if
(
error
!=
null
)
{
if
(
(
error
!=
null
)
&&
(
error
.
length
()
>
0
))
{
System
.
out
.
println
(
"Error in line "
+
cptLine
+
" : "
+
error
);
if
(
exitOnError
)
{
System
.
exit
(-
1
);
}
}
else
if
((
error
!=
null
)
&&
(
error
.
length
()
==
0
))
{
System
.
out
.
println
(
"Unknown command in line "
+
cptLine
+
" : "
+
commandInfo
[
0
]);
}
}
}
...
...
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