Skip to content

Commit

Permalink
add back command_exists
Browse files Browse the repository at this point in the history
  • Loading branch information
dantownsend committed May 13, 2021
1 parent 33b2064 commit d13fbad
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions targ/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,19 @@ class CLI:
description: str = "Targ CLI"
commands: t.List[Command] = field(default_factory=list)

def command_exists(self, group_name: str, command_name: str) -> bool:
"""
This isn't used by Targ itself, but is useful for third party code
which wants to inspect the CLI, so don't remove it.
"""
for command in self.commands:
if (
command.group_name == group_name
and command.command_name == command_name
):
return True
return False

def _validate_name(self, name: str) -> bool:
"""
Any custom names provided by user should not contain spaces (i.e.
Expand Down

0 comments on commit d13fbad

Please sign in to comment.