Skip to main content

steel_core/command/brigadier/
mod.rs

1// Brigadier 1.3.10 is licensed under the MIT License:
2//
3// Copyright (c) Microsoft Corporation. All rights reserved.
4//
5// Permission is hereby granted, free of charge, to any person obtaining a copy
6// of this software and associated documentation files (the "Software"), to deal
7// in the Software without restriction, including without limitation the rights
8// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9// copies of the Software, and to permit persons to whom the Software is
10// furnished to do so, subject to the following conditions:
11//
12// The above copyright notice and this permission notice shall be included in all
13// copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21// SOFTWARE.
22
23//! Brigadier-compatible command parsing primitives adapted from Brigadier 1.3.10.
24
25#![cfg_attr(
26    not(test),
27    expect(
28        dead_code,
29        reason = "the complete Brigadier foundation includes primitives not used by current built-ins"
30    )
31)]
32
33mod argument;
34mod builder;
35mod context;
36mod context_chain;
37mod dispatcher;
38mod error;
39mod node;
40mod reader;
41mod runtime;
42mod string_range;
43mod suggestion;
44
45pub(crate) use argument::{
46    ArgumentType, CommandArgumentParser, ContainsPrimitiveArgumentValue, PrimitiveArgumentValue,
47    StringType,
48};
49pub(crate) use builder::{CommandNodeBuilder, CommandRequirementRoute};
50#[cfg_attr(
51    not(test),
52    expect(
53        unused_imports,
54        reason = "generic Brigadier builders remain available for future internal command runtimes"
55    )
56)]
57pub(crate) use builder::{argument, literal};
58#[cfg_attr(
59    not(test),
60    expect(
61        unused_imports,
62        reason = "parsed node metadata is part of the tested Brigadier foundation"
63    )
64)]
65pub(crate) use context::ParsedCommandNode;
66pub(crate) use context::{
67    ArgumentSuggestionContext, CommandContext, ParseError, ParseResults, ParsedCommandContext,
68};
69pub(crate) use context_chain::{ContextChain, ContextChainStage};
70pub(crate) use dispatcher::CommandDispatcher;
71pub(crate) use error::{CommandSyntaxError, CommandSyntaxErrorKind};
72pub(crate) use node::{
73    CommandRedirectTarget, CommandRequirement, NodeId, NodeKind, RegistrationError,
74    RegistrationErrorKind,
75};
76pub(crate) use reader::{ReaderCursor, StringReader};
77pub(crate) use runtime::{BrigadierRuntime, CommandRuntime};
78pub(crate) use string_range::StringRange;
79#[cfg_attr(
80    not(test),
81    expect(
82        unused_imports,
83        reason = "direct suggestion construction is part of the tested Brigadier foundation"
84    )
85)]
86pub(crate) use suggestion::Suggestion;
87pub(crate) use suggestion::{SuggestionError, Suggestions, SuggestionsBuilder};
88
89#[cfg(test)]
90mod tests;