一个简单的实用程序来清除你的Mac上的旧东西
cleanmymac的Python项目详细描述
清洁麦迪
一个简单的命令行工具,从你的Mac上清除旧的东西。
用法
$ cleanmymac -h Usage: cleanmymac [OPTIONS] TARGETS the main **run** method, responsible for creating the parser and executing the main logic in **cleanmymac** :param bool update: perform update of targets (if applicable) :param dry_run: do not execute the actions, but log the result :param quiet: quiet mode (no output), show a progressbar instead :param strict: ifset enforce strict(er) rules when validating targets :param list_targets: list the installed targets :param stop_on_error: abort the execution on first error :param config: the configuration path :param targets_path: extra targets paths :param targets: the targets Options: -L, --log-level LVL Either CRITICAL, ERROR, WARNING, INFO or DEBUG -u, --update update the target if applicable -d, --dry_run describe the actions to be performed, do not execute them -q, --quiet run in quiet mode --strict / --no-strict strict mode: enforce strict(er) rules when validating targets -l, --list list registered cleanup targets -s, --stop_on_error stop execution when first error is detected -c, --config TEXT specify the configuration path -t, --targets_path PATH specify extra yaml defined targets path --version Show the version and exit. -?, -h, --help Show this message and exit.
典型的使用模式是:
$ cleanmymac
或(在安静模式下)
$ cleanmymac -q
安装
从pypi安装:
$ pip install cleanmymac
在本地克隆存储库并发布
$ python setup.py install
配置
cleanmymac实用程序通过指定 -c选项。如果未指定,则假定文件位于以下位置 位置~/.cleanmymmac.yaml
全局配置(目前)可用于传递特定的env vars 例如,对于shell命令,假设anaconda不在main中 路径:
cleanmymac:{ targets_path:['.']}anaconda:{ env:{ PATH:'~/anaconda/bin',},}
扩展性
可以添加更多的cleanup目标,方法是将它们安装为python 注册到以下入口点的类:cleanmymac.target 像这样(在setup.py中):
entry_points={# ....'cleanmymac.target':['my_target_name = my.python.package.MyTargetClass']# ...}
或者,对于基于shell的命令,只需使用 遵循模式:
type:'cmd'spec:{ update_commands:['brewupdate','brewoutdated|brewupgrade'], clean_commands:['brewcleanup']}
或用于清理目录(删除除最新版本以外的所有目录):
type:'dir'spec:{ update_message:'GetthelatestMacTexversionfromhttps://www.tug.org/mactex/', entries:[{ dir:'/usr/local/texlive/', pattern:'\d+'},]}
note:有关详细信息,请参见cleanmymac.builtins模块
并将cleanmymac指向yaml文件所在的文件夹 -t命令行选项
内置目标
要查看运行的内置目标列表:
$ cleanmymac -l
- 目前支持以下功能:
- 自制
- Java JDK
- 麦克斯
- 水蟒
- 垃圾
免责声明
我创建这个实用程序的目的是希望其他人会发现它有用,因为我 发现总是记着如何和如何从我的Mac上清除是很烦人的。 这是正在进行中的工作,因此请自行承担使用风险!