Update more UI messages for consistency.

This commit is contained in:
Luke Sampson
2017-02-13 20:53:36 +11:00
parent 1dc4d87626
commit e8e5ac5615
8 changed files with 30 additions and 30 deletions

View File

@@ -22,7 +22,7 @@ function do_uninstall($app, $global) {
$install = install_info $app $version $global
$architecture = $install.architecture
echo "Uninstalling $app"
echo "Uninstalling '$app'"
run_uninstaller $manifest $architecture $dir
rm_shims $manifest $global $architecture

View File

@@ -133,7 +133,7 @@ function movedir($from, $to) {
}
function shim($path, $global, $name, $arg) {
if(!(test-path $path)) { abort "Can't shim $(fname $path): couldn't find $path" }
if(!(test-path $path)) { abort "Can't shim '$(fname $path)': couldn't find '$path'." }
$abs_shimdir = ensure (shimdir $global)
if(!$name) { $name = strip_ext (fname $path) }

View File

@@ -21,7 +21,7 @@ function file_requires_7zip($fname) {
function extract_7zip($path, $to, $recurse) {
$output = 7z x "$path" -o"$to" -y
if($lastexitcode -ne 0) { abort "Exit code was $lastexitcode" }
if($lastexitcode -ne 0) { abort "Exit code was $lastexitcode." }
# check for tar
$tar = (split-path $path -leaf) -replace '\.[^\.]*$', ''

View File

@@ -25,14 +25,14 @@ function dep_resolve($app, $arch, $resolved, $unresolved) {
$query = $app
$app, $bucket = app $query
$null, $manifest, $null, $null = locate $app $bucket
if(!$manifest) { abort "Couldn't find manifest for $query" }
if(!$manifest) { abort "Couldn't find manifest for '$query'." }
$deps = @(install_deps $manifest $arch) + @(runtime_deps $manifest) | select -uniq
foreach($dep in $deps) {
if($resolved -notcontains $dep) {
if($unresolved -contains $dep) {
abort "Circular dependency detected: $app -> $dep"
abort "Circular dependency detected: '$app' -> '$dep'."
}
dep_resolve $dep $arch $resolved $unresolved
}

View File

@@ -13,7 +13,7 @@ function install_app($app, $architecture, $global, $suggested) {
$check_hash = $true
if(!$manifest) {
abort "Couldn't find manifest for $app$(if($url) { " at the URL $url" })"
abort "Couldn't find manifest for '$app'$(if($url) { " at the URL $url" })."
}
$version = $manifest.version
@@ -28,7 +28,7 @@ function install_app($app, $architecture, $global, $suggested) {
$check_hash = $false
}
echo "Installing $app ($version)"
echo "Installing '$app' ($version)."
$dir = ensure (versiondir $app $version $global)
@@ -64,7 +64,7 @@ function ensure_architecture($architecture_opt) {
switch($architecture_opt) {
'' { return default_architecture }
{ @('32bit','64bit') -contains $_ } { return $_ }
default { abort "invalid architecture: '$architecture'"}
default { abort "Invalid architecture: '$architecture'."}
}
}
@@ -406,7 +406,7 @@ function hash_for_url($manifest, $url, $arch) {
$urls = @(url $manifest $arch)
$index = [array]::indexof($urls, $url)
if($index -eq -1) { abort "Couldn't find hash in manifest for $url" }
if($index -eq -1) { abort "Couldn't find hash in manifest for '$url'." }
@($hashes)[$index]
}
@@ -415,7 +415,7 @@ function hash_for_url($manifest, $url, $arch) {
function check_hash($file, $url, $manifest, $arch) {
$hash = hash_for_url $manifest $url $arch
if(!$hash) {
warn "Warning: No hash in manifest. SHA256 is:`n$(compute_hash (fullpath $file) 'sha256')"
warn "Warning: No hash in manifest. SHA256 is:`n $(compute_hash (fullpath $file) 'sha256')"
return $true
}
@@ -427,13 +427,13 @@ function check_hash($file, $url, $manifest, $arch) {
}
if(@('md5','sha1','sha256', 'sha512') -notcontains $type) {
return $false, "Hash type $type isn't supported."
return $false, "Hash type '$type' isn't supported."
}
$actual = compute_hash (fullpath $file) $type
if($actual -ne $expected) {
return $false, "Hash check failed for $url.`nExpected:`n $($expected)`nActual:`n $($actual)"
return $false, "Hash check failed for '$url'.`nExpected:`n $($expected)`nActual:`n $($actual)"
}
write-host "ok."
return $true
@@ -480,7 +480,7 @@ function run($exe, $arg, $msg, $continue_exit_codes) {
warn $continue_exit_codes[$proc.exitcode]
return $true
}
write-host "Exit code was $($proc.exitcode)"; return $false
write-host "Exit code was $($proc.exitcode)."; return $false
}
} catch {
write-host -f darkred $_.exception.tostring()
@@ -645,14 +645,14 @@ function create_shims($manifest, $dir, $global, $arch) {
$shims = @(arch_specific 'bin' $manifest $arch)
$shims | ?{ $_ -ne $null } | % {
$target, $name, $arg = shim_def $_
echo "Creating shim for $name"
echo "Creating shim for '$name'."
# check valid bin
$bin = "$dir\$target"
if(!(is_in_dir $dir $bin)) {
abort "Error in manifest: bin '$target' is outside the app directory."
}
if(!(test-path $bin)) { abort "Can't shim $target`: File doesn't exist."}
if(!(test-path $bin)) { abort "Can't shim '$target': File doesn't exist."}
shim "$dir\$target" $global $name $arg
}
@@ -662,9 +662,9 @@ function rm_shim($name, $shimdir) {
$shim = "$shimdir\$name.ps1"
if(!(test-path $shim)) { # handle no shim from failed install
warn "Shim for $name is missing. Skipping."
warn "Shim for '$name' is missing. Skipping."
} else {
echo "Removing shim for $name"
echo "Removing shim for '$name'."
rm $shim
}
@@ -703,7 +703,7 @@ function link_current($versiondir) {
$currentdir = current_dir $versiondir
write-host "Linking $(friendly_path $currentdir) => $(friendly_path $versiondir)"
write-host "Linking '$(friendly_path $currentdir)' => '$(friendly_path $versiondir)'."
if($currentdir -eq $versiondir) {
abort "Error: Version 'current' is not allowed!"
@@ -728,7 +728,7 @@ function unlink_current($versiondir) {
$currentdir = current_dir $versiondir
if(test-path $currentdir) {
write-host "Unlinking $(friendly_path $currentdir)"
write-host "Unlinking '$(friendly_path $currentdir)'."
# remove the junction
cmd /c rmdir $currentdir
@@ -743,14 +743,14 @@ function ensure_install_dir_not_in_path($dir, $global) {
$fixed, $removed = find_dir_or_subdir $path "$dir"
if($removed) {
$removed | % { "Installer added $(friendly_path $_) to path. Removing."}
$removed | % { "Installer added '$(friendly_path $_)' to path. Removing."}
env 'path' $global $fixed
}
if(!$global) {
$fixed, $removed = find_dir_or_subdir (env 'path' $true) "$dir"
if($removed) {
$removed | % { warn "Installer added $_ to system path. You might want to remove this manually (requires admin permission)."}
$removed | % { warn "Installer added '$_' to system path. You might want to remove this manually (requires admin permission)."}
}
}
}

View File

@@ -28,7 +28,7 @@ function create_manifest($url) {
$manifest | convertto-json | out-file -filepath "$name.json" -encoding utf8
$manifest_path = join-path $pwd "$name.json"
write-host "Created $manifest_path"
write-host "Created '$manifest_path'."
}
function new_manifest() {

View File

@@ -90,8 +90,8 @@ function search_remotes($query) {
}
$results |% {
"$($_.bucket) bucket:"
$_.results |% { " $_" }
"'$($_.bucket)'' bucket:"
$_.results |% { " $_" }
""
}
}
@@ -103,9 +103,9 @@ function search_remotes($query) {
$name = "$_"
if(!$_) { $name = "main" }
"$name bucket:"
"'$name' bucket:"
$res | % {
$item = " $($_.name) ($($_.version))"
$item = " $($_.name) ($($_.version))"
if($_.bin) { $item += " --> includes '$($_.bin)'" }
$item
}

View File

@@ -47,7 +47,7 @@ foreach($app in $apps) {
}
$version = current_version $app $global
"Uninstalling $app ($version)."
"Uninstalling '$app' ($version)."
$dir = versiondir $app $version $global
try {
@@ -75,15 +75,15 @@ foreach($app in $apps) {
env_rm $manifest $global
try { rm -r $dir -ea stop -force }
catch { abort "Couldn't remove $(friendly_path $dir); it may be in use." }
catch { abort "Couldn't remove '$(friendly_path $dir)'; it may be in use." }
# remove older versions
$old = @(versions $app $global)
foreach($oldver in $old) {
"Removing older version, $oldver"
"Removing older version ($oldver)."
$dir = versiondir $app $oldver $global
try { rm -r -force -ea stop $dir }
catch { abort "Couldn't remove $(friendly_path $dir); it may be in use." }
catch { abort "Couldn't remove '$(friendly_path $dir)'; it may be in use." }
}
if(@(versions $app).length -eq 0) {