@verbatims/cli 0.1.17 → 0.1.18
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 +2 -0
- package/package.json +1 -1
- package/src/commands/quotes.ts +17 -8
package/README.md
CHANGED
|
@@ -32,6 +32,8 @@ verbatims quotes sources create 123 --source-type book --source-url https://exam
|
|
|
32
32
|
# Create a quote with a source
|
|
33
33
|
verbatims quotes create --source-type book --source-url https://example.com/edition
|
|
34
34
|
|
|
35
|
+
The quote-level `--author-id`, `--reference-id`, `--source-type`, and `--source-url` options are deprecated compatibility options. New integrations should use the SDK `provenance` payload; the dedicated `quotes attributions` and `quotes sources` commands manage secondary provenance.
|
|
36
|
+
|
|
35
37
|
# Browse interactively
|
|
36
38
|
verbatims quotes browse
|
|
37
39
|
|
package/package.json
CHANGED
package/src/commands/quotes.ts
CHANGED
|
@@ -10,6 +10,13 @@ function getFormat(program: Command): Format {
|
|
|
10
10
|
return (program.opts().format ?? 'table') as Format
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
function warnLegacyQuoteOptions(options: Record<string, unknown>): void {
|
|
14
|
+
const fields = ['authorId', 'referenceId', 'sourceType', 'sourceUrl']
|
|
15
|
+
if (fields.some(field => options[field] !== undefined)) {
|
|
16
|
+
console.error(chalk.yellow('Warning: quote provenance options are deprecated; use the provenance API fields instead.'))
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
13
20
|
export function registerQuotesCommand(program: Command) {
|
|
14
21
|
const quotes = program.command('quotes').description('Manage quotes')
|
|
15
22
|
|
|
@@ -66,13 +73,14 @@ export function registerQuotesCommand(program: Command) {
|
|
|
66
73
|
.description('Create a quote')
|
|
67
74
|
.option('--name <text>', 'Quote text')
|
|
68
75
|
.option('--language <lang>', 'Language')
|
|
69
|
-
.option('--author-id <id>', 'Author ID')
|
|
70
|
-
.option('--reference-id <id>', 'Reference ID')
|
|
71
|
-
.option('--source-type <type>', 'Source type')
|
|
72
|
-
.option('--source-url <url>', 'Source URL')
|
|
76
|
+
.option('--author-id <id>', 'Author ID (deprecated)')
|
|
77
|
+
.option('--reference-id <id>', 'Reference ID (deprecated)')
|
|
78
|
+
.option('--source-type <type>', 'Source type (deprecated)')
|
|
79
|
+
.option('--source-url <url>', 'Source URL (deprecated)')
|
|
73
80
|
.action(async (options: Record<string, string>) => {
|
|
74
81
|
const client = await getClient()
|
|
75
82
|
const format = getFormat(program)
|
|
83
|
+
warnLegacyQuoteOptions(options)
|
|
76
84
|
|
|
77
85
|
const name = options.name ?? await text({ message: 'Quote text', validate: (v) => !v ? 'Required' : undefined })
|
|
78
86
|
if (isCancel(name)) cancel('Cancelled')
|
|
@@ -105,13 +113,14 @@ export function registerQuotesCommand(program: Command) {
|
|
|
105
113
|
.description('Update a quote')
|
|
106
114
|
.option('--name <text>', 'Quote text')
|
|
107
115
|
.option('--language <lang>', 'Language')
|
|
108
|
-
.option('--author-id <id>', 'Author ID')
|
|
109
|
-
.option('--reference-id <id>', 'Reference ID')
|
|
110
|
-
.option('--source-type <type>', 'Source type')
|
|
111
|
-
.option('--source-url <url>', 'Source URL')
|
|
116
|
+
.option('--author-id <id>', 'Author ID (deprecated)')
|
|
117
|
+
.option('--reference-id <id>', 'Reference ID (deprecated)')
|
|
118
|
+
.option('--source-type <type>', 'Source type (deprecated)')
|
|
119
|
+
.option('--source-url <url>', 'Source URL (deprecated)')
|
|
112
120
|
.action(async (id: string, options: Record<string, string>) => {
|
|
113
121
|
const client = await getClient()
|
|
114
122
|
const format = getFormat(program)
|
|
123
|
+
warnLegacyQuoteOptions(options)
|
|
115
124
|
|
|
116
125
|
const data_: Record<string, unknown> = {}
|
|
117
126
|
if (options.name) { data_.name = options.name; data_.content = options.name }
|