排除Exuberant CTags中的目录 [英] Excluding directories in Exuberant CTags

查看:133
本文介绍了排除Exuberant CTags中的目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个非常大的代码库,并且发现选择包含哪些目录与Exuberant Ctags一起使用非常有用.

I'm working with a very large code base and I find it useful to be selective about which directories are included for use with Exuberant Ctags.

--exclude选项可以很好地消除单个文件和目录名称(带有通配符),但是我不知道如何获取它来排除包含多个目录的路径模式.

The --exclude option works well to eliminate individual file and directory names (with globing wildcards), but I can't figure out how to get it to exclude path patterns containing more than one directory.

例如,我可能想排除目录tests,但仅在处理thirdparty\tests时(在Windows下)除外.问题是,如果我只使用--exclude=tests,我会排除很多目录,包括我正在积极研究的代码中的测试目录.

For example, I may want to exclude a directory tests, but only when processing thirdparty\tests (under Windows). The problem is if I just use --exclude=tests I exclude too many directories, including a test directory in the code I'm actively working on.

以下是我尝试过的一些事情:

Here are some things I've tried:

--exclude=thirdparty\tests
--exclude=thirdparty\\tests
--exclude=*\thirdparty\tests
--exclude=*\\thirdparty\\tests
--exclude=thirdparty/tests

Ctags默默地忽略了所有这些,通过检查标签文件可以证明.

Ctags silently ignores all these as evidenced by an examination of the tags file.

仅当目录前有给定的父目录时,如何才能排除该目录?

How can I exclude a directory only when it is preceded by a given parent directory?

已添加:

这是我的ctags --version输出:

Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
  Compiled: Jul  9 2009, 17:05:35
  Addresses: <dhiebert@users.sourceforge.net>, http://ctags.sourceforge.net
  Optional compiled features: +win32, +regex, +internal-sort

推荐答案

在某些时候,定义要索引的文件列表可能会更容易;将列表保存到文件中,然后使用ctags -L <filename>索引选定的少数几个.

At some point it might be easier to define the list of files you do want indexed; save that list to a file, and use ctags -L <filename> to index just the chosen few.

这使您可以使用find(1)修剪您不想索引的目录,例如:

This lets you use find(1) to prune the directories you don't want to index, e.g.:

find . -path ./Documentation -prune -o -print > indexme

将跳过./Documentation所有子目录中的所有文件.

would skip all the files in all subdirectories of ./Documentation.

这篇关于排除Exuberant CTags中的目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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