mirror of
https://github.com/yavook/kiwi-scp.git
synced 2024-11-21 20:33:00 +00:00
QoL: Projects default bool conversion (nonempty)
This commit is contained in:
parent
4bd602a245
commit
40e476ba7b
3 changed files with 6 additions and 6 deletions
|
@ -16,6 +16,9 @@ class Projects:
|
|||
in self.__projects
|
||||
])
|
||||
|
||||
def __bool__(self):
|
||||
return bool(self.__projects)
|
||||
|
||||
@classmethod
|
||||
def from_names(cls, project_names):
|
||||
result = cls()
|
||||
|
@ -52,9 +55,6 @@ class Projects:
|
|||
|
||||
return cls()
|
||||
|
||||
def empty(self):
|
||||
return not self.__projects
|
||||
|
||||
def filter_exists(self):
|
||||
result = Projects()
|
||||
result.__projects = [
|
||||
|
|
|
@ -70,7 +70,7 @@ class ProjectCommand(SubCommand):
|
|||
def run(self, runner, args):
|
||||
projects = Projects.from_args(args)
|
||||
|
||||
if not projects.empty():
|
||||
if projects:
|
||||
# project(s) given
|
||||
logging.info(f"{self._action} projects {projects}")
|
||||
return self._run_projects(runner, args, projects)
|
||||
|
|
|
@ -40,12 +40,12 @@ class InspectCommand(ServiceCommand):
|
|||
projects = Projects.from_dir()
|
||||
|
||||
enabled_projects = projects.filter_enabled()
|
||||
if not enabled_projects.empty():
|
||||
if enabled_projects:
|
||||
print(f"Enabled projects:")
|
||||
_print_list(enabled_projects)
|
||||
|
||||
disabled_projects = projects.filter_disabled()
|
||||
if not disabled_projects.empty():
|
||||
if disabled_projects:
|
||||
print(f"Disabled projects:")
|
||||
_print_list(disabled_projects)
|
||||
|
||||
|
|
Loading…
Reference in a new issue