wikibase-cli icon indicating copy to clipboard operation
wikibase-cli copied to clipboard

Update commander from 8 to 9

Open guimard opened this issue 3 years ago • 7 comments

Hi,

for the record, here is a patch for commander 9 (to be applied after #158) :

--- a/metadata/add-alias.js
+++ b/metadata/add-alias.js
@@ -1,6 +1,6 @@
 module.exports = {
   alias: 'aa',
-  args: '<entity> <language> <aliases>',
+  args: '[entity] [language] [aliases]',
   description: 'add one or several aliases to the list of aliases of an entity in a given language',
   options: require('../lib/common_options').editCommands,
   examples: [
--- a/metadata/add-claim.js
+++ b/metadata/add-claim.js
@@ -2,7 +2,7 @@
 
 module.exports = {
   alias: 'ac',
-  args: '<entity> <property> <value>',
+  args: '[entity] [property] [value]',
   description: 'add a claim to an entity',
   options: Object.assign({ rank: true }, editCommands),
   examples: [
--- a/metadata/add-qualifier.js
+++ b/metadata/add-qualifier.js
@@ -1,6 +1,6 @@
 module.exports = {
   alias: 'aq',
-  args: '<claim-guid> <property> <value>',
+  args: '[claim-guid] [property] [value]',
   description: 'add a qualifier to a claim',
   options: require('../lib/common_options').editCommands,
   examples: [
--- a/metadata/add-reference.js
+++ b/metadata/add-reference.js
@@ -1,6 +1,6 @@
 module.exports = {
   alias: 'ar',
-  args: '<claim-guid> <property> <value>',
+  args: '[claim-guid] [property] [value]',
   description: 'add a reference to a claim',
   options: require('../lib/common_options').editCommands,
   examples: [
--- a/metadata/aliases.js
+++ b/metadata/aliases.js
@@ -1,6 +1,6 @@
 module.exports = {
   alias: 'a',
-  args: '<entity>',
+  args: '[entity]',
   description: "display the entity's aliases",
   options: require('../lib/common_options').entityAttributeCommands,
   examples: [
--- a/metadata/claims.js
+++ b/metadata/claims.js
@@ -1,6 +1,6 @@
 module.exports = {
   alias: 'c',
-  args: '<entity> [property]',
+  args: '[entity] [property]',
   description: 'display the claims of an entity',
   options: {
     lang: true,
--- a/metadata/config.js
+++ b/metadata/config.js
@@ -1,7 +1,7 @@
 const { grey } = require('chalk')
 
 module.exports = {
-  args: '<key> [value]',
+  args: '[key] [value]',
   description: 'get and set configuration parameters',
   options: {
     lang: false,
--- a/metadata/convert.js
+++ b/metadata/convert.js
@@ -1,5 +1,5 @@
 module.exports = {
-  args: '',
+  args: '[]',
   description: 'convert batches of external ids to Wikidata ids and vice versa',
   options: {
     lang: false,
--- a/metadata/create-entity.js
+++ b/metadata/create-entity.js
@@ -2,7 +2,7 @@
 
 module.exports = {
   alias: 'ce',
-  args: '<data>',
+  args: '[data]',
   description: 'Create a new entity',
   options: editCommands,
   examples: [
--- a/metadata/data.js
+++ b/metadata/data.js
@@ -1,6 +1,6 @@
 module.exports = {
   alias: 'd',
-  args: '<entity>',
+  args: '[entity]',
   description: "output the entity's data",
   options: {
     lang: false,
--- a/metadata/delete-entity.js
+++ b/metadata/delete-entity.js
@@ -2,7 +2,7 @@
 
 module.exports = {
   alias: 'de',
-  args: '<id>',
+  args: '[id]',
   description: 'Delete an entity',
   options: editCommands,
   examples: [
--- a/metadata/description.js
+++ b/metadata/description.js
@@ -1,6 +1,6 @@
 module.exports = {
   alias: 'desc',
-  args: '<entity>',
+  args: '[entity]',
   description: "display the entity's description",
   options: require('../lib/common_options').entityAttributeCommands,
   examples: [
--- a/metadata/edit-entity.js
+++ b/metadata/edit-entity.js
@@ -2,7 +2,7 @@
 
 module.exports = {
   alias: 'ee',
-  args: '<data>',
+  args: '[data]',
   description: 'Edit an existing entity',
   options: editCommands,
   examples: [
--- a/metadata/generate-template.js
+++ b/metadata/generate-template.js
@@ -1,6 +1,6 @@
 module.exports = {
   alias: 'gt',
-  args: '<entity>',
+  args: '[entity]',
   description: "output the pre-formatted item's data optimized for edition with `wd edit-item`",
   options: {
     lang: false,
--- a/metadata/hub.js
+++ b/metadata/hub.js
@@ -1,6 +1,6 @@
 module.exports = {
   alias: 'h',
-  args: '<query>',
+  args: '[query]',
   description: 'Open a web page using the Hub, see documentation: https://tools.wmflabs.org/hub/',
   options: {
     lang: true,
--- a/metadata/id.js
+++ b/metadata/id.js
@@ -1,5 +1,5 @@
 module.exports = {
-  args: '<title>',
+  args: '[title]',
   description: 'get a Wikidata id from a Wikipedia article title',
   options: {
     lang: true,
--- a/metadata/label.js
+++ b/metadata/label.js
@@ -1,6 +1,6 @@
 module.exports = {
   alias: 'l',
-  args: '<entity>',
+  args: '[entity]',
   description: "display the entity's label",
   options: require('../lib/common_options').entityAttributeCommands,
   examples: [
--- a/metadata/lang.js
+++ b/metadata/lang.js
@@ -1,5 +1,5 @@
 module.exports = {
-  args: '<language code or wikidata id>',
+  args: '[code]',
   description: 'identify language code and return associated data',
   options: {
     lang: false,
--- a/metadata/lemma.js
+++ b/metadata/lemma.js
@@ -1,5 +1,5 @@
 module.exports = {
-  args: '<lexeme>',
+  args: '[lexeme]',
   description: "display the lexeme's lemma",
   options: require('../lib/common_options').entityAttributeCommands,
   examples: [
--- a/metadata/merge-entity.js
+++ b/metadata/merge-entity.js
@@ -2,7 +2,7 @@
 
 module.exports = {
   alias: 'me',
-  args: '<from-id> <to-id>',
+  args: '[from-id] [to-id]',
   description: 'Merge an entity into another',
   options: editCommands,
   examples: [
--- a/metadata/move-claim.js
+++ b/metadata/move-claim.js
@@ -1,6 +1,6 @@
 module.exports = {
   alias: 'mc',
-  args: '<guid|property-claims-id> <target-entity-id> <target-property-id>',
+  args: '[guid|property-claims-id] [target-entity-id] [target-property-id]',
   description: 'move claims from an entity to another and/or from a property to another',
   options: require('../lib/common_options').editCommands,
   examples: [
--- a/metadata/move-qualifier.js
+++ b/metadata/move-qualifier.js
@@ -1,6 +1,6 @@
 module.exports = {
   alias: 'mq',
-  args: '<guid> [hash] <old-property-id> <new-property-id>',
+  args: '[guid] [hash] [old-property-id] [new-property-id]',
   description: 'move qualifiers of a claim from one property to another',
   options: require('../lib/common_options').editCommands,
   examples: [
--- a/metadata/open.js
+++ b/metadata/open.js
@@ -1,6 +1,6 @@
 module.exports = {
   alias: 'o',
-  args: '<entity>',
+  args: '[entity]',
   description: "open the entity's page on Wikidata website",
   options: {
     lang: true,
--- a/metadata/query.js
+++ b/metadata/query.js
@@ -1,6 +1,6 @@
 module.exports = {
   alias: 'q',
-  args: '',
+  args: '[]',
   description: "generate and run a simple SPARQL query by passing a statement's subject, property, or object, or a couple of those",
   options: {
     lang: true,
--- a/metadata/remove-alias.js
+++ b/metadata/remove-alias.js
@@ -1,6 +1,6 @@
 module.exports = {
   alias: 'ra',
-  args: '<entity> <language> <aliases>',
+  args: '[entity] [language] [aliases]',
   description: 'remove one or several aliases from the list of aliases of an entity in a given language',
   options: require('../lib/common_options').editCommands,
   examples: [
--- a/metadata/remove-claim.js
+++ b/metadata/remove-claim.js
@@ -1,6 +1,6 @@
 module.exports = {
   alias: 'rc',
-  args: '<guids>',
+  args: '[guids]',
   description: 'remove claims by their GUIDs',
   options: require('../lib/common_options').editCommands,
   examples: [
--- a/metadata/remove-qualifier.js
+++ b/metadata/remove-qualifier.js
@@ -1,6 +1,6 @@
 module.exports = {
   alias: 'rq',
-  args: '<claim-guid> <qualifiers-hashes>',
+  args: '[claim-guid] [qualifiers-hashes]',
   description: 'remove qualifiers from a claim',
   options: require('../lib/common_options').editCommands,
   examples: [
--- a/metadata/remove-reference.js
+++ b/metadata/remove-reference.js
@@ -1,6 +1,6 @@
 module.exports = {
   alias: 'rr',
-  args: '<claim-guid> <references-hashes>',
+  args: '[claim-guid] [references-hashes]',
   description: 'remove references from a claim',
   options: require('../lib/common_options').editCommands,
   examples: [
--- a/metadata/revisions.js
+++ b/metadata/revisions.js
@@ -1,6 +1,6 @@
 module.exports = {
   alias: 'r',
-  args: '<entity>',
+  args: '[entity]',
   description: "output the entity's revisions data",
   options: {
     lang: false,
--- a/metadata/search.js
+++ b/metadata/search.js
@@ -1,6 +1,6 @@
 module.exports = {
   alias: 'f',
-  args: '<search>',
+  args: '[search]',
   description: 'search entities',
   options: {
     lang: true,
--- a/metadata/set-alias.js
+++ b/metadata/set-alias.js
@@ -1,6 +1,6 @@
 module.exports = {
   alias: 'sa',
-  args: '<entity> <language> <aliases>',
+  args: '[entity] [language] [aliases]',
   description: 'set the list of aliases of an entity in a given language',
   options: require('../lib/common_options').editCommands,
   examples: [
--- a/metadata/set-description.js
+++ b/metadata/set-description.js
@@ -1,6 +1,6 @@
 module.exports = {
   alias: 'sd',
-  args: '<entity> <language> <description>',
+  args: '[entity] [language] [description]',
   description: 'set a description on an entity in a given language',
   options: require('../lib/common_options').editCommands,
   examples: [
--- a/metadata/set-label.js
+++ b/metadata/set-label.js
@@ -1,6 +1,6 @@
 module.exports = {
   alias: 'sl',
-  args: '<entity> <language> <label>',
+  args: '[entity] [language] [label]',
   description: 'set a label on an entity in a given language',
   options: require('../lib/common_options').editCommands,
   examples: [
--- a/metadata/sparql.js
+++ b/metadata/sparql.js
@@ -1,6 +1,6 @@
 module.exports = {
   alias: 's',
-  args: '<file.rq>',
+  args: '[file.rq]',
   description: 'run a SPARQL query and get its JSON output',
   options: {
     lang: false,
--- a/metadata/summary.js
+++ b/metadata/summary.js
@@ -2,7 +2,7 @@
 
 module.exports = {
   alias: 'u',
-  args: '<entity>',
+  args: '[entity]',
   description: 'display basic information on the requested entity',
   options: Object.assign({ clipboard: false }, entityAttributeCommands),
   examples: [
--- a/metadata/update-claim.js
+++ b/metadata/update-claim.js
@@ -2,7 +2,7 @@
 
 module.exports = {
   alias: 'uc',
-  args: '<guid> <new-value>',
+  args: '[guid] [new-value]',
   description: "update a claim's value",
   options: Object.assign({ rank: true }, editCommands),
   examples: [
--- a/metadata/update-qualifier.js
+++ b/metadata/update-qualifier.js
@@ -1,6 +1,6 @@
 module.exports = {
   alias: 'uq',
-  args: '<claim-guid> <property> <old-value> <new-value>',
+  args: '[claim-guid] [property] [old-value] [new-value]',
   description: 'update a qualifier from an existing value to a new value',
   options: require('../lib/common_options').editCommands,
   examples: [

guimard avatar Mar 29 '22 16:03 guimard

thanks! Any particular reason made you try to upgrade commander?

maxlath avatar Mar 29 '22 18:03 maxlath

Hi, just because Debian forbids code copies, then Debian package should use shared commander (last version)

Cheers,

guimard avatar Mar 29 '22 18:03 guimard

I'm curious now (as I tried to look into packaging wikibase-cli for debian but gave up), how do you install it? Do you have a deb repo installing each dependencies without npm?

maxlath avatar Mar 30 '22 18:03 maxlath

Yes, only Debian dependencies

guimard avatar Mar 30 '22 20:03 guimard

Each module is a Debian package, installed in /usr/share/node_modules (or /sur/lib/x86_amd64/node_modules if containing a binary library)

guimard avatar Mar 30 '22 20:03 guimard

would you be up for documenting the process or pointing to some resource where that's documented? It could be added to the installation options

maxlath avatar Mar 30 '22 21:03 maxlath

Hi, there is no end-user doc: it works that's all :wink:. For Debian contributor we have:

Note that Debian's goal isn't to provide libraries, libraries are dependency of some apps. We rebuild/test everything from source, that's why there are now a lot of JS packages.

guimard avatar Mar 31 '22 04:03 guimard