diff --git a/pmpt/__init__.py b/pmpt/__init__.py index 240302e..a05e526 100644 --- a/pmpt/__init__.py +++ b/pmpt/__init__.py @@ -1,6 +1,8 @@ import click from . import update as updates from . import util +from moyanlib import jsons +import os from . import install as installs from . import search as searchs @click.group() @@ -42,5 +44,25 @@ def remove(name,yes): @click.option('--api-url','-u',default=None) def search(*args, **kwargs): searchs.main(*args,**kwargs) + +@cli.group() +def source(): + pass + +@source.command() +@click.argument('url') +def add(url): + sourceList = jsons.load(open(os.path.join(util.dirs.user_config_dir,'Source.json'))) + if url in sourceList: + print('The source already exists') + exit() + sourceList.append(url) + jsons.dump(sourceList,open(os.path.join(util.dirs.user_config_dir,'Source.json'))) +@source.command(name='list') +def lists(): + sourceList = jsons.load(open(os.path.join(util.dirs.user_config_dir,'Source.json'))) + ids = 1 + for i in sourceList: + print(str(ids)+'.',i) if __name__ == '__main__': cli() \ No newline at end of file diff --git a/setup.py b/setup.py index aae996a..90b241a 100644 --- a/setup.py +++ b/setup.py @@ -14,13 +14,14 @@ class CustomInstallCommand(install): open(os.path.join(dirs.user_config_dir,'Source.json'),'w').write('["https://pypi.org/simple/"]') open(os.path.join(dirs.user_config_dir,'api.url'),'w').write('https://pypi.org/pypi/{}/json') + setup( name='pmpt', # 包的名称 version=util.__version__, # 版本号 packages=find_packages(), # 包含的包 author='MoYan', # 作者 author_email='moyan@moyanjdc.top', # 作者邮箱 - description='a Python Package Advanced Manager', # 包的简要描述 + description='A Python Package Advanced Manager', # 包的简要描述 long_description='A longer description of your package', # 包的详细描述 long_description_content_type='text/markdown', # 描述的内容类型 classifiers=[ # 包的分类信息