如何从ruby获得交互式程序的进展?

如何从ruby获得交互式程序的进展?,第1张

概述我正在尝试使用–progress参数创建一个调用rsync脚本的mac ruby应用程序,但rsync显示其进度的方式是更改相同的行,而不是向其输出添加新行,所以我如何获取此数据? Rsync允许您使用–log-format选项更改正在显示的信息的格式: --log-format=FORMAT This allows you to specify exactly what the rs 我正在尝试使用–progress参数创建一个调用rsync脚本的mac ruby应用程序,但rsync显示其进度的方式是更改相同的行,而不是向其输出添加新行,所以我如何获取此数据?解决方法 Rsync允许您使用–log-format选项更改正在显示的信息的格式:

--log-format=FORMAT      This allows you to specify exactly what the rsync clIEnt outputs to the user on a per-file basis.  The format is a text string containing embedded      single-character  escape sequences prefixed with a percent (%) character.  For a List of the possible escape characters,see the "log format" set-      ting in the rsyncd.conf manpage.  (Note that this option does not affect what a daemon logs to its logfile.)      Specifying this option will mention each file,dir,etc. that gets updated in a significant way (a transferred file,a  recreated  symlink/device,or  a touched directory) unless the itemize-changes escape (%i) is included in the string,in which case the logging of names increases to mention      any item that is changed in any way (as long as the receiving sIDe is at least 2.6.4).  See the --itemize-changes option for a description of  the      output of "%i".      The --verbose option implIEs a format of "%n%L",but you can use --log-format without --verbose if you like,or you can overrIDe the format of its      per-file output using this option.      Rsync will output the log-format string prior to a file's transfer unless one of the transfer-statistic escapes is requested,in  which  case  the      logging  is  done at the end of the file's transfer.  When this late logging is in effect and --progress is also specifIEd,rsync will also output      the name of the file being transferred prior to its progress information (followed,of course,by the log-format output).

您应该能够将其配置为更有用的东西.

此外,如果您使用了popen3,您应该能够捕获转移的百分比数字,并使用它来创建自己的进度条.

总结

以上是内存溢出为你收集整理的如何从ruby获得交互式程序的进展?全部内容,希望文章能够帮你解决如何从ruby获得交互式程序的进展?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1277606.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-09
下一篇 2022-06-09

发表评论

登录后才能评论

评论列表(0条)

保存