From 2359ffe9220972bafcd8b8ea3ecfc61ceac30170 Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Thu, 3 Aug 2023 00:29:11 +0300 Subject: [PATCH] search in libraries menu --- src/fw_libraries.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/fw_libraries.py b/src/fw_libraries.py index 4fb313f..308f1ed 100644 --- a/src/fw_libraries.py +++ b/src/fw_libraries.py @@ -7,13 +7,13 @@ fzf = FzfPrompt() @logger.catch -def libraries(pg=None, radio=False): - libs_res = list_libraries(pg=pg) +def libraries(pg=None, radio=False, search=None): + libs_res = list_libraries(pg=pg, q=search) libs_count = libs_res.get('count') libs_next = libs_res.get('next') libs_prev = libs_res.get('previous') libs = libs_res.get('results') - libraries_listing = [] + libraries_listing = ['Search'] if libs_next: libraries_listing.append('Next') if libs_prev: @@ -37,9 +37,12 @@ def libraries(pg=None, radio=False): lib_select = lib_select[0].split('.', 1) if lib_select[0] == 'Next': - return libraries(pg=libs_next) + return libraries(pg=libs_next, search=search) elif lib_select[0] == 'Prev': - return libraries(pg=libs_prev) + return libraries(pg=libs_prev, search=search) + elif lib_select[0] == 'Search': + q = input('Name of library:\n') + return libraries(search=q) elif lib_select[0] == 'Add remote library': print('Search a remote library (url\\fid):') new_library = federate_remote_library(input().strip())