Insert explicit ids for headers

This commit is contained in:
Rob Winch
2023-08-03 11:11:12 -05:00
parent 9b5ed3a9eb
commit f846e7ea07
17 changed files with 35 additions and 1 deletions

View File

@@ -1,3 +1,4 @@
[[command-catalog]]
=== Command Catalog === Command Catalog
The `CommandCatalog` interface defines how command registrations exist in The `CommandCatalog` interface defines how command registrations exist in
a shell application. It is possible to dynamically register and de-register a shell application. It is possible to dynamically register and de-register
@@ -11,6 +12,7 @@ include::{snippets}/CommandCatalogSnippets.java[tag=snippet1]
---- ----
==== ====
[[command-resolver]]
==== Command Resolver ==== Command Resolver
You can implement the `CommandResolver` interface and define a bean to dynamically You can implement the `CommandResolver` interface and define a bean to dynamically
resolve mappings from a command's name to its `CommandRegistration` instances. Consider resolve mappings from a command's name to its `CommandRegistration` instances. Consider
@@ -27,6 +29,7 @@ IMPORTANT: A current limitation of a `CommandResolver` is that it is used every
Thus, we advise not using it if a command resolution call takes a long time, as it would Thus, we advise not using it if a command resolution call takes a long time, as it would
make the shell feel sluggish. make the shell feel sluggish.
[[command-catalog-customizer]]
==== Command Catalog Customizer ==== Command Catalog Customizer
You can use the `CommandCatalogCustomizer` interface to customize a `CommandCatalog`. You can use the `CommandCatalogCustomizer` interface to customize a `CommandCatalog`.
Its main use is to modify a catalog. Also, within `spring-shell` auto-configuration, this Its main use is to modify a catalog. Also, within `spring-shell` auto-configuration, this

View File

@@ -1,3 +1,4 @@
[[command-context]]
=== Command Context === Command Context
The `CommandContext` interface gives access to a currently running The `CommandContext` interface gives access to a currently running
context. You can use it to get access to options: context. You can use it to get access to options:

View File

@@ -1,3 +1,4 @@
[[command-execution]]
=== Command Execution === Command Execution
When command parsing has done its job and command registration has been resolved, command execution When command parsing has done its job and command registration has been resolved, command execution
does the hard work of running the code. does the hard work of running the code.

View File

@@ -1,3 +1,4 @@
[[command-parser]]
=== Command Parser === Command Parser
Before a command can be executed, we need to parse the command and whatever options the user may have provided. Parsing Before a command can be executed, we need to parse the command and whatever options the user may have provided. Parsing
comes between command registration and command execution. comes between command registration and command execution.

View File

@@ -6,6 +6,7 @@ Defining a command registration is a first step to introducing the structure of
and parameters. This is loosely decoupled from what happens later, such as parsing command-line input and running and parameters. This is loosely decoupled from what happens later, such as parsing command-line input and running
actual target code. Essentially, it is the definition of a command API that is shown to a user. actual target code. Essentially, it is the definition of a command API that is shown to a user.
[[commands]]
==== Commands ==== Commands
A command in a `spring-shell` structure is defined as an array of commands. This yields a A command in a `spring-shell` structure is defined as an array of commands. This yields a
structure similar to the following example: structure similar to the following example:
@@ -23,6 +24,7 @@ command2 sub2 subsub2
NOTE: We do not currently support mapping commands to an explicit parent if sub-commands are defined. NOTE: We do not currently support mapping commands to an explicit parent if sub-commands are defined.
For example, `command1 sub1` and `command1 sub1 subsub1` cannot both be registered. For example, `command1 sub1` and `command1 sub1 subsub1` cannot both be registered.
[[interaction-mode]]
==== Interaction Mode ==== Interaction Mode
Spring Shell has been designed to work on two modes: interactive (which essentially Spring Shell has been designed to work on two modes: interactive (which essentially
is a `REPL` where you have an active shell instance throughout a series of commands) and is a `REPL` where you have an active shell instance throughout a series of commands) and
@@ -36,6 +38,7 @@ dictates the available information.
Also, being on an active `REPL` session may provide more information about what the user has been Also, being on an active `REPL` session may provide more information about what the user has been
doing within an active session. doing within an active session.
[[options]]
==== Options ==== Options
Options can be defined as long and short, where the prefixing is `--` and `-`, respectively. Options can be defined as long and short, where the prefixing is `--` and `-`, respectively.
The following examples show long and short options: The following examples show long and short options:
@@ -54,10 +57,12 @@ include::{snippets}/CommandRegistrationSnippets.java[tag=snippet2]
---- ----
==== ====
[[target]]
==== Target ==== Target
The target defines the execution target of a command. It can be a method in a POJO, The target defines the execution target of a command. It can be a method in a POJO,
a `Consumer`, or a `Function`. a `Consumer`, or a `Function`.
[[method]]
===== Method ===== Method
Using a `Method` in an existing POJO is one way to define a target. Using a `Method` in an existing POJO is one way to define a target.
Consider the following class: Consider the following class:
@@ -78,6 +83,7 @@ include::{snippets}/CommandTargetSnippets.java[tag=snippet12]
---- ----
==== ====
[[function]]
===== Function ===== Function
Using a `Function` as a target gives a lot of flexibility to handle what Using a `Function` as a target gives a lot of flexibility to handle what
happens in a command execution, because you can handle many things manually by using happens in a command execution, because you can handle many things manually by using
@@ -91,6 +97,7 @@ include::{snippets}/CommandTargetSnippets.java[tag=snippet2]
---- ----
==== ====
[[consumer]]
===== Consumer ===== Consumer
Using a `Consumer` is basically the same as using a `Function`, with the difference being Using a `Consumer` is basically the same as using a `Function`, with the difference being
that there is no return type. If you need to print something into a shell, that there is no return type. If you need to print something into a shell,

