Skip to content

Commit

Permalink
analyzer: move const used to download install.vsh script
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
lcheylus committed Sep 20, 2024
1 parent 4f93826 commit ea4bc45
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 0 additions & 4 deletions src/up.v
Original file line number Diff line number Diff line change
Expand Up @@ -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()!
Expand Down
5 changes: 4 additions & 1 deletion src/utils.v
Original file line number Diff line number Diff line change
Expand Up @@ -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}')
}
Expand All @@ -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}') }
}
Expand Down

0 comments on commit ea4bc45

Please sign in to comment.