@verbatims/cli 0.1.10 → 0.1.11

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verbatims/cli",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "CLI for the Verbatims quotes API",
5
5
  "type": "module",
6
6
  "bin": {
@@ -80,6 +80,23 @@ export function registerAuthorsCommand(program: Command) {
80
80
  output(data, format)
81
81
  })
82
82
 
83
+ authors
84
+ .command('delete <id>')
85
+ .description('Delete an author')
86
+ .option('--strategy <strategy>', 'Strategy if quotes exist: delete or anonymize')
87
+ .option('--yes', 'Skip confirmation')
88
+ .action(async (id: string, options: Record<string, string>) => {
89
+ if (!options.yes) {
90
+ const { confirm } = await import('@clack/prompts')
91
+ const confirmed = await confirm({ message: `Delete author #${id}?` })
92
+ if (isCancel(confirmed) || !confirmed) cancel('Cancelled')
93
+ }
94
+
95
+ const client = await getClient()
96
+ await withSpinner('Deleting author', () => client.authors.delete(Number(id), options.strategy as 'delete' | 'anonymize' | undefined))
97
+ console.log(chalk.green(` Author #${id} deleted`))
98
+ })
99
+
83
100
  authors
84
101
  .command('browse')
85
102
  .description('Browse authors interactively')
@@ -85,6 +85,23 @@ export function registerReferencesCommand(program: Command) {
85
85
  output(data, format)
86
86
  })
87
87
 
88
+ refs
89
+ .command('delete <id>')
90
+ .description('Delete a reference')
91
+ .option('--strategy <strategy>', 'Strategy if quotes exist: delete or anonymize')
92
+ .option('--yes', 'Skip confirmation')
93
+ .action(async (id: string, options: Record<string, string>) => {
94
+ if (!options.yes) {
95
+ const { confirm } = await import('@clack/prompts')
96
+ const confirmed = await confirm({ message: `Delete reference #${id}?` })
97
+ if (isCancel(confirmed) || !confirmed) cancel('Cancelled')
98
+ }
99
+
100
+ const client = await getClient()
101
+ await withSpinner('Deleting reference', () => client.references.delete(Number(id), options.strategy as 'delete' | 'anonymize' | undefined))
102
+ console.log(chalk.green(` Reference #${id} deleted`))
103
+ })
104
+
88
105
  refs
89
106
  .command('browse')
90
107
  .description('Browse references interactively')