@opencrs/cli 0.0.0-stage → 0.1.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitignore +2 -0
- package/LICENSE +202 -0
- package/LICENSE-SPEC +396 -0
- package/README.md +138 -2
- package/binary-install.js +348 -0
- package/binary.js +124 -0
- package/completions/_opencrs +156 -0
- package/completions/_opencrs.ps1 +94 -0
- package/completions/opencrs.bash +209 -0
- package/completions/opencrs.fish +57 -0
- package/install.js +4 -0
- package/man/opencrs.1 +312 -0
- package/npm-shrinkwrap.json +52 -0
- package/package.json +127 -3
- package/run-opencrs.js +4 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
#compdef opencrs
|
|
2
|
+
|
|
3
|
+
autoload -U is-at-least
|
|
4
|
+
|
|
5
|
+
_opencrs() {
|
|
6
|
+
typeset -A opt_args
|
|
7
|
+
typeset -a _arguments_options
|
|
8
|
+
local ret=1
|
|
9
|
+
|
|
10
|
+
if is-at-least 5.2; then
|
|
11
|
+
_arguments_options=(-s -S -C)
|
|
12
|
+
else
|
|
13
|
+
_arguments_options=(-s -C)
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
local context curcontext="$curcontext" state line
|
|
17
|
+
_arguments "${_arguments_options[@]}" : \
|
|
18
|
+
'-h[Show help (--help shows more)]' \
|
|
19
|
+
'--help[Show help (--help shows more)]' \
|
|
20
|
+
'-V[Show the version]' \
|
|
21
|
+
'--version[Show the version]' \
|
|
22
|
+
":: :_opencrs_commands" \
|
|
23
|
+
"*::: :->opencrs" \
|
|
24
|
+
&& ret=0
|
|
25
|
+
case $state in
|
|
26
|
+
(opencrs)
|
|
27
|
+
words=($line[1] "${words[@]}")
|
|
28
|
+
(( CURRENT += 1 ))
|
|
29
|
+
curcontext="${curcontext%:*:*}:opencrs-command-$line[1]:"
|
|
30
|
+
case $line[1] in
|
|
31
|
+
(check)
|
|
32
|
+
_arguments "${_arguments_options[@]}" : \
|
|
33
|
+
'*-s+[A screens.json to check against, repeatable]:SCREENS:_default' \
|
|
34
|
+
'*--spec=[A screens.json to check against, repeatable]:SCREENS:_default' \
|
|
35
|
+
'--files=[Directory holding the creative files]:DIR:_default' \
|
|
36
|
+
'--now=[Validation time, RFC 3339 (default\: now)]:TIME:_default' \
|
|
37
|
+
'--margin=[Warn below this multiple of the minimum text size]:RATIO:_default' \
|
|
38
|
+
'--no-files[Use the manifest'\''s declared values, don'\''t read the files]' \
|
|
39
|
+
'--json[Print the reports as a JSON array]' \
|
|
40
|
+
'-h[Show help (--help shows more)]' \
|
|
41
|
+
'--help[Show help (--help shows more)]' \
|
|
42
|
+
':creative -- The creative.json to check:_default' \
|
|
43
|
+
&& ret=0
|
|
44
|
+
;;
|
|
45
|
+
(schema)
|
|
46
|
+
_arguments "${_arguments_options[@]}" : \
|
|
47
|
+
'--kind=[Document kind (default\: detect it)]:KIND:_default' \
|
|
48
|
+
'--allow-local-http[Accept http\://localhost document URLs in an index]' \
|
|
49
|
+
'-h[Show help (--help shows more)]' \
|
|
50
|
+
'--help[Show help (--help shows more)]' \
|
|
51
|
+
'*::files -- The documents to check:_default' \
|
|
52
|
+
&& ret=0
|
|
53
|
+
;;
|
|
54
|
+
(resolve)
|
|
55
|
+
_arguments "${_arguments_options[@]}" : \
|
|
56
|
+
'-h[Show help (--help shows more)]' \
|
|
57
|
+
'--help[Show help (--help shows more)]' \
|
|
58
|
+
':screens -- The screens.json to read:_default' \
|
|
59
|
+
':reference -- A format or screen reference:_default' \
|
|
60
|
+
&& ret=0
|
|
61
|
+
;;
|
|
62
|
+
(fetch)
|
|
63
|
+
_arguments "${_arguments_options[@]}" : \
|
|
64
|
+
'*--token=[Bearer token for a publisher'\''s partner documents, repeatable]:DOMAIN=TOKEN:_default' \
|
|
65
|
+
'-o+[Save trusted documents under this directory]:DIR:_default' \
|
|
66
|
+
'--output=[Save trusted documents under this directory]:DIR:_default' \
|
|
67
|
+
'--json[Print the result as JSON]' \
|
|
68
|
+
'--allow-local-http[Allow http\:// and connections to localhost, for testing]' \
|
|
69
|
+
'-h[Show help (--help shows more)]' \
|
|
70
|
+
'--help[Show help (--help shows more)]' \
|
|
71
|
+
':target -- A publisher'\''s domain, or the URL of one document:_default' \
|
|
72
|
+
&& ret=0
|
|
73
|
+
;;
|
|
74
|
+
(conformance)
|
|
75
|
+
_arguments "${_arguments_options[@]}" : \
|
|
76
|
+
'--level=[Level to test\: core, layout or full]:LEVEL:_default' \
|
|
77
|
+
'--cmd=[External validator to test]:COMMAND:_default' \
|
|
78
|
+
'-v[List passing cases too]' \
|
|
79
|
+
'--verbose[List passing cases too]' \
|
|
80
|
+
'-h[Show help (--help shows more)]' \
|
|
81
|
+
'--help[Show help (--help shows more)]' \
|
|
82
|
+
'::dir -- The conformance directory:_files' \
|
|
83
|
+
&& ret=0
|
|
84
|
+
;;
|
|
85
|
+
(completion)
|
|
86
|
+
_arguments "${_arguments_options[@]}" : \
|
|
87
|
+
'-h[Show help (--help shows more)]' \
|
|
88
|
+
'--help[Show help (--help shows more)]' \
|
|
89
|
+
':shell -- The shell to print completions for:(bash zsh fish powershell)' \
|
|
90
|
+
&& ret=0
|
|
91
|
+
;;
|
|
92
|
+
(version)
|
|
93
|
+
_arguments "${_arguments_options[@]}" : \
|
|
94
|
+
'-h[Show help (--help shows more)]' \
|
|
95
|
+
'--help[Show help (--help shows more)]' \
|
|
96
|
+
&& ret=0
|
|
97
|
+
;;
|
|
98
|
+
esac
|
|
99
|
+
;;
|
|
100
|
+
esac
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
(( $+functions[_opencrs_commands] )) ||
|
|
104
|
+
_opencrs_commands() {
|
|
105
|
+
local commands; commands=(
|
|
106
|
+
'check:Check a creative'\''s files against the screens they target' \
|
|
107
|
+
'schema:Check documents against the OpenCRS schemas' \
|
|
108
|
+
'resolve:Show the requirements for a format or a screen' \
|
|
109
|
+
'fetch:Find a publisher'\''s specs and check which to trust' \
|
|
110
|
+
'conformance:Run the conformance suite against a validator' \
|
|
111
|
+
'completion:Print shell completions' \
|
|
112
|
+
'version:Show the tool, spec and rule pack versions' \
|
|
113
|
+
)
|
|
114
|
+
_describe -t commands 'opencrs commands' commands "$@"
|
|
115
|
+
}
|
|
116
|
+
(( $+functions[_opencrs__subcmd__check_commands] )) ||
|
|
117
|
+
_opencrs__subcmd__check_commands() {
|
|
118
|
+
local commands; commands=()
|
|
119
|
+
_describe -t commands 'opencrs check commands' commands "$@"
|
|
120
|
+
}
|
|
121
|
+
(( $+functions[_opencrs__subcmd__completion_commands] )) ||
|
|
122
|
+
_opencrs__subcmd__completion_commands() {
|
|
123
|
+
local commands; commands=()
|
|
124
|
+
_describe -t commands 'opencrs completion commands' commands "$@"
|
|
125
|
+
}
|
|
126
|
+
(( $+functions[_opencrs__subcmd__conformance_commands] )) ||
|
|
127
|
+
_opencrs__subcmd__conformance_commands() {
|
|
128
|
+
local commands; commands=()
|
|
129
|
+
_describe -t commands 'opencrs conformance commands' commands "$@"
|
|
130
|
+
}
|
|
131
|
+
(( $+functions[_opencrs__subcmd__fetch_commands] )) ||
|
|
132
|
+
_opencrs__subcmd__fetch_commands() {
|
|
133
|
+
local commands; commands=()
|
|
134
|
+
_describe -t commands 'opencrs fetch commands' commands "$@"
|
|
135
|
+
}
|
|
136
|
+
(( $+functions[_opencrs__subcmd__resolve_commands] )) ||
|
|
137
|
+
_opencrs__subcmd__resolve_commands() {
|
|
138
|
+
local commands; commands=()
|
|
139
|
+
_describe -t commands 'opencrs resolve commands' commands "$@"
|
|
140
|
+
}
|
|
141
|
+
(( $+functions[_opencrs__subcmd__schema_commands] )) ||
|
|
142
|
+
_opencrs__subcmd__schema_commands() {
|
|
143
|
+
local commands; commands=()
|
|
144
|
+
_describe -t commands 'opencrs schema commands' commands "$@"
|
|
145
|
+
}
|
|
146
|
+
(( $+functions[_opencrs__subcmd__version_commands] )) ||
|
|
147
|
+
_opencrs__subcmd__version_commands() {
|
|
148
|
+
local commands; commands=()
|
|
149
|
+
_describe -t commands 'opencrs version commands' commands "$@"
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if [ "$funcstack[1]" = "_opencrs" ]; then
|
|
153
|
+
_opencrs "$@"
|
|
154
|
+
else
|
|
155
|
+
compdef _opencrs opencrs
|
|
156
|
+
fi
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
|
|
2
|
+
using namespace System.Management.Automation
|
|
3
|
+
using namespace System.Management.Automation.Language
|
|
4
|
+
|
|
5
|
+
Register-ArgumentCompleter -Native -CommandName 'opencrs' -ScriptBlock {
|
|
6
|
+
param($wordToComplete, $commandAst, $cursorPosition)
|
|
7
|
+
|
|
8
|
+
$commandElements = $commandAst.CommandElements
|
|
9
|
+
$command = @(
|
|
10
|
+
'opencrs'
|
|
11
|
+
for ($i = 1; $i -lt $commandElements.Count; $i++) {
|
|
12
|
+
$element = $commandElements[$i]
|
|
13
|
+
if ($element -isnot [StringConstantExpressionAst] -or
|
|
14
|
+
$element.StringConstantType -ne [StringConstantType]::BareWord -or
|
|
15
|
+
$element.Value.StartsWith('-') -or
|
|
16
|
+
$element.Value -eq $wordToComplete) {
|
|
17
|
+
break
|
|
18
|
+
}
|
|
19
|
+
$element.Value
|
|
20
|
+
}) -join ';'
|
|
21
|
+
|
|
22
|
+
$completions = @(switch ($command) {
|
|
23
|
+
'opencrs' {
|
|
24
|
+
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Show help (--help shows more)')
|
|
25
|
+
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Show help (--help shows more)')
|
|
26
|
+
[CompletionResult]::new('-V', '-V ', [CompletionResultType]::ParameterName, 'Show the version')
|
|
27
|
+
[CompletionResult]::new('--version', '--version', [CompletionResultType]::ParameterName, 'Show the version')
|
|
28
|
+
[CompletionResult]::new('check', 'check', [CompletionResultType]::ParameterValue, 'Check a creative''s files against the screens they target')
|
|
29
|
+
[CompletionResult]::new('schema', 'schema', [CompletionResultType]::ParameterValue, 'Check documents against the OpenCRS schemas')
|
|
30
|
+
[CompletionResult]::new('resolve', 'resolve', [CompletionResultType]::ParameterValue, 'Show the requirements for a format or a screen')
|
|
31
|
+
[CompletionResult]::new('fetch', 'fetch', [CompletionResultType]::ParameterValue, 'Find a publisher''s specs and check which to trust')
|
|
32
|
+
[CompletionResult]::new('conformance', 'conformance', [CompletionResultType]::ParameterValue, 'Run the conformance suite against a validator')
|
|
33
|
+
[CompletionResult]::new('completion', 'completion', [CompletionResultType]::ParameterValue, 'Print shell completions')
|
|
34
|
+
[CompletionResult]::new('version', 'version', [CompletionResultType]::ParameterValue, 'Show the tool, spec and rule pack versions')
|
|
35
|
+
break
|
|
36
|
+
}
|
|
37
|
+
'opencrs;check' {
|
|
38
|
+
[CompletionResult]::new('-s', '-s', [CompletionResultType]::ParameterName, 'A screens.json to check against, repeatable')
|
|
39
|
+
[CompletionResult]::new('--spec', '--spec', [CompletionResultType]::ParameterName, 'A screens.json to check against, repeatable')
|
|
40
|
+
[CompletionResult]::new('--files', '--files', [CompletionResultType]::ParameterName, 'Directory holding the creative files')
|
|
41
|
+
[CompletionResult]::new('--now', '--now', [CompletionResultType]::ParameterName, 'Validation time, RFC 3339 (default: now)')
|
|
42
|
+
[CompletionResult]::new('--margin', '--margin', [CompletionResultType]::ParameterName, 'Warn below this multiple of the minimum text size')
|
|
43
|
+
[CompletionResult]::new('--no-files', '--no-files', [CompletionResultType]::ParameterName, 'Use the manifest''s declared values, don''t read the files')
|
|
44
|
+
[CompletionResult]::new('--json', '--json', [CompletionResultType]::ParameterName, 'Print the reports as a JSON array')
|
|
45
|
+
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Show help (--help shows more)')
|
|
46
|
+
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Show help (--help shows more)')
|
|
47
|
+
break
|
|
48
|
+
}
|
|
49
|
+
'opencrs;schema' {
|
|
50
|
+
[CompletionResult]::new('--kind', '--kind', [CompletionResultType]::ParameterName, 'Document kind (default: detect it)')
|
|
51
|
+
[CompletionResult]::new('--allow-local-http', '--allow-local-http', [CompletionResultType]::ParameterName, 'Accept http://localhost document URLs in an index')
|
|
52
|
+
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Show help (--help shows more)')
|
|
53
|
+
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Show help (--help shows more)')
|
|
54
|
+
break
|
|
55
|
+
}
|
|
56
|
+
'opencrs;resolve' {
|
|
57
|
+
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Show help (--help shows more)')
|
|
58
|
+
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Show help (--help shows more)')
|
|
59
|
+
break
|
|
60
|
+
}
|
|
61
|
+
'opencrs;fetch' {
|
|
62
|
+
[CompletionResult]::new('--token', '--token', [CompletionResultType]::ParameterName, 'Bearer token for a publisher''s partner documents, repeatable')
|
|
63
|
+
[CompletionResult]::new('-o', '-o', [CompletionResultType]::ParameterName, 'Save trusted documents under this directory')
|
|
64
|
+
[CompletionResult]::new('--output', '--output', [CompletionResultType]::ParameterName, 'Save trusted documents under this directory')
|
|
65
|
+
[CompletionResult]::new('--json', '--json', [CompletionResultType]::ParameterName, 'Print the result as JSON')
|
|
66
|
+
[CompletionResult]::new('--allow-local-http', '--allow-local-http', [CompletionResultType]::ParameterName, 'Allow http:// and connections to localhost, for testing')
|
|
67
|
+
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Show help (--help shows more)')
|
|
68
|
+
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Show help (--help shows more)')
|
|
69
|
+
break
|
|
70
|
+
}
|
|
71
|
+
'opencrs;conformance' {
|
|
72
|
+
[CompletionResult]::new('--level', '--level', [CompletionResultType]::ParameterName, 'Level to test: core, layout or full')
|
|
73
|
+
[CompletionResult]::new('--cmd', '--cmd', [CompletionResultType]::ParameterName, 'External validator to test')
|
|
74
|
+
[CompletionResult]::new('-v', '-v', [CompletionResultType]::ParameterName, 'List passing cases too')
|
|
75
|
+
[CompletionResult]::new('--verbose', '--verbose', [CompletionResultType]::ParameterName, 'List passing cases too')
|
|
76
|
+
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Show help (--help shows more)')
|
|
77
|
+
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Show help (--help shows more)')
|
|
78
|
+
break
|
|
79
|
+
}
|
|
80
|
+
'opencrs;completion' {
|
|
81
|
+
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Show help (--help shows more)')
|
|
82
|
+
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Show help (--help shows more)')
|
|
83
|
+
break
|
|
84
|
+
}
|
|
85
|
+
'opencrs;version' {
|
|
86
|
+
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Show help (--help shows more)')
|
|
87
|
+
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Show help (--help shows more)')
|
|
88
|
+
break
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
$completions.Where{ $_.CompletionText -like "$wordToComplete*" } |
|
|
93
|
+
Sort-Object -Property ListItemText
|
|
94
|
+
}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
_opencrs() {
|
|
2
|
+
local i cur prev opts cmd
|
|
3
|
+
COMPREPLY=()
|
|
4
|
+
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
|
5
|
+
cur="$2"
|
|
6
|
+
else
|
|
7
|
+
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
8
|
+
fi
|
|
9
|
+
prev="$3"
|
|
10
|
+
cmd=""
|
|
11
|
+
opts=""
|
|
12
|
+
|
|
13
|
+
for i in "${COMP_WORDS[@]:0:COMP_CWORD}"
|
|
14
|
+
do
|
|
15
|
+
case "${cmd},${i}" in
|
|
16
|
+
",$1")
|
|
17
|
+
cmd="opencrs"
|
|
18
|
+
;;
|
|
19
|
+
opencrs,check)
|
|
20
|
+
cmd="opencrs__subcmd__check"
|
|
21
|
+
;;
|
|
22
|
+
opencrs,completion)
|
|
23
|
+
cmd="opencrs__subcmd__completion"
|
|
24
|
+
;;
|
|
25
|
+
opencrs,conformance)
|
|
26
|
+
cmd="opencrs__subcmd__conformance"
|
|
27
|
+
;;
|
|
28
|
+
opencrs,fetch)
|
|
29
|
+
cmd="opencrs__subcmd__fetch"
|
|
30
|
+
;;
|
|
31
|
+
opencrs,resolve)
|
|
32
|
+
cmd="opencrs__subcmd__resolve"
|
|
33
|
+
;;
|
|
34
|
+
opencrs,schema)
|
|
35
|
+
cmd="opencrs__subcmd__schema"
|
|
36
|
+
;;
|
|
37
|
+
opencrs,version)
|
|
38
|
+
cmd="opencrs__subcmd__version"
|
|
39
|
+
;;
|
|
40
|
+
*)
|
|
41
|
+
;;
|
|
42
|
+
esac
|
|
43
|
+
done
|
|
44
|
+
|
|
45
|
+
case "${cmd}" in
|
|
46
|
+
opencrs)
|
|
47
|
+
opts="-h -V --help --version check schema resolve fetch conformance completion version"
|
|
48
|
+
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
|
|
49
|
+
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
50
|
+
return 0
|
|
51
|
+
fi
|
|
52
|
+
case "${prev}" in
|
|
53
|
+
*)
|
|
54
|
+
COMPREPLY=()
|
|
55
|
+
;;
|
|
56
|
+
esac
|
|
57
|
+
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
58
|
+
return 0
|
|
59
|
+
;;
|
|
60
|
+
opencrs__subcmd__check)
|
|
61
|
+
opts="-s -h --spec --files --no-files --json --now --margin --help"
|
|
62
|
+
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
|
|
63
|
+
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
64
|
+
return 0
|
|
65
|
+
fi
|
|
66
|
+
case "${prev}" in
|
|
67
|
+
--spec)
|
|
68
|
+
COMPREPLY=($(compgen -f "${cur}"))
|
|
69
|
+
return 0
|
|
70
|
+
;;
|
|
71
|
+
-s)
|
|
72
|
+
COMPREPLY=($(compgen -f "${cur}"))
|
|
73
|
+
return 0
|
|
74
|
+
;;
|
|
75
|
+
--files)
|
|
76
|
+
COMPREPLY=($(compgen -f "${cur}"))
|
|
77
|
+
return 0
|
|
78
|
+
;;
|
|
79
|
+
--now)
|
|
80
|
+
COMPREPLY=($(compgen -f "${cur}"))
|
|
81
|
+
return 0
|
|
82
|
+
;;
|
|
83
|
+
--margin)
|
|
84
|
+
COMPREPLY=($(compgen -f "${cur}"))
|
|
85
|
+
return 0
|
|
86
|
+
;;
|
|
87
|
+
*)
|
|
88
|
+
COMPREPLY=()
|
|
89
|
+
;;
|
|
90
|
+
esac
|
|
91
|
+
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
92
|
+
return 0
|
|
93
|
+
;;
|
|
94
|
+
opencrs__subcmd__completion)
|
|
95
|
+
opts="-h --help bash zsh fish powershell"
|
|
96
|
+
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
|
|
97
|
+
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
98
|
+
return 0
|
|
99
|
+
fi
|
|
100
|
+
case "${prev}" in
|
|
101
|
+
*)
|
|
102
|
+
COMPREPLY=()
|
|
103
|
+
;;
|
|
104
|
+
esac
|
|
105
|
+
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
106
|
+
return 0
|
|
107
|
+
;;
|
|
108
|
+
opencrs__subcmd__conformance)
|
|
109
|
+
opts="-v -h --level --cmd --verbose --help"
|
|
110
|
+
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
|
|
111
|
+
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
112
|
+
return 0
|
|
113
|
+
fi
|
|
114
|
+
case "${prev}" in
|
|
115
|
+
--level)
|
|
116
|
+
COMPREPLY=($(compgen -f "${cur}"))
|
|
117
|
+
return 0
|
|
118
|
+
;;
|
|
119
|
+
--cmd)
|
|
120
|
+
COMPREPLY=($(compgen -f "${cur}"))
|
|
121
|
+
return 0
|
|
122
|
+
;;
|
|
123
|
+
*)
|
|
124
|
+
COMPREPLY=()
|
|
125
|
+
;;
|
|
126
|
+
esac
|
|
127
|
+
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
128
|
+
return 0
|
|
129
|
+
;;
|
|
130
|
+
opencrs__subcmd__fetch)
|
|
131
|
+
opts="-o -h --token --output --json --allow-local-http --help"
|
|
132
|
+
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
|
|
133
|
+
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
134
|
+
return 0
|
|
135
|
+
fi
|
|
136
|
+
case "${prev}" in
|
|
137
|
+
--token)
|
|
138
|
+
COMPREPLY=($(compgen -f "${cur}"))
|
|
139
|
+
return 0
|
|
140
|
+
;;
|
|
141
|
+
--output)
|
|
142
|
+
COMPREPLY=($(compgen -f "${cur}"))
|
|
143
|
+
return 0
|
|
144
|
+
;;
|
|
145
|
+
-o)
|
|
146
|
+
COMPREPLY=($(compgen -f "${cur}"))
|
|
147
|
+
return 0
|
|
148
|
+
;;
|
|
149
|
+
*)
|
|
150
|
+
COMPREPLY=()
|
|
151
|
+
;;
|
|
152
|
+
esac
|
|
153
|
+
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
154
|
+
return 0
|
|
155
|
+
;;
|
|
156
|
+
opencrs__subcmd__resolve)
|
|
157
|
+
opts="-h --help"
|
|
158
|
+
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
|
|
159
|
+
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
160
|
+
return 0
|
|
161
|
+
fi
|
|
162
|
+
case "${prev}" in
|
|
163
|
+
*)
|
|
164
|
+
COMPREPLY=()
|
|
165
|
+
;;
|
|
166
|
+
esac
|
|
167
|
+
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
168
|
+
return 0
|
|
169
|
+
;;
|
|
170
|
+
opencrs__subcmd__schema)
|
|
171
|
+
opts="-h --kind --allow-local-http --help"
|
|
172
|
+
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
|
|
173
|
+
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
174
|
+
return 0
|
|
175
|
+
fi
|
|
176
|
+
case "${prev}" in
|
|
177
|
+
--kind)
|
|
178
|
+
COMPREPLY=($(compgen -f "${cur}"))
|
|
179
|
+
return 0
|
|
180
|
+
;;
|
|
181
|
+
*)
|
|
182
|
+
COMPREPLY=()
|
|
183
|
+
;;
|
|
184
|
+
esac
|
|
185
|
+
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
186
|
+
return 0
|
|
187
|
+
;;
|
|
188
|
+
opencrs__subcmd__version)
|
|
189
|
+
opts="-h --help"
|
|
190
|
+
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
|
|
191
|
+
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
192
|
+
return 0
|
|
193
|
+
fi
|
|
194
|
+
case "${prev}" in
|
|
195
|
+
*)
|
|
196
|
+
COMPREPLY=()
|
|
197
|
+
;;
|
|
198
|
+
esac
|
|
199
|
+
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
200
|
+
return 0
|
|
201
|
+
;;
|
|
202
|
+
esac
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if [[ "${BASH_VERSINFO[0]}" -eq 4 && "${BASH_VERSINFO[1]}" -ge 4 || "${BASH_VERSINFO[0]}" -gt 4 ]]; then
|
|
206
|
+
complete -F _opencrs -o nosort -o bashdefault -o default opencrs
|
|
207
|
+
else
|
|
208
|
+
complete -F _opencrs -o bashdefault -o default opencrs
|
|
209
|
+
fi
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Print an optspec for argparse to handle cmd's options that are independent of any subcommand.
|
|
2
|
+
function __fish_opencrs_global_optspecs
|
|
3
|
+
string join \n h/help V/version
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
function __fish_opencrs_needs_command
|
|
7
|
+
# Figure out if the current invocation already has a command.
|
|
8
|
+
set -l cmd (commandline -opc)
|
|
9
|
+
set -e cmd[1]
|
|
10
|
+
argparse -s (__fish_opencrs_global_optspecs) -- $cmd 2>/dev/null
|
|
11
|
+
or return
|
|
12
|
+
if set -q argv[1]
|
|
13
|
+
# Also print the command, so this can be used to figure out what it is.
|
|
14
|
+
echo $argv[1]
|
|
15
|
+
return 1
|
|
16
|
+
end
|
|
17
|
+
return 0
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
function __fish_opencrs_using_subcommand
|
|
21
|
+
set -l cmd (__fish_opencrs_needs_command)
|
|
22
|
+
test -z "$cmd"
|
|
23
|
+
and return 1
|
|
24
|
+
contains -- $cmd[1] $argv
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
complete -c opencrs -n "__fish_opencrs_needs_command" -s h -l help -d 'Show help (--help shows more)'
|
|
28
|
+
complete -c opencrs -n "__fish_opencrs_needs_command" -s V -l version -d 'Show the version'
|
|
29
|
+
complete -c opencrs -n "__fish_opencrs_needs_command" -f -a "check" -d 'Check a creative\'s files against the screens they target'
|
|
30
|
+
complete -c opencrs -n "__fish_opencrs_needs_command" -f -a "schema" -d 'Check documents against the OpenCRS schemas'
|
|
31
|
+
complete -c opencrs -n "__fish_opencrs_needs_command" -f -a "resolve" -d 'Show the requirements for a format or a screen'
|
|
32
|
+
complete -c opencrs -n "__fish_opencrs_needs_command" -f -a "fetch" -d 'Find a publisher\'s specs and check which to trust'
|
|
33
|
+
complete -c opencrs -n "__fish_opencrs_needs_command" -f -a "conformance" -d 'Run the conformance suite against a validator'
|
|
34
|
+
complete -c opencrs -n "__fish_opencrs_needs_command" -f -a "completion" -d 'Print shell completions'
|
|
35
|
+
complete -c opencrs -n "__fish_opencrs_needs_command" -f -a "version" -d 'Show the tool, spec and rule pack versions'
|
|
36
|
+
complete -c opencrs -n "__fish_opencrs_using_subcommand check" -s s -l spec -d 'A screens.json to check against, repeatable' -r
|
|
37
|
+
complete -c opencrs -n "__fish_opencrs_using_subcommand check" -l files -d 'Directory holding the creative files' -r
|
|
38
|
+
complete -c opencrs -n "__fish_opencrs_using_subcommand check" -l now -d 'Validation time, RFC 3339 (default: now)' -r
|
|
39
|
+
complete -c opencrs -n "__fish_opencrs_using_subcommand check" -l margin -d 'Warn below this multiple of the minimum text size' -r
|
|
40
|
+
complete -c opencrs -n "__fish_opencrs_using_subcommand check" -l no-files -d 'Use the manifest\'s declared values, don\'t read the files'
|
|
41
|
+
complete -c opencrs -n "__fish_opencrs_using_subcommand check" -l json -d 'Print the reports as a JSON array'
|
|
42
|
+
complete -c opencrs -n "__fish_opencrs_using_subcommand check" -s h -l help -d 'Show help (--help shows more)'
|
|
43
|
+
complete -c opencrs -n "__fish_opencrs_using_subcommand schema" -l kind -d 'Document kind (default: detect it)' -r
|
|
44
|
+
complete -c opencrs -n "__fish_opencrs_using_subcommand schema" -l allow-local-http -d 'Accept http://localhost document URLs in an index'
|
|
45
|
+
complete -c opencrs -n "__fish_opencrs_using_subcommand schema" -s h -l help -d 'Show help (--help shows more)'
|
|
46
|
+
complete -c opencrs -n "__fish_opencrs_using_subcommand resolve" -s h -l help -d 'Show help (--help shows more)'
|
|
47
|
+
complete -c opencrs -n "__fish_opencrs_using_subcommand fetch" -l token -d 'Bearer token for a publisher\'s partner documents, repeatable' -r
|
|
48
|
+
complete -c opencrs -n "__fish_opencrs_using_subcommand fetch" -s o -l output -d 'Save trusted documents under this directory' -r
|
|
49
|
+
complete -c opencrs -n "__fish_opencrs_using_subcommand fetch" -l json -d 'Print the result as JSON'
|
|
50
|
+
complete -c opencrs -n "__fish_opencrs_using_subcommand fetch" -l allow-local-http -d 'Allow http:// and connections to localhost, for testing'
|
|
51
|
+
complete -c opencrs -n "__fish_opencrs_using_subcommand fetch" -s h -l help -d 'Show help (--help shows more)'
|
|
52
|
+
complete -c opencrs -n "__fish_opencrs_using_subcommand conformance" -l level -d 'Level to test: core, layout or full' -r
|
|
53
|
+
complete -c opencrs -n "__fish_opencrs_using_subcommand conformance" -l cmd -d 'External validator to test' -r
|
|
54
|
+
complete -c opencrs -n "__fish_opencrs_using_subcommand conformance" -s v -l verbose -d 'List passing cases too'
|
|
55
|
+
complete -c opencrs -n "__fish_opencrs_using_subcommand conformance" -s h -l help -d 'Show help (--help shows more)'
|
|
56
|
+
complete -c opencrs -n "__fish_opencrs_using_subcommand completion" -s h -l help -d 'Show help (--help shows more)'
|
|
57
|
+
complete -c opencrs -n "__fish_opencrs_using_subcommand version" -s h -l help -d 'Show help (--help shows more)'
|
package/install.js
ADDED