Skip to content

Commit edb4398

Browse files
committed
add contrib/zsh/check-all-helps to check for changes in CLI interface
1 parent 24d98d3 commit edb4398

File tree

6 files changed

+195
-0
lines changed

6 files changed

+195
-0
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ matrix:
1717
include:
1818
- python: 3.6
1919
env: TOXENV=lint,docs
20+
- python: 3.6
21+
install: pip install -r requirements.txt
22+
script: ./contrib/zsh/check-all-helps
2023

2124
install: pip install tox
2225

contrib/zsh/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# ZSH completion plugin
2+
3+
To install, add the `functions/` directory to your `fpath`.
4+
5+
This is done automatically if you use one of the numerous ZSH plugin managers.
6+
7+
8+
## check-all-helps: monitor CLI interface changes
9+
10+
The `check-all-helps` monitors the `compdb` help outputs.
11+
When a change is detected it suggest to update files that may depend on it.
12+
13+
To run, type:
14+
15+
./check-all-helps

contrib/zsh/all-helps.txt

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
usage: compdb [-h] [-c NAME[=VALUE]] [-p BUILD-DIR] <command> ...
2+
3+
The compilation database Swiss army knife.
4+
5+
optional arguments:
6+
-h, --help show this help message and exit
7+
-c NAME[=VALUE] set value of configuration variable NAME for this
8+
invocation
9+
-p BUILD-DIR build path(s)
10+
11+
available commands:
12+
check report files absent from the compilation database(s)
13+
config get directory and global configuration options
14+
help display this help
15+
list list database entries
16+
scan-files scan directory for source files
17+
update update or create complementary databases
18+
version display this version of compdb
19+
20+
21+
# check
22+
23+
usage: compdb check [-h] [--suppress pattern] [--suppressions-file file]
24+
[-g GROUPS]
25+
[path [path ...]]
26+
27+
positional arguments:
28+
path search path(s) (default: ['.'])
29+
30+
optional arguments:
31+
-h, --help show this help message and exit
32+
--suppress pattern ignore files matching the given pattern
33+
--suppressions-file file
34+
add suppress patterns from file
35+
-g GROUPS, --groups GROUPS
36+
restrict search to files of the groups [source,header]
37+
38+
description:
39+
Report files absent from the compilation database(s).
40+
41+
Report files that are found in the workspace but not in the compilation
42+
database. And files that are in the compilation database but not found in the
43+
workspace.
44+
45+
Exit with status 1 if some file in the workspace aren't found in the
46+
compilation database.
47+
48+
49+
# config
50+
51+
usage: compdb config [-h] <subcommand> ...
52+
53+
optional arguments:
54+
-h, --help show this help message and exit
55+
56+
available subcommands:
57+
print-user-conf
58+
print the user configuration path
59+
print-local-conf
60+
print the project local configuration
61+
list list all the configuration keys
62+
dump dump effective configuration
63+
get get configuration variable effective value
64+
65+
description:
66+
Get directory and global configuration options.
67+
68+
69+
# help
70+
71+
usage: compdb help [-h]
72+
73+
optional arguments:
74+
-h, --help show this help message and exit
75+
76+
description:
77+
Display this help.
78+
79+
80+
# list
81+
82+
usage: compdb list [-h] [-1] [files [files ...]]
83+
84+
positional arguments:
85+
files restrict results to a list of files
86+
87+
optional arguments:
88+
-h, --help show this help message and exit
89+
-1, --unique restrict results to a single entry per file
90+
91+
description:
92+
List database entries.
93+
94+
95+
# scan-files
96+
97+
usage: compdb scan-files [-h] [--suppress pattern] [--suppressions-file file]
98+
[-g GROUPS]
99+
[path [path ...]]
100+
101+
positional arguments:
102+
path search path(s) (default: ['.'])
103+
104+
optional arguments:
105+
-h, --help show this help message and exit
106+
--suppress pattern ignore files matching the given pattern
107+
--suppressions-file file
108+
add suppress patterns from file
109+
-g GROUPS, --groups GROUPS
110+
restrict search to files of the groups [source,header]
111+
112+
description:
113+
Scan directory for source files.
114+
115+
Lookup given paths for source files.
116+
117+
Source files includes C, C++ files, headers, and more.
118+
119+
120+
# update
121+
122+
usage: compdb update [-h]
123+
124+
optional arguments:
125+
-h, --help show this help message and exit
126+
127+
description:
128+
Update or create complementary databases.
129+
130+
131+
# version
132+
133+
usage: compdb version [-h] [--short]
134+
135+
optional arguments:
136+
-h, --help show this help message and exit
137+
--short machine readable version
138+
139+
description:
140+
Display this version of compdb.

contrib/zsh/check-all-helps

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
set -o errexit
4+
5+
cd $(dirname "${BASH_SOURCE[0]}")
6+
7+
compdb --help > all-helps.txt.new
8+
9+
compdb help | grep "^ " | while read command descr; do
10+
echo
11+
echo
12+
echo "# $command"
13+
echo
14+
compdb $command --help
15+
done >> all-helps.txt.new
16+
17+
if ! diff -u all-helps.txt{,.new}; then
18+
cat <<EOF
19+
20+
------------------------------------------------
21+
22+
A change in the CLI interface has been detected,
23+
consider updating the following file:
24+
25+
functions/_compdb
26+
27+
To remove this notice, update 'all-helps.output':
28+
29+
cp all-helps.output.new all-helps.output
30+
EOF
31+
exit 1
32+
fi
33+
34+
rm all-helps.txt.new
35+
36+
echo "Up-to-date!"

contrib/zsh/compdb.plugin.zsh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fpath+=${0:A:h}/functions
File renamed without changes.

0 commit comments

Comments
 (0)