mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-15 02:36:16 +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" :
|
||||
"package";
|
||||
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.
|
||||
const size_t maxLength = 77;
|
||||
auto trimmed = nix::trim(*description);
|
||||
auto newLinePos = trimmed.find('\n');
|
||||
auto length = newLinePos != std::string::npos ? newLinePos : trimmed.length();
|
||||
|
|
Loading…
Reference in a new issue