Account for total length of 80

This commit is contained in:
Jeremy Kolb 2024-07-18 09:42:48 -04:00
parent f22cf1fd38
commit 930818bb1d
2 changed files with 3 additions and 3 deletions

View File

@ -1269,8 +1269,8 @@ struct CmdFlakeShow : FlakeCommand, MixJSON
// If the string is too long then resize add ellipses
std::string desc;
if (length > 80) {
trimmed.resize(80);
if (length > 77) {
trimmed.resize(77);
desc = trimmed.append("...");
}
else {

View File

@ -110,5 +110,5 @@ nix flake show > ./show-output.txt
test "$(awk -F '[:] ' '/aNoDescription/{print $NF}' ./show-output.txt)" = "package 'simple'"
test "$(awk -F '[:] ' '/bOneLineDescription/{print $NF}' ./show-output.txt)" = "package 'simple' - 'one line'"
test "$(awk -F '[:] ' '/cMultiLineDescription/{print $NF}' ./show-output.txt)" = "package 'simple' - 'line one'"
test "$(awk -F '[:] ' '/dLongDescription/{print $NF}' ./show-output.txt)" = "package 'simple' - '01234567890123456789012345678901234567890123456789012345678901234567890123456789...'"
test "$(awk -F '[:] ' '/dLongDescription/{print $NF}' ./show-output.txt)" = "package 'simple' - '01234567890123456789012345678901234567890123456789012345678901234567890123456...'"
test "$(awk -F '[:] ' '/eEmptyDescription/{print $NF}' ./show-output.txt)" = "package 'simple'"