Refactor external command (#6083)

Co-authored-by: Frank <v-frankz@microsoft.com>
This commit is contained in:
Kangaxx-0
2022-07-21 16:56:57 -07:00
committed by GitHub
parent 0bcfa12e0d
commit 0646f1118c
7 changed files with 60 additions and 24 deletions

View File

@ -37,6 +37,16 @@ pub trait Command: Send + Sync + CommandClone {
false
}
// This is an enhanced method to determine if a command is custom command or not
// since extern "foo" [] and def "foo" [] behaves differently
fn is_custom_command(&self) -> bool {
if self.get_block_id().is_some() {
true
} else {
self.is_known_external()
}
}
// Is a sub command
fn is_sub(&self) -> bool {
self.name().contains(' ')