View File

@@ -8,6 +8,7 @@ contains info about match positions and overall score of a match.
https://github.com/junegunn/fzf[fzf]. https://github.com/junegunn/fzf[fzf].
[[implementations]]
==== Implementations ==== Implementations
*FuzzyMatchV2Search* *FuzzyMatchV2Search*
@@ -20,6 +21,7 @@ quickly finding paths.
Port of _fzf ExactMatchNaive_ algorithm. Simple exact match works more accurately Port of _fzf ExactMatchNaive_ algorithm. Simple exact match works more accurately
if you know what to search. if you know what to search.
[[searchmatch]]
==== SearchMatch ==== SearchMatch
Algorithms and default syntax are hidden inside package protected classes Algorithms and default syntax are hidden inside package protected classes
@@ -55,6 +57,7 @@ below table.
|Items that include `stuff` |Items that include `stuff`
|=== |===
[[examples]]
==== Examples ==== Examples
==== ====

View File

@@ -7,6 +7,7 @@ In this section we discuss how this application works. It can be considered to b
a reference application as it's using most of the features available and tries a reference application as it's using most of the features available and tries
to follow best practices. to follow best practices.
[[create-scenario]]
==== Create Scenario ==== Create Scenario
Every `Scenario` essentially is a sample code of a `View` as that's what catalog Every `Scenario` essentially is a sample code of a `View` as that's what catalog
app demonstrates. app demonstrates.

View File

@@ -1,3 +1,4 @@
[[getting-started]]
== Getting Started == Getting Started
To see what Spring Shell has to offer, we can write a trivial _hello world_ To see what Spring Shell has to offer, we can write a trivial _hello world_
shell application that has a simple argument. shell application that has a simple argument.
@@ -5,6 +6,7 @@ shell application that has a simple argument.
IMPORTANT: _Spring Shell_ is based on _Spring Boot_ {spring-boot-version} and IMPORTANT: _Spring Shell_ is based on _Spring Boot_ {spring-boot-version} and
_Spring Framework_ {spring-version} and thus requires _JDK 17_. _Spring Framework_ {spring-version} and thus requires _JDK 17_.
[[creating-a-project]]
=== Creating a Project === Creating a Project
For the purpose of this tutorial, we create a simple Spring Boot application by For the purpose of this tutorial, we create a simple Spring Boot application by

View File

@@ -1,3 +1,4 @@
[[spring-shell-reference-documentation]]
= Spring Shell Reference Documentation = Spring Shell Reference Documentation
Eric Bottard; Janne Valkealahti; Jay Bryant; Corneil du Plessis Eric Bottard; Janne Valkealahti; Jay Bryant; Corneil du Plessis
:doctype: book :doctype: book

View File

@@ -1,3 +1,4 @@
[[what-is-spring-shell?]]
== What is Spring Shell? == What is Spring Shell?
Not all applications need a fancy web user interface. Not all applications need a fancy web user interface.
Sometimes, interacting with an application through an interactive terminal is Sometimes, interacting with an application through an interactive terminal is

