wikibase-cli 17.0.2 → 17.0.4
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/README.md +3 -1
- package/bin/wb-props.js +1 -1
- package/lib/debug.js +1 -1
- package/lib/drop_non_selected_subprops.js +5 -0
- package/lib/get_pattern_filter.js +3 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -112,8 +112,10 @@ See [Config](docs/config.md)
|
|
|
112
112
|
## Debug
|
|
113
113
|
To get debugging informations, set the `DEBUG` environment variable:
|
|
114
114
|
```sh
|
|
115
|
-
# Print all debugging information
|
|
115
|
+
# Print all wikibase-cli-specific debugging information
|
|
116
116
|
export DEBUG=wikibase-cli ; wb
|
|
117
|
+
# Also print wikibase-edit debugging information
|
|
118
|
+
export DEBUG=wikibase-* ; wb
|
|
117
119
|
# Print only request debugging information
|
|
118
120
|
export DEBUG=wikibase-cli:request ; wd label Q1
|
|
119
121
|
```
|
package/bin/wb-props.js
CHANGED
|
@@ -32,7 +32,7 @@ if (program.reset) {
|
|
|
32
32
|
getLangProps(program)
|
|
33
33
|
.then(formatPropertiesData(pattern, filter, includeAllDetails, includeTypes))
|
|
34
34
|
.then(output => {
|
|
35
|
-
if (filter && filter.regex) return output.replace(filter.regex, red(
|
|
35
|
+
if (filter && filter.regex) return output.replace(filter.regex, red('$1'))
|
|
36
36
|
return output
|
|
37
37
|
})
|
|
38
38
|
.then(console.log)
|
package/lib/debug.js
CHANGED
|
@@ -2,7 +2,7 @@ import { cyan, grey } from '#lib/chalk'
|
|
|
2
2
|
|
|
3
3
|
const { DEBUG = '' } = process.env
|
|
4
4
|
const namespace = 'wikibase-cli'
|
|
5
|
-
const debugMode = DEBUG === '*' || (DEBUG.length > 0 && namespace.startsWith(DEBUG)) || DEBUG.startsWith(`${namespace}:`)
|
|
5
|
+
const debugMode = DEBUG === '*' || (DEBUG.length > 0 && namespace.startsWith(DEBUG.replace(/\*$/, ''))) || DEBUG.startsWith(`${namespace}:`)
|
|
6
6
|
const debugSection = DEBUG.split(':').slice(1).join(':').replace(/\*$/, '')
|
|
7
7
|
|
|
8
8
|
export function debug (section, ...args) {
|
|
@@ -3,6 +3,11 @@ import { pick } from 'lodash-es'
|
|
|
3
3
|
export default (entity, requestedPropsAndSubProps) => {
|
|
4
4
|
if (!requestedPropsAndSubProps) return
|
|
5
5
|
|
|
6
|
+
if (requestedPropsAndSubProps.claims && entity.statements) {
|
|
7
|
+
requestedPropsAndSubProps.statements = requestedPropsAndSubProps.claims
|
|
8
|
+
delete requestedPropsAndSubProps.claims
|
|
9
|
+
}
|
|
10
|
+
|
|
6
11
|
const requestedProps = Object.keys(requestedPropsAndSubProps)
|
|
7
12
|
requestedProps.forEach(prop => {
|
|
8
13
|
const subkeys = Object.keys(requestedPropsAndSubProps[prop])
|
|
@@ -29,7 +29,7 @@ export default (pattern, includeTypes) => {
|
|
|
29
29
|
const allLowercased = /^[^A-Z]+$/.test(pattern)
|
|
30
30
|
// The global flag is required by ./bin/wb-props to highlight matches
|
|
31
31
|
const flag = allLowercased ? 'ig' : 'g'
|
|
32
|
-
const
|
|
32
|
+
const getFilterRegex = () => new RegExp(`(${pattern})`, flag)
|
|
33
33
|
|
|
34
34
|
let typeFilter
|
|
35
35
|
if (normalizedType && isKnownType) {
|
|
@@ -43,10 +43,10 @@ export default (pattern, includeTypes) => {
|
|
|
43
43
|
if (propData == null) return false
|
|
44
44
|
const { label, description, aliases } = propData
|
|
45
45
|
const propStr = [ label, description, aliases ].join(' ')
|
|
46
|
-
return propStr.match(
|
|
46
|
+
return propStr.match(getFilterRegex()) != null
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
filterFn.regex =
|
|
49
|
+
filterFn.regex = getFilterRegex()
|
|
50
50
|
|
|
51
51
|
return filterFn
|
|
52
52
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wikibase-cli",
|
|
3
|
-
"version": "17.0.
|
|
3
|
+
"version": "17.0.4",
|
|
4
4
|
"description": "A command-line interface to Wikibase",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"shell-quote": "^1.8.1",
|
|
59
59
|
"split": "^1.0.1",
|
|
60
60
|
"through": "^2.3.8",
|
|
61
|
-
"wikibase-edit": "^6.0.
|
|
62
|
-
"wikibase-sdk": "^9.2.
|
|
61
|
+
"wikibase-edit": "^6.0.3",
|
|
62
|
+
"wikibase-sdk": "^9.2.3",
|
|
63
63
|
"wikidata-lang": "^2.0.11"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|