私はやりたいことに運がないので、熱狂的なctagsを見て使用しようとしました。私は Mac で、.git、node_modules、test などのディレクトリを除外したいプロジェクトで作業しようとしていctags -R --exclude=[.git, node_modules, test]
ます。本当に必要なのは、コア ディレクトリで実行することだけです。これを達成する方法についてのアイデアはありますか?
34173 次
5 に答える
86
この--exclude
オプションは、ファイルのリストを想定していません。のマニュアル ページによるとctags
、「このオプションは、必要に応じて何度でも指定できます。」したがって、次のようになります。
ctags -R --exclude=.git --exclude=node_modules --exclude=test
于 2014-09-13T04:08:59.120 に答える
48
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.
最初の 2 つの文から、次のことがわかります。
$ ctags -R --exclude=dir1 --exclude=dir2 --exclude=dir3 .
少し冗長かもしれませんが、それがエイリアスやマッピングなどの目的です。別の方法として、2 番目の段落からこれを取得します。
$ ctags -R --exclude=@.ctagsignore .
で次のようにし.ctagsignore
ます。
dir1
dir2
dir3
これにより、入力をあまり行わずにこれら 3 つのディレクトリを除外することができます。
于 2014-09-13T07:43:16.120 に答える
21
コンマ区切りのリストを中括弧でカプセル化して、1 つの--exclude
オプションで倍数を処理できます。
ctags -R --exclude={folder1,folder2,folder3}
これは、コマンドを発行しているルートのフォルダーに対してのみ機能するようです。ネストされたフォルダーを除外するには、別の--exclude
オプションが必要です。
于 2017-03-13T18:57:29.043 に答える