Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
ProB 2 Jupyter Kernel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
general
stups
ProB 2 Jupyter Kernel
Commits
4f979d87
Commit
4f979d87
authored
May 29, 2018
by
dgelessus
Browse files
Options
Downloads
Patches
Plain Diff
Support Markdown output in :help
parent
9cfcf2fb
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/de/prob2/jupyter/commands/HelpCommand.java
+12
-2
12 additions, 2 deletions
src/main/java/de/prob2/jupyter/commands/HelpCommand.java
with
12 additions
and
2 deletions
src/main/java/de/prob2/jupyter/commands/HelpCommand.java
+
12
−
2
View file @
4f979d87
...
@@ -33,13 +33,21 @@ public final class HelpCommand implements Command {
...
@@ -33,13 +33,21 @@ public final class HelpCommand implements Command {
final
List
<
String
>
args
=
CommandUtils
.
splitArgs
(
argString
);
final
List
<
String
>
args
=
CommandUtils
.
splitArgs
(
argString
);
if
(
args
.
isEmpty
())
{
if
(
args
.
isEmpty
())
{
final
StringBuilder
sb
=
new
StringBuilder
(
"Type a valid B expression, or one of the following commands:\n"
);
final
StringBuilder
sb
=
new
StringBuilder
(
"Type a valid B expression, or one of the following commands:\n"
);
final
StringBuilder
sbMarkdown
=
new
StringBuilder
(
"Type a valid B expression, or one of the following commands:\n\n"
);
new
TreeMap
<>(
kernel
.
getCommands
()).
forEach
((
commandName
,
command
)
->
{
new
TreeMap
<>(
kernel
.
getCommands
()).
forEach
((
commandName
,
command
)
->
{
sb
.
append
(
commandName
);
sb
.
append
(
commandName
);
sb
.
append
(
' '
);
sb
.
append
(
' '
);
sb
.
append
(
command
.
getShortHelp
());
sb
.
append
(
command
.
getShortHelp
());
sb
.
append
(
'\n'
);
sb
.
append
(
'\n'
);
sbMarkdown
.
append
(
"* `"
);
sbMarkdown
.
append
(
commandName
);
sbMarkdown
.
append
(
"` "
);
sbMarkdown
.
append
(
command
.
getShortHelp
());
sbMarkdown
.
append
(
'\n'
);
});
});
return
new
DisplayData
(
sb
.
toString
());
final
DisplayData
result
=
new
DisplayData
(
sb
.
toString
());
result
.
putMarkdown
(
sbMarkdown
.
toString
());
return
result
;
}
else
if
(
args
.
size
()
==
1
)
{
}
else
if
(
args
.
size
()
==
1
)
{
String
commandName
=
args
.
get
(
0
);
String
commandName
=
args
.
get
(
0
);
// If the user entered a command name without colons, add one or two colons as appropriate.
// If the user entered a command name without colons, add one or two colons as appropriate.
...
@@ -56,7 +64,9 @@ public final class HelpCommand implements Command {
...
@@ -56,7 +64,9 @@ public final class HelpCommand implements Command {
if
(
command
==
null
)
{
if
(
command
==
null
)
{
throw
new
UserErrorException
(
String
.
format
(
"Cannot display help for unknown command \"%s\""
,
commandName
));
throw
new
UserErrorException
(
String
.
format
(
"Cannot display help for unknown command \"%s\""
,
commandName
));
}
}
return
new
DisplayData
(
command
.
getSyntax
()
+
"\n\n"
+
command
.
getShortHelp
());
final
DisplayData
result
=
new
DisplayData
(
command
.
getSyntax
()
+
"\n\n"
+
command
.
getShortHelp
());
result
.
putMarkdown
(
"```\n"
+
command
.
getSyntax
()
+
"\n```\n\n"
+
command
.
getShortHelp
());
return
result
;
}
else
{
}
else
{
throw
new
UserErrorException
(
"Expected at most 1 argument, got "
+
args
.
size
());
throw
new
UserErrorException
(
"Expected at most 1 argument, got "
+
args
.
size
());
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment