fixed mac specific error

This commit is contained in:
mik-tf 2024-10-10 09:57:15 -04:00
parent a39c062339
commit 6d0781cdc4

23
flist.v
View File

@ -5,23 +5,27 @@ import json
import x.json2
const token_file = os.join_path(os.home_dir(), '.config', 'tfhubtoken')
const token_dir = os.join_path(os.home_dir(), '.config')
const binary_location = $if windows {
'C:\\Program Files\\flist\\flist.exe'
} $else {
'/usr/local/bin/flist'
}
const docker_cmd = $if windows {
'docker'
} $else {
'sudo docker'
}
const info_msg = $if windows {
'Note: Make sure to use an admin PowerShell. Docker Desktop must be running to use the push function.\n'
} $else $if linux {
'Note: Docker Engine must be running to use the push function.\n'
} $else $if macos {
'Note: Docker desktop must be running to use the push function.\n'
'Note: Docker Desktop must be running to use the push function.\n'
}
struct FlistItem {
@ -157,18 +161,6 @@ fn uninstall() {
// Remove the binary file
os.rm(binary_location) or { panic(err) }
success_message('Flist CLI has been removed from ' + binary_location)
// Get the directory of the binary
parent_dir := os.dir(binary_location)
// Check if the parent directory is empty
if os.is_dir_empty(parent_dir) {
// Remove the parent directory
os.rmdir(parent_dir) or { panic(err) }
success_message('The directory ' + parent_dir + ' has been removed as it is empty.')
} else {
info_message('The directory ' + parent_dir + ' is not empty, so it was not removed.')
}
} else {
info_message('Flist CLI is not installed at ' + binary_location)
}
@ -521,9 +513,12 @@ fn help() {
println(term.cyan(' ls url ') + '- List all Flists of the current user with full URLs')
println(term.cyan(' help ') + '- Display this help message\n')
println(term.bold('Usage:'))
$if !windows {
$if linux {
println(term.yellow(' sudo ./flist install'))
println(term.yellow(' sudo flist uninstall'))
} $else $if macos {
println(term.yellow(' sudo ./flist install'))
println(term.yellow(' flist uninstall'))
}
println(term.yellow(' flist login'))
println(term.yellow(' flist logout'))