3 ÌÐg/ã @s<ddlZddlZddlZddlZdd„Zdd„ZGdd„dejjj j ƒZ Gdd „d ejjj j ƒZGd d „d ejjjjƒZGd d „d ejjjƒZGdd„dejjjjƒZGdd„dejjjjƒZGdd„dejjjjƒZGdd„dejjjjƒZdd„Z e!dk�r8ye ej"dd…ƒWn e#k �r6ej$dƒYnXdS)éNcst‡fdd„|ƒS)Ncst|ƒjˆƒS)N)ÚstrÚ startswith)Úk)Úkw©ú'/usr/lib/python3.6/completion_helper.pyÚsz#filter_list_by_kw..)Úfilter)rZlstr)rrÚfilter_list_by_kwsr cCstdd„|DƒƒS)NcSsg|] }t|ƒ‘qSr)r)Ú.0Úxrrrú !sz%listpkg_to_setstr..)Úset)ÚpkgsrrrÚlistpkg_to_setstr srcs,eZdZ‡fdd„Zdd„Zdd„Z‡ZS)ÚRemoveCompletionCommandcstt|ƒj|ƒdS)N)ÚsuperrÚ__init__)ÚselfÚargs)Ú __class__rrr$sz RemoveCompletionCommand.__init__cCsd|jj_d|jj_dS)NFT)ÚcliÚdemandsÚ root_userÚsack_activation)rrrrÚ configure's z!RemoveCompletionCommand.configurecCs,x&tj|j|jjƒD]}tt|ƒƒqWdS)N)ÚListCompletionCommandÚ installedÚbaseÚoptsÚ pkg_specsÚprintr)rÚpkgrrrÚrun+szRemoveCompletionCommand.run)Ú__name__Ú __module__Ú __qualname__rrr#Ú __classcell__rr)rrr#s rcs,eZdZ‡fdd„Zdd„Zdd„Z‡ZS)ÚInstallCompletionCommandcstt|ƒj|ƒdS)N)rr(r)rr)rrrr1sz!InstallCompletionCommand.__init__cCs"d|jj_d|jj_d|jj_dS)NFT)rrrÚavailable_reposr)rrrrr4s  z"InstallCompletionCommand.configurecCsNttj|j|jjƒƒ}ttj|j|jjƒƒ}x||D]}tt|ƒƒq6WdS)N) rrrrrr Ú availabler!r)rrr*r"rrrr#9s     zInstallCompletionCommand.run)r$r%r&rrr#r'rr)rrr(0s r(cs,eZdZ‡fdd„Zdd„Zdd„Z‡ZS)ÚReinstallCompletionCommandcstt|ƒj|ƒdS)N)rr+r)rr)rrrrCsz#ReinstallCompletionCommand.__init__cCs"d|jj_d|jj_d|jj_dS)NFT)rrrr)r)rrrrrFs  z$ReinstallCompletionCommand.configurecCsNttj|j|jjƒƒ}ttj|j|jjƒƒ}x||@D]}tt|ƒƒq6WdS)N) rrrrrr r*r!r)rrr*r"rrrr#Ks     zReinstallCompletionCommand.run)r$r%r&rrr#r'rr)rrr+Bs r+csHeZdZ‡fdd„Zdd„Zedd„ƒZedd„ƒZed d „ƒZ‡Z S) rcstt|ƒj|ƒdS)N)rrr)rr)rrrrTszListCompletionCommand.__init__cCsú|j}|jj}|jj}t|ƒdkrH|d|krHtdjt|d|ƒƒƒn®|dkr`|j|j |ƒ}n||dkrx|j |j |ƒ}nd|dkr�|j |j |ƒ}nLt |j |j |ƒƒ}t |j|j |ƒƒ}||B}|sÜtdjt|d|ƒƒƒdSx|D]}tt |ƒƒqâWdS)NéÚ rr*Úupdatesr)Z pkgnarrowsrZpackagesZpackages_actionÚlenr!Újoinr rrr*r.rr)rÚsubcmdsrÚactionrr*rr"rrrr#Ws& zListCompletionCommand.runcCs |jjƒjƒjdj|dƒd�S)Nz{}*r)Ú name__glob)ÚsackÚqueryrÚfiltermÚformat)rÚargrrrrnszListCompletionCommand.installedcCs |jjƒjƒjdj|dƒd�S)Nz{}*r)r3)r4r5r*r6r7)rr8rrrr*rszListCompletionCommand.availablecCs|jdj|dƒgdd�S)Nz{}*rF)Zprint_)Z check_updatesr7)rr8rrrr.vszListCompletionCommand.updates) r$r%r&rr#Ú staticmethodrr*r.r'rr)rrrSs    rcs$eZdZ‡fdd„Zdd„Z‡ZS)ÚRepoListCompletionCommandcstt|ƒj|ƒdS)N)rr:r)rr)rrrr|sz"RepoListCompletionCommand.__init__cCs°|j}|jdkr>tdjt|jddd„|jjjƒDƒƒƒƒnn|jdkrvtdjt|jddd„|jjjƒDƒƒƒƒn6|jdkr¬tdjt|jdd d„|jjjƒDƒƒƒƒdS) NÚenabledr-rcSsg|] }|j‘qSr)Úid)r Úrrrrr ƒsz1RepoListCompletionCommand.run..ZdisabledcSsg|]}|js|j‘qSr)r;r<)r r=rrrr †sÚallcSsg|] }|j‘qSr)r<)r r=rrrr ‰s) rZ repos_actionr!r0r ZreposrZ iter_enabledr>)rrrrrr#s   zRepoListCompletionCommand.run)r$r%r&rr#r'rr)rrr:{s r:cs,eZdZ‡fdd„Zdd„Zdd„Z‡ZS)ÚUpgradeCompletionCommandcstt|ƒj|ƒdS)N)rr?r)rr)rrrr�sz!UpgradeCompletionCommand.__init__cCs"d|jj_d|jj_d|jj_dS)NFT)rrrr)r)rrrrr�s  z"UpgradeCompletionCommand.configurecCs,x&tj|j|jjƒD]}tt|ƒƒqWdS)N)rr.rrr r!r)rr"rrrr#•szUpgradeCompletionCommand.run)r$r%r&rrr#r'rr)rrr?Œs r?cs,eZdZ‡fdd„Zdd„Zdd„Z‡ZS)ÚDowngradeCompletionCommandcstt|ƒj|ƒdS)N)rr@r)rr)rrrr›sz#DowngradeCompletionCommand.__init__cCs"d|jj_d|jj_d|jj_dS)NFT)rrrr)r)rrrrržs  z$DowngradeCompletionCommand.configurecCs0x*tj|j|jjƒjƒD]}tt|ƒƒqWdS)N)rr*rrr Z downgradesr!r)rr"rrrr#£szDowngradeCompletionCommand.run)r$r%r&rrr#r'rr)rrr@šs r@cs$eZdZ‡fdd„Zdd„Z‡ZS)ÚCleanCompletionCommandcstt|ƒj|ƒdS)N)rrAr)rr)rrrr©szCleanCompletionCommand.__init__cCs0tjjjjjƒ}tdjt|j j d|ƒƒƒdS)Nr-r,) ÚdnfrÚcommandsÚcleanZ _CACHE_TYPESÚkeysr!r0r rÚtype)rr1rrrr#¬szCleanCompletionCommand.run)r$r%r&rr#r'rr)rrrA¨s rAc Csìtjjjƒ}tjj|ƒ}|ddkrP|jgg|ƒtdjt|d|jƒƒƒdS|jj ƒ|j t ƒ|j t ƒ|j t ƒ|j tƒ|j tƒ|j tƒ|j tƒ|j tƒ|j|ƒy |jƒWn&ttjjfk rætjdƒYnXdS)NrZ_cmdsr-r,)rBrZBaseCliZCliZ init_pluginsr!r0r Z cli_commandsÚclearZregister_commandrr(r+rr:r?r@rArr#ÚOSErrorÚ exceptionsÚErrorÚsysÚexit)rrrrrrÚmain±s(              rMÚ__main__r,)%Zdnf.exceptionsrBZdnf.cliZdnf.cli.commands.cleanrKr rrrCÚremoveZ RemoveCommandrZinstallZInstallCommandr(Z reinstallZReinstallCommandr+Z ListCommandrZrepolistZRepoListCommandr:ZupgradeZUpgradeCommandr?Z downgradeZDowngradeCommandr@rDZ CleanCommandrArMr$ÚargvÚKeyboardInterruptrLrrrrÚs& (