From ed1ce0cc0f944bda4679aff1b7d675d5ad6ad68b Mon Sep 17 00:00:00 2001 From: Fabian Stamm Date: Wed, 14 Oct 2020 22:04:18 +0200 Subject: [PATCH] Improving update support --- cli/commands/upgrade.ts | 17 +++++++++++++++-- cli/meta.json | 2 +- cli/version.ts | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/cli/commands/upgrade.ts b/cli/commands/upgrade.ts index 31cb5d8..d1d18f9 100644 --- a/cli/commands/upgrade.ts +++ b/cli/commands/upgrade.ts @@ -1,8 +1,21 @@ import { Cliffy, Colors } from "../deps.ts"; +import { version } from "../version.ts"; export default async function upgrade() { + const meta = await fetch( + "https://deno.hibas123.de/raw/@denreg-cli/meta.json" + ).then((e) => e.json()); + + if (meta.version === version) { + const res = await Cliffy.Confirm.prompt({ + message: Colors.yellow("No update available!") + " Continue?", + default: false, + }); + if (!res) return; + } + const res = await Cliffy.Confirm.prompt({ - message: "Are you sure you want to upgrade the denreg cli?", + message: "Are you sure you want to upgrade?", default: true, }); @@ -14,7 +27,7 @@ export default async function upgrade() { "-A", "--unstable", "-f", - "https://deno.hibas123.de/raw/@denreg-cli/denreg.ts", + `https://deno.hibas123.de/raw/@denreg-cli@${meta.version}/denreg.ts`, ], }); diff --git a/cli/meta.json b/cli/meta.json index e78eb27..93d346a 100644 --- a/cli/meta.json +++ b/cli/meta.json @@ -1,6 +1,6 @@ { "name": "@denreg-cli", - "version": "0.2.7", + "version": "0.2.9", "description": "CLI for the DenReg package registry", "author": "Fabian Stamm ", "contributors": [], diff --git a/cli/version.ts b/cli/version.ts index 67ec2d3..8fba87d 100644 --- a/cli/version.ts +++ b/cli/version.ts @@ -1 +1 @@ -export const version = "0.2.7" \ No newline at end of file +export const version = "0.2.9" \ No newline at end of file