Skip to content

Commit

Permalink
Changing how the list of profiles is acquired
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Ferraz committed Feb 9, 2016
1 parent 514f11d commit 65f5266
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions iprofile/cli/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ class List(ICommand):

def run(self, **options):
try:
profiles = filter(
lambda x: os.path.isdir('{0}/{1}'.format(self.project_path, x))
and 'ipython_config.py' in os.listdir('{0}/{1}'.format(
self.project_path, x)), os.listdir('iprofiles'))
profiles = [
x for x in os.listdir('iprofiles')
if os.path.isdir(self.format(x)) and
'ipython_config.py' in os.listdir(self.format(x))
]

if len(profiles) == 0:
self.no_profiles()
Expand All @@ -43,3 +44,6 @@ def run(self, **options):

def no_profiles(self):
self.red(texts.ERROR_NO_PROFILES_TO_LIST)

def format(self, x):
return '{0}/{1}'.format(self.project_path, x)

0 comments on commit 65f5266

Please sign in to comment.