Я посмотрел и попытался использовать буйные ctags без везения с тем, что я хочу сделать. Я нахожусь на mac, пытаясь работать в проекте, где я хочу исключить такие каталоги, как .git, node_modules, test и т.д. Когда я пытаюсь что-то вроде ctags -R --exclude=[.git, node_modules, test]
, я ничего не получаю взамен. Мне действительно нужно только запустить его в моем основном каталоге. Любые идеи о том, как это сделать?
Как исключить несколько каталогов с помощью Exuberant ctags?
Ответ 1
Опция --exclude
не ожидает список файлов. Согласно странице ctags
man, "Эта опция может быть указана столько раз, сколько требуется". Итак, вот так:
ctags -R --exclude=.git --exclude=node_modules --exclude=test
Ответ 2
R ead T он F antastic M anual всегда должен быть первым шагом любой попытки решить проблема.
От $ man ctags
:
--exclude=[pattern]
Add pattern to a list of excluded files and directories. This option may
be specified as many times as desired. For each file name considered by
both the complete path (e.g. some/path/base.ext) and the base name (e.g.
base.ext) of the file, thus allowing patterns which match a given file
name irrespective of its path, or match only a specific path. If appro-
priate support is available from the runtime library of your C compiler,
then pattern may contain the usual shell wildcards (not regular expres-
sions) common on Unix (be sure to quote the option parameter to protect
the wildcards from being expanded by the shell before being passed to
ctags; also be aware that wildcards can match the slash character, '/').
You can determine if shell wildcards are available on your platform by
examining the output of the --version option, which will include "+wild-
cards" in the compiled feature list; otherwise, pattern is matched
against file names using a simple textual comparison.
If pattern begins with the character '@', then the rest of the string is
interpreted as a file name from which to read exclusion patterns, one per
line. If pattern is empty, the list of excluded patterns is cleared.
Note that at program startup, the default exclude list contains "EIFGEN",
"SCCS", "RCS", and "CVS", which are names of directories for which it is
generally not desirable to descend while processing the --recurse option.
Из двух первых предложений вы получаете:
$ ctags -R --exclude=dir1 --exclude=dir2 --exclude=dir3 .
который может быть немного подробным, но для того, что для псевдонимов и отображений и т.д. В качестве альтернативы вы получите это из второго абзаца:
$ ctags -R [email protected] .
со следующим в .ctagsignore
:
dir1
dir2
dir3
который работает, чтобы исключить эти 3 каталога без так много ввода.
Ответ 3
Вы можете инкапсулировать список с разделителями-запятыми с фигурными фигурными скобками для обработки кратных с помощью одной опции --exclude
:
ctags -R --exclude={folder1,folder2,folder3}
Похоже, что это работает только для папок в корне, где вы выдаете команду. Исключение вложенных папок требует отдельной опции --exclude
.