feat: add upgrade command

This commit is contained in:
Julien Oculi 2024-07-15 14:58:15 +02:00
parent cbb26e87ce
commit 6659fe5ee6

20
cli.ts
View file

@ -1,14 +1,34 @@
import config from './deno.json' with { type: 'json' } import config from './deno.json' with { type: 'json' }
import { Command } from '@cliffy/command' import { Command } from '@cliffy/command'
import { UpgradeCommand } from '@cliffy/command/upgrade'
import { JsrProvider } from '@cliffy/command/upgrade/provider/jsr'
import { cmd as send } from './cli/send.ts' import { cmd as send } from './cli/send.ts'
import { cmd as preview } from './cli/preview.ts' import { cmd as preview } from './cli/preview.ts'
const upgradeCommand = new UpgradeCommand({
args: [
'--allow-read',
'--allow-env',
'--allow-net=0.0.0.0',
'--allow-sys=osRelease,networkInterfaces',
'--allow-run=/usr/sbin/sendmail,whoami',
'--name=cohamail',
],
provider: [
new JsrProvider({
package: config.name as `@${string}/${string}`,
main: 'cli',
}),
],
})
const cli = new Command() const cli = new Command()
.name('cohamail') .name('cohamail')
.description('Mail cli for coh@bit.') .description('Mail cli for coh@bit.')
.version(config.version) .version(config.version)
.command('preview', preview) .command('preview', preview)
.command('send', send) .command('send', send)
.command('upgrade', upgradeCommand)
if (import.meta.main) { if (import.meta.main) {
if (Deno.args.length) { if (Deno.args.length) {