-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathoutput_usage.sh
executable file
·31 lines (29 loc) · 1.21 KB
/
output_usage.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env bash
## outputs the usage section for the audit-filter README to readme_usage.md
cat > readme_usage.md <<EOF
\$ audit-filter -h
$(audit-filter -h)
\$ cd audit-filter/example/
\$ cat package.json
$(cat example/package.json)
\$ npm --version
$(npm --version)
\$ npm audit
$(cd example/ && npm audit)
\$ echo \$?
$(echo $?)
\$ cat .nsprc
$(cat example/.nsprc)
\$ npm audit --json | audit-filter
$(cd example/ && npm audit --json | audit-filter)
\$ echo \$?
$(echo $?)
\$ # Alternatively specify audit and config file paths (note: errors print to stderr)
\$ cd .. && audit-filter --nsp-config example/.nsprc --audit tests/fixtures/screenshots-e78ee92b9a76ed6796cbdf0a9f643e00efc8b8b1-npm-6.9.0-audit.json
$(audit-filter --nsp-config example/.nsprc --audit tests/fixtures/screenshots-e78ee92b9a76ed6796cbdf0a9f643e00efc8b8b1-npm-6.9.0-audit.json 2>&1)
\$ echo \$?
$(echo $?)
\$ # use --json for JSON output
\$ audit-filter --json --nsp-config example/.nsprc --audit tests/fixtures/screenshots-e78ee92b9a76ed6796cbdf0a9f643e00efc8b8b1-npm-6.9.0-audit.json | head
$(audit-filter --json --nsp-config example/.nsprc --audit tests/fixtures/screenshots-e78ee92b9a76ed6796cbdf0a9f643e00efc8b8b1-npm-6.9.0-audit.json 2>&1 | head)
EOF