mirror of
https://github.com/NixOS/nix
synced 2025-07-07 14:21:48 +02:00
Use window size
This commit is contained in:
parent
1c5f1de43f
commit
9bf6684b08
1 changed files with 4 additions and 1 deletions
|
@ -1263,8 +1263,11 @@ struct CmdFlakeShow : FlakeCommand, MixJSON
|
||||||
attrPath.size() >= 1 && attrPathS[0] == "hydraJobs" ? "derivation" :
|
attrPath.size() >= 1 && attrPathS[0] == "hydraJobs" ? "derivation" :
|
||||||
"package";
|
"package";
|
||||||
if (description && !description->empty()) {
|
if (description && !description->empty()) {
|
||||||
|
// Maximum length to print
|
||||||
|
size_t maxLength = getWindowSize().second;
|
||||||
|
if (maxLength == 0)
|
||||||
|
maxLength = 77;
|
||||||
// Trim the string and only display the first line of the description.
|
// Trim the string and only display the first line of the description.
|
||||||
const size_t maxLength = 77;
|
|
||||||
auto trimmed = nix::trim(*description);
|
auto trimmed = nix::trim(*description);
|
||||||
auto newLinePos = trimmed.find('\n');
|
auto newLinePos = trimmed.find('\n');
|
||||||
auto length = newLinePos != std::string::npos ? newLinePos : trimmed.length();
|
auto length = newLinePos != std::string::npos ? newLinePos : trimmed.length();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue