commands: clearly define how arguments are counted in request error

This commit is contained in:
2025-12-08 16:25:04 +09:00
parent aece730634
commit 2bb9341863

View File

@@ -60,7 +60,11 @@ where
/// The minimum number of arguments this command takes
const MIN_ARGS: u32;
/// The maximum number of arguments this command takes
/// The maximum number of arguments this command takes.
///
/// Note that in the case of keyworded arguments, such as
/// `group <groupname>`, `sort <sorting>`, etc., these are
/// counted as a single argument despite being two tokens.
const MAX_ARGS: Option<u32>;
/// Helper function to create a [`RequestParserError::TooManyArguments`] error
@@ -555,6 +559,10 @@ pub enum RequestParserError {
)]
SubtypeParserError {
/// The index of the argument that failed to parse
///
/// Note that in the case of keyworded arguments, such as
/// `group <groupname>`, `sort <sorting>`, etc., these are
/// counted as a single argument despite being two tokens.
argument_index: u32,
/// The expected type of the argument
@@ -577,6 +585,10 @@ pub enum RequestParserError {
expected_max: Option<u32>,
/// The number of arguments that were found
///
/// Note that in the case of keyworded arguments, such as
/// `group <groupname>`, `sort <sorting>`, etc., these are
/// counted as a single argument despite being two tokens.
found: u32,
},
@@ -593,6 +605,10 @@ pub enum RequestParserError {
expected_max: Option<u32>,
/// The number of arguments that were found
///
/// Note that in the case of keyworded arguments, such as
/// `group <groupname>`, `sort <sorting>`, etc., these are
/// counted as a single argument despite being two tokens.
found: u32,
},