Skip to content

Commit

Permalink
correct padding
Browse files Browse the repository at this point in the history
  • Loading branch information
ryenus committed Oct 13, 2022
1 parent 0ae04a8 commit fc75ca6
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions nvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1675,10 +1675,9 @@ BEGIN {
latest_lts_color = current_color;
sub(/0;/, "1;", latest_lts_color);
fmt_latest_lts = has_colors ? ("\033[" latest_lts_color "(Latest LTS: %s)\033[0m") : "(Latest LTS: %s)";
fmt_old_lts = has_colors ? ("\033[" old_lts_color "(LTS: %s)\033[0m") : "(LTS: %s)";
fmt_aux[1] = " ";
fmt_aux[2] = " * ";
fmt_latest_lts = has_colors ? ("\033[" latest_lts_color " (Latest LTS: %s)\033[0m") : " (Latest LTS: %s)";
fmt_old_lts = has_colors ? ("\033[" old_lts_color " (LTS: %s)\033[0m") : " (LTS: %s)";
split(remote_versions, lines, "|");
split(installed_versions, installed, "|");
Expand Down Expand Up @@ -1706,13 +1705,14 @@ BEGIN {
fmt_version = fmt_installed;
}
aux = (!has_colors && is_installed) + 1;
padding = (!has_colors && is_installed) ? "" : " ";
if (cols == 1) {
formatted = sprintf(fmt_version, version);
} else if (cols == 2) {
formatted = sprintf((fmt_version fmt_aux[aux] fmt_old_lts), version, fields[2]);
formatted = sprintf((fmt_version padding fmt_old_lts), version, fields[2]);
} else if (cols == 3 && fields[3] == "*") {
formatted = sprintf((fmt_version fmt_aux[aux] fmt_latest_lts), version, fields[2]);
formatted = sprintf((fmt_version padding fmt_latest_lts), version, fields[2]);
}
output[n] = formatted;
Expand Down

0 comments on commit fc75ca6

Please sign in to comment.