diff options
Diffstat (limited to 'src/verbs/search.py')
-rw-r--r-- | src/verbs/search.py | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/src/verbs/search.py b/src/verbs/search.py deleted file mode 100644 index 498a88e..0000000 --- a/src/verbs/search.py +++ /dev/null @@ -1,40 +0,0 @@ -import os -import sys -import colors -import util -import shutil - -from verbs.install import find_package, retrieve_package_info -from verbs.sync import sync - -def list_repos(repos, packages_dir, sources): - return [ - f"{repo}/{file}" for repo in repos for file in os.listdir(os.path.join(packages_dir, repo)) - ] - -def search(args, options, config): - if not options["l"]: - sync(args, options, config) - - if len(args) > 0: - packages = list_repos(config["repos"], config["dir"]["packages"], config["sources"]) - for package in args: - - # TODO fuzzy searching here - results = [p for p in packages if package.lower() in p.lower()] - - if len(results) > 0: - print(colors.GREEN + f"Search results for {package}:") - for r in results: - print(colors.LIGHT_GREEN + f"\t{r}") - - print(colors.RESET, end="") - sys.exit(0) - else: - print(colors.RED + f"Package {package} could not be found") - print(colors.RESET, end="") - sys.exit(1) - else: - print(colors.LIGHT_RED + "Nothing to do") - - |