From 464fc5a0d27f6053647cdb5939a936b91aaa91fc Mon Sep 17 00:00:00 2001 From: Anner Visser Date: Sun, 15 Oct 2023 19:04:09 +0200 Subject: [PATCH] Add pr-cli upgrade command Allow updating both from deno.land and github --- main.ts | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/main.ts b/main.ts index b727224..95f5c9c 100644 --- a/main.ts +++ b/main.ts @@ -1,6 +1,16 @@ import { pickCommand } from './commands/pick/pick-command.ts'; import { verifyCommand } from './commands/verify/verify-command.ts'; -import { colors, Command, CompletionsCommand, HelpCommand, log, parseFlags } from './deps.ts'; +import { + colors, + Command, + CompletionsCommand, + DenoLandProvider, + GithubProvider, + HelpCommand, + log, + parseFlags, + UpgradeCommand, +} from './deps.ts'; import { pullRequestCommand } from './commands/pull-request/pull-request-command.ts'; import { installDepsCommand } from './commands/install-deps/install-deps-command.ts'; import { getBinDir } from './lib/pr-cli/get-bin-dir.ts'; @@ -23,7 +33,17 @@ if (import.meta.main) { // cliffy built-ins main.command('help', new HelpCommand()); main.command('completions', new CompletionsCommand()); - // TODO support upgrade command: https://cliffy.io/docs@v0.25.4/command/build-in-commands#upgrade-command + main.command( + 'upgrade', + new UpgradeCommand({ + provider: [ + new DenoLandProvider({ name: 'prcli' }), + new GithubProvider({ repository: 'annervisser/pr-cli' }), + ], + main: 'main.ts', + args: ['--allow-run', '--allow-read', '--allow-env'], + }), + ); // our commands main.command(pickCommand.getName(), pickCommand);