Skip to content

Commit dd98353

Browse files
committed
Tmain: list common fields when NONE is passed to --list-fields
Signed-off-by: Masatake YAMATO <[email protected]>
1 parent 3a2ca44 commit dd98353

File tree

7 files changed

+42
-4
lines changed

7 files changed

+42
-4
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0

Tmain/list-fields-none.d/run.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright: 2022 Masatake YAMATO
2+
# License: GPL-2
3+
4+
CTAGS=$1
5+
6+
$CTAGS --quiet --options=NONE --list-fields=NONE | grep -v xpath

Tmain/list-fields-none.d/stderr-expected.txt

Whitespace-only changes.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#LETTER NAME ENABLED LANGUAGE JSTYPE FIXED OP DESCRIPTION
2+
N name yes NONE s-- yes rw tag name
3+
F input yes NONE s-- yes r- input file
4+
P pattern yes NONE s-b yes -- pattern
5+
C compact no NONE s-- no -- compact input line (used only in xref output)
6+
E extras no NONE s-- no r- Extra tag type information
7+
K NONE no NONE s-- no -- Kind of tag in long-name form
8+
R NONE no NONE s-- no -- Marker (R or D) representing whether tag is definition or reference
9+
S signature no NONE s-- no rw Signature of routine (e.g. prototype or parameter list)
10+
T epoch yes NONE -i- no -- the last modified time of the input file (only for F/file kind tag)
11+
Z scope no NONE s-- no rw [tags output] prepend "scope:" key to s/scope field output, [xref and json output] the same as s/ field
12+
a access no NONE s-- no rw Access (or export) of class members
13+
e end no NONE -i- no rw end lines of various items
14+
f file yes NONE --b no -- File-restricted scoping
15+
i inherits no NONE s-b no -w Inheritance information
16+
k NONE yes NONE s-- no -- Kind of tag in one-letter form
17+
l language no NONE s-- no -- Language of input file containing tag
18+
m implementation no NONE s-- no -- Implementation information
19+
n line no NONE -i- no rw Line number of tag definition
20+
o nth no NONE -i- no -- the order in the parent scope
21+
p scopeKind no NONE s-- no -- [tags output] no effect, [xref and json output] kind of scope in long-name form
22+
r roles no NONE s-- no r- Roles
23+
s NONE yes NONE s-- no -- [tags output] scope (kind:name) of tag definition, [xref and json output] name of scope
24+
t typeref yes NONE s-- no rw Type and name of a variable or typedef
25+
z kind no NONE s-- no r- [tags output] prepend "kind:" to k/ (or K/) field output, [xref and json output] kind in long-name form

docs/man/ctags.1.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,9 +1047,11 @@ Listing Options
10471047
``--list-features``
10481048
Lists the compiled features.
10491049

1050-
``--list-fields[=(<language>|all)]``
1050+
``--list-fields[=(<language>|NONE|all)]``
10511051
Lists the fields recognized for either the specified *<language>* or
1052-
``all`` languages. See "`Extension fields`_" subsection to know what are fields.
1052+
``all`` languages. If ``NONE`` is specified, it lists only fields
1053+
common in all languages.
1054+
See "`Extension fields`_" subsection to know what are fields.
10531055
``all`` is used as default value if the option argument is omitted.
10541056

10551057
The meaning of columns are as follows:

main/options.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,6 +1580,8 @@ static void processListFieldsOption(const char *const option CTAGS_ATTR_UNUSED,
15801580
fieldColprintAddLanguageLines (table, i);
15811581
}
15821582
}
1583+
else if (strcasecmp (parameter, RSV_NONE) == 0)
1584+
fieldColprintAddCommonLines (table);
15831585
else
15841586
{
15851587
langType language = getNamedLanguage (parameter, 0);

man/ctags.1.rst.in

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,9 +1047,11 @@ Listing Options
10471047
``--list-features``
10481048
Lists the compiled features.
10491049

1050-
``--list-fields[=(<language>|all)]``
1050+
``--list-fields[=(<language>|NONE|all)]``
10511051
Lists the fields recognized for either the specified *<language>* or
1052-
``all`` languages. See "`Extension fields`_" subsection to know what are fields.
1052+
``all`` languages. If ``NONE`` is specified, it lists only fields
1053+
common in all languages.
1054+
See "`Extension fields`_" subsection to know what are fields.
10531055
``all`` is used as default value if the option argument is omitted.
10541056

10551057
The meaning of columns are as follows:

0 commit comments

Comments
 (0)