@verbatims/cli 0.1.11 → 0.1.12
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/package.json +1 -1
- package/src/commands/authors.ts +18 -2
- package/src/commands/references.ts +22 -3
package/package.json
CHANGED
package/src/commands/authors.ts
CHANGED
|
@@ -47,6 +47,8 @@ export function registerAuthorsCommand(program: Command) {
|
|
|
47
47
|
.option('--name <name>', 'Author name')
|
|
48
48
|
.option('--job <job>', 'Job title')
|
|
49
49
|
.option('--description <text>', 'Description')
|
|
50
|
+
.option('--image-url <url>', 'Image URL')
|
|
51
|
+
.option('--fictional', 'Mark as fictional')
|
|
50
52
|
.action(async (options: Record<string, string>) => {
|
|
51
53
|
const client = await getClient()
|
|
52
54
|
const format = getFormat(program)
|
|
@@ -55,7 +57,13 @@ export function registerAuthorsCommand(program: Command) {
|
|
|
55
57
|
if (isCancel(name)) cancel('Cancelled')
|
|
56
58
|
|
|
57
59
|
const { data } = await withSpinner('Creating author', () =>
|
|
58
|
-
client.authors.create({
|
|
60
|
+
client.authors.create({
|
|
61
|
+
name: name as string,
|
|
62
|
+
job: options.job ?? null,
|
|
63
|
+
description: options.description ?? null,
|
|
64
|
+
image_url: options.imageUrl ?? null,
|
|
65
|
+
fictional: options.fictional !== undefined ? true : undefined,
|
|
66
|
+
}),
|
|
59
67
|
format,
|
|
60
68
|
)
|
|
61
69
|
console.log(chalk.green(' Author created'))
|
|
@@ -66,14 +74,22 @@ export function registerAuthorsCommand(program: Command) {
|
|
|
66
74
|
.command('update <id>')
|
|
67
75
|
.description('Update an author')
|
|
68
76
|
.option('--name <name>', 'Author name')
|
|
77
|
+
.option('--job <job>', 'Job title')
|
|
69
78
|
.option('--description <text>', 'Description')
|
|
79
|
+
.option('--image-url <url>', 'Image URL')
|
|
80
|
+
.option('--fictional', 'Mark as fictional')
|
|
81
|
+
.option('--no-fictional', 'Mark as not fictional')
|
|
70
82
|
.action(async (id: string, options: Record<string, string>) => {
|
|
71
83
|
const client = await getClient()
|
|
72
84
|
const format = getFormat(program)
|
|
73
85
|
|
|
74
86
|
const data_: Record<string, unknown> = {}
|
|
75
87
|
if (options.name) data_.name = options.name
|
|
76
|
-
if (options.
|
|
88
|
+
if (options.job !== undefined) data_.job = options.job || null
|
|
89
|
+
if (options.description !== undefined) data_.description = options.description || null
|
|
90
|
+
if (options.imageUrl !== undefined) data_.image_url = options.imageUrl || null
|
|
91
|
+
if (options.fictional !== undefined) data_.is_fictional = true
|
|
92
|
+
if (options.noFictional !== undefined) data_.is_fictional = false
|
|
77
93
|
|
|
78
94
|
const { data } = await withSpinner('Updating author', () => client.authors.update(Number(id), data_ as any), format)
|
|
79
95
|
console.log(chalk.green(' Author updated'))
|
|
@@ -49,6 +49,8 @@ export function registerReferencesCommand(program: Command) {
|
|
|
49
49
|
.option('--type <type>', 'Primary type')
|
|
50
50
|
.option('--description <text>', 'Description')
|
|
51
51
|
.option('--language <lang>', 'Original language')
|
|
52
|
+
.option('--release-date <date>', 'Release date')
|
|
53
|
+
.option('--image-url <url>', 'Image URL')
|
|
52
54
|
.action(async (options: Record<string, string>) => {
|
|
53
55
|
const client = await getClient()
|
|
54
56
|
const format = getFormat(program)
|
|
@@ -60,7 +62,16 @@ export function registerReferencesCommand(program: Command) {
|
|
|
60
62
|
if (isCancel(primaryType)) cancel('Cancelled')
|
|
61
63
|
|
|
62
64
|
const { data } = await withSpinner('Creating reference', () =>
|
|
63
|
-
client.references.create({
|
|
65
|
+
client.references.create({
|
|
66
|
+
name: name as string,
|
|
67
|
+
type: primaryType as string,
|
|
68
|
+
primary_type: primaryType as string,
|
|
69
|
+
description: options.description ?? null,
|
|
70
|
+
language: options.language,
|
|
71
|
+
original_language: options.language,
|
|
72
|
+
release_date: options.releaseDate ?? null,
|
|
73
|
+
image_url: options.imageUrl ?? null,
|
|
74
|
+
}),
|
|
64
75
|
format,
|
|
65
76
|
)
|
|
66
77
|
console.log(chalk.green(' Reference created'))
|
|
@@ -71,14 +82,22 @@ export function registerReferencesCommand(program: Command) {
|
|
|
71
82
|
.command('update <id>')
|
|
72
83
|
.description('Update a reference')
|
|
73
84
|
.option('--name <name>', 'Reference name')
|
|
85
|
+
.option('--type <type>', 'Primary type')
|
|
74
86
|
.option('--description <text>', 'Description')
|
|
87
|
+
.option('--language <lang>', 'Language')
|
|
88
|
+
.option('--release-date <date>', 'Release date')
|
|
89
|
+
.option('--image-url <url>', 'Image URL')
|
|
75
90
|
.action(async (id: string, options: Record<string, string>) => {
|
|
76
91
|
const client = await getClient()
|
|
77
92
|
const format = getFormat(program)
|
|
78
93
|
|
|
79
94
|
const data_: Record<string, unknown> = {}
|
|
80
|
-
if (options.name)
|
|
81
|
-
if (options.
|
|
95
|
+
if (options.name) data_.name = options.name
|
|
96
|
+
if (options.type !== undefined) { data_.type = options.type; data_.primary_type = options.type }
|
|
97
|
+
if (options.description !== undefined) data_.description = options.description || null
|
|
98
|
+
if (options.language !== undefined) data_.language = options.language || null
|
|
99
|
+
if (options.releaseDate !== undefined) data_.release_date = options.releaseDate || null
|
|
100
|
+
if (options.imageUrl !== undefined) data_.image_url = options.imageUrl || null
|
|
82
101
|
|
|
83
102
|
const { data } = await withSpinner('Updating reference', () => client.references.update(Number(id), data_ as any), format)
|
|
84
103
|
console.log(chalk.green(' Reference updated'))
|