从stdin读取输入并将其转换为jira表的工具

toJiraTable的Python项目详细描述


从stdin读取输入并将其转换为jira表。

它读取的第一行用作表头,随后的所有行都生成到正文中。支持shell样式的字段拆分(可以使用引号将带有空格的项“分组”到单个字段中)。

默认情况下,它将被空格分隔,因此每个单词都成为一个项。默认情况下,整个表将增长到最长的行,并在需要时填充空白。

如果需要按其他方式拆分,例如两个空格(如果列由两个或多个空格分隔,并且包含空格之间的字符),则有多种可用的–按选项拆分,请参阅下面的用法。有关详细信息,请参见用法和示例。

用法:

Usage: toJiraTable

Converts stdin to a JIRA table. If no arguments provided, it will use “shell-style” splitting

so quoting strings with spaces makes them a single column, otherwise spaces/tabs/whatever

splits. The first line passed in becomes the header, the remainder become the body.

默认情况下,所有内容都将匹配到最长的行。行中任何缺少的列都将

be filled by blank columns at the end. Use –no-stretch to disable this.

Arguments:

–no-stretch - Do not stretch each row to the longest row. See above.

–split-header-by=X - Instead of using shell-style splitting, split by provided string for the header line

–split-body-by=X - Instead of using shell-style splitting, split by the provided string for body lines

–split-by=X - Split both header and body by the given string

–split-keep-empty - By default, using the –split-by* will strip empty columns. The default behaviour is

useful, in example: if a script outputs strings which are not quoted, but has at least two

spaces between each real column, using –split-body-by=’ ‘ will ensure that any place that

is separated by two or more spaces becomes a column. This option disables that feature.

示例用法:

简单拆分:

[myuser]$ ( echo ‘Hostname “Free Space”’; cat hostnames.txt ) | toJiraTable

||Hostname||Free Space||

|host1|500G|

|wwwprod1|120G|

|wwwdev1|11G|

更复杂的拆分。在这种情况下,我们希望主体在至少有两个空格时形成列:

(数据集)

[myuser]$ cat myData

Name Size Comment

George Jetson 500G The man from the future

Jeeves 200M Everyone’s favourite butlet

(转换为JIRA表格)

[myuser]$ cat myData | ./toJiraTable –split-body-by=” “

||Name||Size||Comment||

|George Jetson|500G|The man from the future|

|Jeeves|200M|Everyone’s favourite butlet|

制表符取消拆分:

(数据集):

[myuser]$ python -c “import sys; sys.stdout.write(repr(open(‘myData’, ‘rt’).read()).replace(‘\n’, ‘\n’) + ‘n’);”

“NametSizetComment

George Jetsont500GtThe man from the future

Jeevest200MtEveryone’s favourite butlet

(转换为JIRA表格)

[myuser]$ cat myData | ./toJiraTable –split-by=’t’

||Name||Size||Comment||

|George Jetson|500G|The man from the future|

|Jeeves|200M|Everyone’s favourite butlet|

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

推荐PyPI第三方库


热门话题
java下载并将位图设置为列表视图   java有用于MyBatis XML sqlmaps的Javadoc样式的文档工具吗?   放置属性文件的位置,以便java命令在类路径中看到它   使用jschexception验证false的java SSH有时会失败   java如何在Android中使用MPAndroidChart定制饼图?   java如何使用R.String初始化字符串。文本   BeanValidation的java上下文相关验证   java反射:通过反射加载的类中的常量变量   安卓 Java使用相同的规则压缩多个字符串   公告命令中的java换行符不工作   带有整数、字符串和项目符号列表的java txt文件(1.)   arraylist Connect四代码(Java)列放置不工作   用于多个报告的java jasper页面编号   java如何消除Nimbus LAF中按钮周围的空间?   安卓 setImageResource内置自定义ArrayAdapter。lang.NullPointerException   java Android将Json转换为ArrayList多级可扩展列表视图   java Eclipse,Web工具平台,导致JSP中找不到元素错误,但一切正常