diff --git a/action_map.yml b/action_map.yml index a8957a42..a76c56e3 100644 --- a/action_map.yml +++ b/action_map.yml @@ -220,6 +220,10 @@ app: help: Name of the list (default fapp) pattern: '^[a-z0-9_]+$' + ### app_listlists() + listlists: + action_help: List fetched lists + ### app_list() list: action_help: List apps diff --git a/yunohost_app.py b/yunohost_app.py index a7807e43..70744b5a 100644 --- a/yunohost_app.py +++ b/yunohost_app.py @@ -4,7 +4,6 @@ import os import sys import json import shutil -from urllib import urlopen, urlretrieve from yunohost import YunoHostError, YunoHostLDAP, win_msg, random_password from yunohost_domain import domain_list, domain_add @@ -40,8 +39,23 @@ def app_fetchlist(url=None, name=None): win_msg(_("List successfully fetched")) -def app_listlist(): - pass +def app_listlists(): + """ + List fetched lists + + Returns: + Dict of lists + + """ + list_list = [] + try: + for filename in os.listdir(repo_path): + if '.json' in filename: + list_list.append(filename[:len(filename)-5]) + except OSError: + raise YunoHostError(1, _("No list found")) + + return { 'Lists' : list_list } def app_list(offset=None, limit=None, filter=None, raw=False):