Merge pull request #540 from dylanmtaylor/description
Add a description to top-level profile listing
This commit is contained in:
commit
bedc5cd132
|
|
@ -228,6 +228,18 @@ class Profile(Script):
|
||||||
# since developers like less code - omitting it should assume they want to present it.
|
# since developers like less code - omitting it should assume they want to present it.
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def get_profile_description(self):
|
||||||
|
with open(self.path, 'r') as source:
|
||||||
|
source_data = source.read()
|
||||||
|
|
||||||
|
if '__description__' in source_data:
|
||||||
|
with self.load_instructions(namespace=f"{self.namespace}.py") as imported:
|
||||||
|
if hasattr(imported, '__description__'):
|
||||||
|
return imported.__description__
|
||||||
|
|
||||||
|
# Default to this string if the profile does not have a description.
|
||||||
|
return "This profile does not have the __description__ attribute set."
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def packages(self) -> Optional[list]:
|
def packages(self) -> Optional[list]:
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -575,11 +575,11 @@ def select_profile():
|
||||||
|
|
||||||
if len(shown_profiles) >= 1:
|
if len(shown_profiles) >= 1:
|
||||||
for index, profile in enumerate(shown_profiles):
|
for index, profile in enumerate(shown_profiles):
|
||||||
print(f"{index}: {profile}")
|
description = Profile(None, profile).get_profile_description()
|
||||||
|
print(f"{index}: {profile}: {description}")
|
||||||
|
|
||||||
print(' -- The above list is a set of pre-programmed profiles. --')
|
print(' -- The above list is a set of pre-programmed profiles. --')
|
||||||
print(' -- They might make it easier to install things like desktop environments. --')
|
print(' -- They might make it easier to install things like desktop environments. --')
|
||||||
print(' -- The desktop profile will let you select a DE/WM profile, e.g gnome, kde, sway --')
|
|
||||||
print(' -- (Leave blank and hit enter to skip this step and continue) --')
|
print(' -- (Leave blank and hit enter to skip this step and continue) --')
|
||||||
|
|
||||||
selected_profile = generic_select(actual_profiles_raw, 'Enter a pre-programmed profile name if you want to install one: ', options_output=False)
|
selected_profile = generic_select(actual_profiles_raw, 'Enter a pre-programmed profile name if you want to install one: ', options_output=False)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue