n+1th dotfiles管理器,支持公共和私有存储库以及git
npp-dotmanager的Python项目详细描述
npp_dotfiles使您易于使用和管理配置文件 同时将它们保存在一个安全目录中(如dropbox或其他 主持人)。您可以将其配置为将文件符号链接到其目标 支持备份和工作目录中不同名称的目录。 此外,还可以管理要与之共享的配置文件 其他的和你的私人的分开。使用git自动推送 并在备份时提取存储库。
当前稳定版本为0.2.0
安装
您可以使用pip安装它:
pip install npp-dotmanager
或者下载源代码并使用:
$ git clone https://github.com/sxnwlfkk/dotmanager $ cd dotmanager $ python3 setup.py install
运行
您可以使用dotmanager命令运行程序。你可以探索 使用dotmanager -hhelp函数的参数。
如果您没有根权限,可以使用 dotmanager_noroot.py克隆存储库后的脚本。在 项目调用的根目录:
python3 scripts/dotmanager_noroot.py -h
配置
dotmanager需要运行配置文件,并首先签入 ~/.dotfile。可以从另一个目录指定配置文件 通话:
dotmanager -d ~/path/to/alternative/dotfile
配置文件
配置文件需要用yaml格式化,如下所示 时尚:
repositories: private: dir: /home/user/path/to/backup/directory url: https://example@bitbucket.org/configs.git public: dir: /home/user/path/to/public/respitory url: https://github.com/example/configs.git backup-folders: scripts: target: ~/bin/ public: - first_script - second_script private: - third_script home: target: ~/ public: - .vimrc - .tmux.conf - [.newsbeuterrc, ~/.newsbeuter/config/.newsbeuterrc] private: - .zshrc - .dotfile - .netrc - [ranger.conf, ~/.config/ranger/rc.conf]
此示例配置文件在源存储库中可用。
repositories和backup-folders是必需的级别。 存储库需要至少有一个私有级别,其中dir 需要设置为备份文件夹,并且只需要url,如果 您想使用git功能。
backup-folders中的键是目录的名称 在备份文件夹中(此时您至少需要一个,并且 构造备份文件也是一个好主意)。那target 键确定工作目录,其中大多数点文件将 符号链接。
公共和私人模式
public键下的文件将与 私有的,–符号链接到目标目录–例外 如果您 指定一个。
存储其他名称
的文件如果要用不同的名称存储配置文件 无论出于什么原因,您都可以进入目标目录。为了 例如,要将ranger的配置文件(rc.conf)存储为 ranger.conf在备份目录中。为了让这个有效,你需要 首先指定替代名称,然后指定目标文件的路径:
- [ranger.conf, ~/.config/ranger/rc.conf]
备用目标路径
如果您的文件需要位于其他目录而不是您的其他文件 在backup dir中,可以用上面的命令指定备用路径 方法。
设置
如果dotmanager,安装程序是主要工作模式之一。你可以打电话 是公开的还是私下的。在公共和 私人文件到目的地。然而,public试图克隆 公共git存储库(如果提供)。否则,它会生成目录(如果 它不存在,并将公共文件复制到它们的位置。 最理想的情况是,您需要在安装后使用它。
私人
dotmanager --setup--private
公共
dotmanager --setup--public
备份
如果要将备份迁移到 他们的git服务器。如果使用--private标志调用,它只是 提交备份目录中的更改,并将其推送到当前目录 分支使用--public标志调用,它提交并推送 私有目录,然后将公共文件的当前状态复制到 公共主管。之后,公共存储库也将提交 推送到当前目录。
私人
dotmanager --backup--private
公共
dotmanager --backup--public
--no_git标志
--no_git标志禁止程序的每个git功能, 如果要使用其他宿主或版本控制。
许可证
Copyright (C) 2017, Saxon Wolfkok <saxonwolfkok@gmail.com> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.