From ea4bc45c30a5c9c133545eae0f51edb2ef9fc532 Mon Sep 17 00:00:00 2001 From: Laurent Cheylus Date: Fri, 20 Sep 2024 13:58:16 +0200 Subject: [PATCH] analyzer: move const used to download install.vsh script Move const used in download_install_vsh function from src/up.v to src/utils.v and define them private Signed-off-by: Laurent Cheylus --- src/up.v | 4 ---- src/utils.v | 5 ++++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/up.v b/src/up.v index 87662ea..55343ac 100644 --- a/src/up.v +++ b/src/up.v @@ -2,10 +2,6 @@ module main import cli import term -import os - -pub const analyzer_install_script_download_path = 'https://raw.githubusercontent.com/vlang/v-analyzer/main/install.vsh' -pub const analyzer_install_script_path = os.join_path(os.vtmp_dir(), 'v-analyzer', 'install.vsh') fn up_cmd(cmd cli.Command) ! { download_install_vsh()! diff --git a/src/utils.v b/src/utils.v index 8e03a43..fc0ae46 100644 --- a/src/utils.v +++ b/src/utils.v @@ -4,6 +4,10 @@ import os import term import net.http +const download_dir = os.join_path(os.vtmp_dir(), 'v-analyzer') +const analyzer_install_script_download_path = 'https://raw.githubusercontent.com/vlang/v-analyzer/main/install.vsh' +const analyzer_install_script_path = os.join_path(download_dir, 'install.vsh') + pub fn errorln(msg string) { eprintln('${term.red('[ERROR]')} ${msg}') } @@ -21,7 +25,6 @@ pub fn successln(msg string) { } pub fn download_install_vsh() ! { - download_dir := os.join_path(os.vtmp_dir(), 'v-analyzer') if !os.exists(download_dir) { os.mkdir(download_dir) or { return error('Failed to create tmp dir: ${err}') } }