批量替换XCode中的版权注释 [英] Batch replace copyright comment in XCode

查看:168
本文介绍了批量替换XCode中的版权注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在iOS项目上工作了一段时间,创建了数百个源文件,现在它已经很好用了,我发现了一些令人伤心的事情:我在开始工作之前编辑了版权文件模板,而且所有的我的文件有这种蹩脚的格式:

I've been working on an iOS project for some time now, creating hundreds of source files, and now that's it's good and done, I realize something sad : I edit the copyright file template before getting to work, and all of my files have this lame format :

//
//  MyClass.h
//
//  Created by Redwarp on 3/25/13.
//  Copyright (c) 2013 Redwarp. All rights reserved.
//

这并不酷!我想用更类似的东西替换它:

And that's not cool ! I would like to replace it with something more like that :

/* This software is licensed under the Apache 2 license, quoted below.

Copyright 2013 Redwarp <redwarp@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.
*/

无论如何。我可能会编写一个脚本,搜索我的所有文件并用更好的注释替换第一行//行,但我确信有一个工具可以完美地完成。

Anyway. I could probably write a script, that searches all my files and replace the first "//" lines with a better comment, but I'm sure there is a tool out there that does that perfectly.

除外:我无法在任何地方找到该工具。

Except : I can't find that tool anywhere.

有人知道这样的工具吗? (或者可能是我是个傻瓜?)

Would anyone know of such a tool ? (Or might it be that I'm a fool ?)

推荐答案

我最终使用了我在这里找到的脚本: http://gergap.wordpress。 com / 2009/06/03 / howto-recursively-replace-file-headers-of-source-files /

I ended up using the script I found here : http://gergap.wordpress.com/2009/06/03/howto-recursively-replace-file-headers-of-source-files/

完全按照我的意愿完成工作做,并免除了我自己做的负担。

Does exactly the job I wanted to do, and spared me the burden of doing it myself.

这篇关于批量替换XCode中的版权注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