Unix 工具:漂亮的打印代码
我正在将代码移植到不同的语言并在不同的服务器上运行它等。
作为第一步:我们只是打印出运行的命令,因为实际环境有太多环境问题需要解决。因此,目前我们正在生成的输出是:
fn a
{
executing blah
executing blah
executing blah
fn b
{
executing blah
executing blah
fn c
{
executing blah
executing blah
}
}
}
这是一个大转储,我们希望在开始移植之前通过“阅读”对其进行审查。我正在寻找一个简单的实用程序,我可以通过它传递或捕获带有代码的文件,并且它会为我们漂亮地打印它。
大多数情况下,只有大括号也可以。但最多可以达到多个级别。所以上面的代码应该看起来像:
fn a
{
executing blah
executing blah
executing blah
fn b
{
executing blah
executing blah
fn c
{
executing blah
executing blah
}
}
}
在 unix 中类似的东西有用吗?
astyle --style=allman /路径/文件:
fn a
{
executing blah
executing blah
executing blah
fn b
{
executing blah
executing blah
fn c
{
executing blah
executing blah
}
}
}
谢谢!
I am in the process of porting a code to different language and running it on different servers etc.
As a step1 : we are just printing out the commands that are run since there are too many env issues to go through for actual env. So currently the output we are producing is :
fn a
{
executing blah
executing blah
executing blah
fn b
{
executing blah
executing blah
fn c
{
executing blah
executing blah
}
}
}
This is a big dump that we want to review by "reading" before we start porting it. I am looking for a simple utility that I can pass or cat a file with code and it will pretty print it for us.
Mostly just the braces is fine as well ..but upto multiple level. So above code should look like:
fn a
{
executing blah
executing blah
executing blah
fn b
{
executing blah
executing blah
fn c
{
executing blah
executing blah
}
}
}
Is something like that avail in unix ?
astyle --style=allman /path/file:
fn a
{
executing blah
executing blah
executing blah
fn b
{
executing blah
executing blah
fn c
{
executing blah
executing blah
}
}
}
Thanks !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
indent
是您正在寻找的工具。indent
is the tool you are looking for.此类事情通常的备用方法是
enscript
和a2ps
。The usual stand-bys for this sort of thing are
enscript
anda2ps
.