Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
0bca416d
Commit
0bca416d
authored
Dec 23, 2013
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove CLI_APP name if in shell
parent
cc8aa753
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
6 deletions
+20
-6
SpringCli.java
...src/main/java/org/springframework/boot/cli/SpringCli.java
+18
-6
ShellCommand.java
...va/org/springframework/boot/cli/command/ShellCommand.java
+2
-0
No files found.
spring-boot-cli/src/main/java/org/springframework/boot/cli/SpringCli.java
View file @
0bca416d
...
...
@@ -50,6 +50,8 @@ public class SpringCli {
private
List
<
Command
>
commands
;
private
String
displayName
=
CLI_APP
+
" "
;
/**
* Create a new {@link SpringCli} implementation with the default set of commands.
*/
...
...
@@ -117,6 +119,16 @@ public class SpringCli {
return
1
;
}
/**
* The name of this tool when printed by the help command.
*
* @param displayName the displayName to set
*/
public
void
setDisplayName
(
String
displayName
)
{
this
.
displayName
=
displayName
==
null
||
displayName
.
length
()
==
0
||
displayName
.
endsWith
(
" "
)
?
displayName
:
displayName
+
" "
;
}
/**
* Parse the arguments and run a suitable command.
* @param args the arguments
...
...
@@ -148,7 +160,7 @@ public class SpringCli {
}
protected
void
showUsage
()
{
Log
.
infoPrint
(
"usage: "
+
CLI_APP
+
" "
);
Log
.
infoPrint
(
"usage: "
+
this
.
displayName
);
for
(
Command
command
:
this
.
commands
)
{
if
(
command
.
isOptionCommand
())
{
Log
.
infoPrint
(
"[--"
+
command
.
getName
()
+
"] "
);
...
...
@@ -174,8 +186,8 @@ public class SpringCli {
"Print additional status information for the command you are running"
));
Log
.
info
(
""
);
Log
.
info
(
""
);
Log
.
info
(
"See '"
+
CLI_APP
+
"
help <command>' for more information on a specific command."
);
Log
.
info
(
"See '"
+
this
.
displayName
+
"help <command>' for more information on a specific command."
);
}
protected
void
errorMessage
(
String
message
)
{
...
...
@@ -248,12 +260,12 @@ public class SpringCli {
String
commandName
=
args
[
0
];
for
(
Command
command
:
SpringCli
.
this
.
commands
)
{
if
(
command
.
getName
().
equals
(
commandName
))
{
Log
.
info
(
CLI_APP
+
" "
+
command
.
getName
()
+
" - "
Log
.
info
(
SpringCli
.
this
.
displayName
+
command
.
getName
()
+
" - "
+
command
.
getDescription
());
Log
.
info
(
""
);
if
(
command
.
getUsageHelp
()
!=
null
)
{
Log
.
info
(
"usage: "
+
CLI_APP
+
" "
+
command
.
getName
()
+
" "
+
command
.
getUsageHelp
());
Log
.
info
(
"usage: "
+
SpringCli
.
this
.
displayName
+
command
.
get
Name
()
+
" "
+
command
.
get
UsageHelp
());
Log
.
info
(
""
);
}
if
(
command
.
getHelp
()
!=
null
)
{
...
...
spring-boot-cli/src/main/java/org/springframework/boot/cli/command/ShellCommand.java
View file @
0bca416d
...
...
@@ -35,6 +35,8 @@ public class ShellCommand extends AbstractCommand {
@Override
public
void
run
(
String
...
args
)
throws
Exception
{
this
.
springCli
.
setDisplayName
(
""
);
final
ConsoleReader
console
=
new
ConsoleReader
();
console
.
addCompleter
(
new
CommandCompleter
(
console
,
this
.
springCli
));
console
.
setHistoryEnabled
(
true
);
...
...
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