diff --git a/docs/core/index.md b/docs/core/index.md index fbecdcd..e29fdcf 100644 --- a/docs/core/index.md +++ b/docs/core/index.md @@ -10,6 +10,7 @@ Cloud is available through [Maven Central](https://search.maven.org/search?q=clo === "Maven" + ```xml cloud.commandframework @@ -17,11 +18,15 @@ Cloud is available through [Maven Central](https://search.maven.org/search?q=clo dCLOUD_BASE_VERSIONd ``` + === "Gradle (Kotlin)" + ```kotlin implementation("cloud.commandframework:cloud-core:dCLOUD_BASE_VERSIONd") ``` + === "Gradle (Groovy)" + ```groovy implementation 'cloud.commandframework:cloud-core:dCLOUD_BASE_VERSIONd' ``` @@ -81,6 +86,8 @@ Cloud ships with two different command execution coordinators: - **AsynchronousCommandExecutionCoordinator**: Uses an executor to dispatch the parsing and execution tasks. You can change the default executor, and also force command parsing to take place on the calling thread. +You may also create your own execution coordinator by implementing `CommandExecutionCoordinator`. + ### Building a command #### Descriptions @@ -152,13 +159,12 @@ The message registered for the caption will have those variables replaced with v to be thrown. -!!! example - Example caption registry usage +!!! example annotate "Example caption registry usage" ```java final CaptionRegistry registry = manager.captionRegistry(); - if (registry instanceof FactoryDelegatingCaptionRegistry) { - final FactoryDelegatingCaptionRegistry factoryRegistry = (FactoryDelegatingCaptionRegistry) - manager.captionRegistry(); + if (registry instanceof FactoryDelegatingCaptionRegistry) /* (1)! */ { + final FactoryDelegatingCaptionRegistry factoryRegistry = + (FactoryDelegatingCaptionRegistry) manager.captionRegistry(); factoryRegistry.registerMessageFactroy( StandardCaptionKeys.ARGUMENT_PARSE_FAILURE_BOOLEAN, (context, key) -> "'{input}' ain't a boolean >:(" @@ -166,6 +172,8 @@ to be thrown. } ``` +1. Some platforms may opt to use a different caption registry implementation that does not delegate to factories. + ## Parsers ### Parser Registry @@ -263,8 +271,7 @@ You can chain the aliases of multiple presence flags together, such that `-a -b The flag values are contained in `FlagContext` which can be retrieved using `CommandContext.flags()`. -!!! example - Example of a command with a presence flag. +!!! example "Example of a command with a presence flag" ```java manager.commandBuilder("command") .flag(manager.flagBuilder("flag").withAliases("f")) @@ -283,7 +290,7 @@ You may either implement the `AggregateCommandParser` interface, or using constr that you create by calling `AggregateCommandParser.builder()`. -!!! example +!!! example "Example Aggregate Parser" ```java final AggregateCommandParser locationParser = AggregateCommandParser.builder() .withComponent("world", worldParser()) @@ -351,9 +358,9 @@ exceptionally completed future. Returning a future is useful when the parsing needs to take place on a specific thread. -!!! example +!!! example annotate "Example Parser" ```java - public class UUIDParser implements ArgumentParser { + public class UUIDParser implements ArgumentParser { @Override public ArgumentParseResult parse( @@ -372,6 +379,8 @@ Returning a future is useful when the parsing needs to take place on a specific } ``` +1. The command sender type. + #### Exceptions It is recommended to make use of `ParserException` when returning a failed result. diff --git a/docs/index.md b/docs/index.md index 1946ba1..2ebbbf6 100644 --- a/docs/index.md +++ b/docs/index.md @@ -32,13 +32,16 @@ Development builds of Cloud are available on the Sonatype Snapshots Repository: === "Maven" + ```xml sonatype-snapshots https://oss.sonatype.org/content/repositories/snapshots/ ``` + === "Gradle (Kotlin)" + ```kotlin maven("https://oss.sonatype.org/content/repositories/snapshots/") { name = "sonatype-snapshots" @@ -47,7 +50,9 @@ Development builds of Cloud are available on the Sonatype Snapshots Repository: } } ``` + === "Gradle (Groovy)" + ```groovy maven { url "https://oss.sonatype.org/content/repositories/snapshots/" diff --git a/docs/requirements.txt b/docs/requirements.txt index e8709c7..54227f7 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,3 +1,4 @@ mkdocs mkdocs-material -mkdocs-placeholder-plugin \ No newline at end of file +mkdocs-placeholder-plugin +mkdocs-git-revision-date-localized-plugin diff --git a/mkdocs.yml b/mkdocs.yml index 7ca411e..873513a 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -3,6 +3,7 @@ site_name: Cloud v2 site_url: https://cloud.incendo.org/ repo_url: https://github.com/incendo/cloud-docs repo_name: cloud-docs +edit_uri: edit/main/docs/ nav: - Cloud: - Cloud: index.md @@ -47,6 +48,11 @@ theme: - search.suggest - search.highlight - search.share + - content.action.edit + - content.action.view + - content.code.copy + - content.code.annotate + - content.tabs.link palette: - media: "(prefers-color-scheme: light)" scheme: default @@ -73,14 +79,19 @@ markdown_extensions: - pymdownx.superfences - pymdownx.tabbed: alternate_style: true + - attr_list + - md_in_html plugins: - search - placeholder -extra: - consent: - title: Cookie consent - description: >- - We use cookies to recognize your repeated visits and preferences, as well - as to measure the effectiveness of our documentation and whether users - find what they're searching for. With your consent, you're helping us to - make our documentation better. + - git-revision-date-localized: + enable_creation_date: false + fallback_to_build_date: true +#extra: +# consent: +# title: Cookie consent +# description: >- +# We use cookies to recognize your repeated visits and preferences, as well +# as to measure the effectiveness of our documentation and whether users +# find what they're searching for. With your consent, you're helping us to +# make our documentation better.