This repository has been archived by the owner on Jan 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
74 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# built-in | ||
from argparse import ArgumentParser, REMAINDER | ||
|
||
# app | ||
from ..config import builders | ||
from ..repositories import WareHouseRepo | ||
from .base import BaseCommand | ||
|
||
|
||
class PackageSearchCommand(BaseCommand): | ||
@classmethod | ||
def get_parser(cls): | ||
parser = ArgumentParser( | ||
prog='dephell package search', | ||
description='Search package on PyPI.org', | ||
) | ||
builders.build_config(parser) | ||
builders.build_output(parser) | ||
builders.build_api(parser) | ||
builders.build_other(parser) | ||
parser.add_argument('name', nargs=REMAINDER, help='package name or other search keywords') | ||
return parser | ||
|
||
def __call__(self): | ||
repo = WareHouseRepo() | ||
results = repo.search(self.args.name) | ||
print(self.get_value(data=results, key=self.config.get('filter'))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters