Re-add 'app fetchlist', 'app list -i', 'app list' filter for backward compatibility...

This commit is contained in:
Alexandre Aubin 2020-04-26 03:43:05 +02:00
parent 54cc684a35
commit 69938c3feb
2 changed files with 32 additions and 1 deletions

View file

@ -563,6 +563,9 @@ app:
help: Also return a list of app categories help: Also return a list of app categories
action: store_true action: store_true
fetchlist:
deprecated: true
### app_list() ### app_list()
list: list:
action_help: List installed apps action_help: List installed apps
@ -572,6 +575,12 @@ app:
full: --full full: --full
help: Display all details, including the app manifest and various other infos help: Display all details, including the app manifest and various other infos
action: store_true action: store_true
-i:
full: --installed
help: Dummy argument, does nothing anymore (still there only for backward compatibility)
action: store_true
filter:
nargs: '?'
### app_info() ### app_info()
info: info:

View file

@ -110,12 +110,34 @@ def app_catalog(full=False, with_categories=False):
return {"apps": catalog["apps"], "categories": catalog["categories"]} return {"apps": catalog["apps"], "categories": catalog["categories"]}
def app_list(full=False):
# Old legacy function...
def app_fetchlist():
logger.warning("'yunohost app fetchlist' is deprecated. Please use 'yunohost tools update --apps' instead")
from yunohost.tools import tools_update
tools_update(apps=True)
def app_list(full=False, installed=False, filter=None):
""" """
List installed apps List installed apps
""" """
# Old legacy argument ... app_list was a combination of app_list and
# app_catalog before 3.8 ...
if installed:
logger.warning("Argument --installed ain't needed anymore when using 'yunohost app list'. It directly returns the list of installed apps..")
# Filter is a deprecated option...
if filter:
logger.warning("Using -f $appname in 'yunohost app list' is deprecated. Just use 'yunohost app list | grep -q 'id: $appname' to check a specific app is installed")
out = [] out = []
for app_id in sorted(_installed_apps()): for app_id in sorted(_installed_apps()):
if filter and not app_id.startswith(filter):
continue
try: try:
app_info_dict = app_info(app_id, full=full) app_info_dict = app_info(app_id, full=full)
except Exception as e: except Exception as e: