比较本地脚本输出和远程脚本输出

compare-with-remote的Python项目详细描述


https://travis-ci.org/guettli/compare-with-remote.svg?branch=master

与远程比较

比较本地文件和远程文件

关于

这是一个通用的文件比较工具。我写这封信是为了帮助从“宠物到牛”的过渡。换言之 我将从使用vi和ssh管理的linux服务器切换到配置管理。

它帮助您将远程主机上的文件与本地文件系统上的文件进行比较。

安装

pip install -e git+https://github.com/guettli/compare-with-remote.git#egg=compare-with-remote

用法

===> compare-with-remote -h
usage: compare-with-remote [-h][--only-files-containing-pattern ONLY_FILES_CONTAINING_PATTERN]
                           directory_url_one directory_url_two

compare two directories. Directories can get fetched via ssh first, then"meld" get called to copmare the directories. See https://github.com/guettli
/compare-with-remote

positional arguments:
  directory_url_one     [[user@]remote-host:]dir
  directory_url_two     [[user@]remote-host:]dir

optional arguments:
  -h, --help            show this help message and exit
  --only-files-containing-pattern ONLY_FILES_CONTAINING_PATTERN

示例

您想比较/etc目录中包含单词“rsyslog”的所有文件:

root@local-server> compare-with-remote --only-files-containing-pattern rsyslog \
                                          root@server-with-cute-name-1:/etc \
                                          root@server-with-cute-name-2:/etc

您可以比较如下脚本的输出:

root@local-server> compare-with-remote \
'postgres@server-with-cute-name-1:psql -c "select app, name from django_migrations order by id"'\
'postgres@server-with-cute-name-2:'

如果没有为第二个主机提供远程命令,则将调用第一个主机的命令在这种情况下 比较数据库表的所有行

屏幕截图

获取文件后,脚本调用工具“meld”以显示实际的差异:

https://github.com/guettli/compare-with-remote/blob/master/docs/screenshot-of-meld-compare-directory.png

下面是meld的屏幕截图,显示了两个文件之间的区别:

https://github.com/guettli/compare-with-remote/blob/master/docs/screenshot-of-meld-compare-file.png

不要害羞

我想知道你的想法和感受。请通过github问题跟踪器发表评论。我喜欢反馈。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java基于条件如何创建StringBuffers并向其添加数据   java如何用UNC路径解决“不表示可正确访问的目录”异常?   在执行提取方法重构后,java代码的速度降低了6倍   java如何修改LDAPCertStore中用于X509证书链验证的LDAP连接属性   awt如何在Java中捕获鼠标光标?   字符串如何设置Java输出流   java NumberFormatException:用于输入字符串:“8:00”   unix/linux“tail f”的Java IO文件实现   java打印输出。带有JOptionPane的txt文件   java解组总是显示0和null   使用MySQL的windows java JavaFX自包含应用程序打包   JavaSpring:方法getBean(String…)是如何实现的根据输入字符串查找bean?   java高效地更新RecyclerView网格或以其他方式显示复杂网格   java向ArrayList添加对象(String、String、int、int)   java在一组文档上使用ForkJoinPool