View File

@@ -15,4 +15,4 @@ The programmatic model is how things are actually registered, even if you use an
NOTE: Currently whole documentation structure is in transit to provide better NOTE: Currently whole documentation structure is in transit to provide better
structure how things can be used using different ways to provide configurations. structure how things can be used using different ways to provide configurations.
So pardon a for little confusion now and there during a transit. So pardon a for little confusion now and there during a transit.

View File

@@ -52,6 +52,7 @@ include::{snippets}/ErrorHandlingSnippets.java[tag=exception-resolver-with-void]
---- ----
==== ====
[[method-arguments]]
===== Method Arguments ===== Method Arguments
`@ExceptionResolver` methods support the following arguments: `@ExceptionResolver` methods support the following arguments:
@@ -67,6 +68,7 @@ include::{snippets}/ErrorHandlingSnippets.java[tag=exception-resolver-with-void]
|=== |===
[[return-values]]
===== Return Values ===== Return Values
`@ExceptionResolver` methods support the following return values: `@ExceptionResolver` methods support the following return values:

View File

@@ -1,3 +1,4 @@
[[registration]]
=== Registration === Registration
ifndef::snippets[:snippets: ../../test/java/org/springframework/shell/docs] ifndef::snippets[:snippets: ../../test/java/org/springframework/shell/docs]

View File

@@ -1,3 +1,4 @@
[[writing]]
=== Writing === Writing
ifndef::snippets[:snippets: ../../test/java/org/springframework/shell/docs] ifndef::snippets[:snippets: ../../test/java/org/springframework/shell/docs]

View File

@@ -1,3 +1,4 @@
[[commands]]
== Commands == Commands
ifndef::snippets[:snippets: ../../test/java/org/springframework/shell/docs] ifndef::snippets[:snippets: ../../test/java/org/springframework/shell/docs]

View File

@@ -1,3 +1,4 @@
[[completion]]
== Completion == Completion
ifndef::snippets[:snippets: ../../test/java/org/springframework/shell/docs] ifndef::snippets[:snippets: ../../test/java/org/springframework/shell/docs]
@@ -8,6 +9,7 @@ easier to provide more programmatic ways to provide completion hints.
When shell is purely run as a command-line tool a completion can only When shell is purely run as a command-line tool a completion can only
be accomplished with integration into OS level shell's like _bash_. be accomplished with integration into OS level shell's like _bash_.
[[interactive]]
=== Interactive === Interactive
Hints for completions are calculated with _function_ or _interface_ style Hints for completions are calculated with _function_ or _interface_ style
@@ -58,6 +60,7 @@ include::{snippets}/CompletionSnippets.java[tag=anno-method]
---- ----
==== ====
[[command-line]]
=== Command-Line === Command-Line
Command-line completion currently only support _bash_ and is documented Command-line completion currently only support _bash_ and is documented

View File

@@ -4,6 +4,7 @@ ifndef::snippets[:snippets: ../../test/java/org/springframework/shell/docs]
This section talks about how particular data type is used as an option value. This section talks about how particular data type is used as an option value.
[[string]]
==== String ==== String
`String` is a most simplest type as there's no conversion involved as what's `String` is a most simplest type as there's no conversion involved as what's
@@ -26,6 +27,7 @@ include::{snippets}/OptionTypesSnippets.java[tag=option-type-string-reg]
---- ----
==== ====
[[boolean]]
==== Boolean ==== Boolean
Using boolean types is a bit more involved as there are `boolean` and Using boolean types is a bit more involved as there are `boolean` and
@@ -74,6 +76,7 @@ arg1=false arg2=true arg3=false arg4=false arg5=true arg6=false
---- ----
==== ====
[[number]]
==== Number ==== Number
Numbers are converted as is. Numbers are converted as is.
@@ -92,6 +95,7 @@ include::{snippets}/OptionTypesSnippets.java[tag=option-type-integer-reg]
---- ----
==== ====
[[enum]]
==== Enum ==== Enum
Conversion to enums is possible if given value is exactly matching enum itself. Conversion to enums is possible if given value is exactly matching enum itself.
@@ -118,6 +122,7 @@ include::{snippets}/OptionTypesSnippets.java[tag=option-type-enum-reg]
---- ----
==== ====
[[array]]
==== Array ==== Array
Arrays can be used as is with strings and primitive types. Arrays can be used as is with strings and primitive types.