use crate::control::Reasoner;
use nar_dev_utils::macro_once;
pub fn hlp_dispatch(_reasoner: &mut Reasoner, query: impl AsRef<str>) -> Result<String, String> {
macro_once! {
macro ( $( $query:literal => $message:expr )* ) => {
const ALL_QUERIES_LIST: &str = concat!($( "\n- ", $query, )*);
match query.as_ref() {
"" => Ok(format!("Available help queries: {ALL_QUERIES_LIST}")),
$( $query => Ok($message.to_string()), )*
other => return Err(format!("Unknown help query: {other:?}\nAvailable help queries: {ALL_QUERIES_LIST}")),
}
}
"inf" => CMD_INF "examples" => EXAMPLES_CMD }
}
const CMD_INF: &str = "# cmd `INF`
- Format: `INF <qualifier><target>`
- qualifiers:
- `#`: Detailed info
- targets:
- `tasks`: Tasks in reasoner, or derivation chain on detailed mode
- `concepts`: Concepts in memory
- `links`: Task-links and term-links in each concepts
- `parameters`: View reasoner parameters
- `beliefs`: Beliefs in memory
- `questions`: Questions in memory
- `summary`: The summary of status of reasoner, no detailed mode yet
";
const EXAMPLES_CMD: &str = "# NAVM Cmd examples
## Inputting narseses, tuning the volume, running cycles and querying information
```navm-cmd
NSE <A --> B>.
NSE <A --> C>.
VOL 99
CYC 10
INF tasks
```
## Comments
```navm-cmd
REM This is a comment, it will be ignored
REM For multi-line comments, use `REM` to start each line
```
## Getting help
```navm-cmd
HLP
```
";