Excluding directories in Exuberant CTags

二次信任 提交于 2019-11-30 13:44:04

问题


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.

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.

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 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?

ADDED:

Here's my ctags --version output:

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

回答1:


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.

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

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




回答2:


ack -f | ctags -L -

ack will list the source files in a given dir. You can limit the scope to a specific language with ack -f --ruby or ack -f --type=ruby. You can exclude dirs as well with --ignore-dir.

Use ack --dump to see the built-in file types for ack.



来源:https://stackoverflow.com/questions/8193178/excluding-directories-in-exuberant-ctags

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!