Collapse some help commands columns into a single column (#7052)

This commit is contained in:
Dan Davison
2022-11-09 20:44:32 -05:00
committed by GitHub
parent 24d72ca43c
commit fe14e52e77
2 changed files with 30 additions and 30 deletions

View File

@ -4,6 +4,15 @@ use crate::{ast::Call, BlockId, Example, PipelineData, ShellError, Signature};
use super::{EngineState, Stack};
#[derive(Debug)]
pub enum CommandType {
Builtin,
Custom,
Keyword,
Plugin,
Other,
}
pub trait Command: Send + Sync + CommandClone {
fn name(&self) -> &str;
@ -71,6 +80,21 @@ pub trait Command: Send + Sync + CommandClone {
fn search_terms(&self) -> Vec<&str> {
vec![]
}
fn command_type(&self) -> CommandType {
match (
self.is_builtin(),
self.is_custom_command(),
self.is_parser_keyword(),
self.is_plugin().is_some(),
) {
(true, false, false, false) => CommandType::Builtin,
(false, true, false, false) => CommandType::Custom,
(_, false, true, false) => CommandType::Keyword,
(false, false, false, true) => CommandType::Plugin,
_ => CommandType::Other,
}
}
}
pub trait CommandClone {