1.1.2Updated a month ago
import { execSync } from "node:child_process";
import type { I_CommandCode } from "../command_runner.ts";
import { Command } from "./enum.ts";
import { HOST_URL } from "../../config.ts";

import meta from '../../../deno.json' with { type: 'json' };

export const update_command = {
  command: Command.update,
  aliases: [],
  description: 'Updates viapak to the latest version',
  help_text: [],
  execute: ({ options }) => {
    if(options.viapak_has_been_updated) {
      console.log(`Viapak has been updated to v${meta.version}`);
      return;
    }

    execSync(`deno run -r ${HOST_URL} update --viapak_has_been_updated`);
  }
} as I_CommandCode;