[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
151/376: Use pager for more commands
From: |
Ludovic Courtès |
Subject: |
151/376: Use pager for more commands |
Date: |
Wed, 28 Jan 2015 22:04:40 +0000 |
civodul pushed a commit to tag 1.8
in repository guix.
commit 43579c9799e93120620481b72785f382f9c264d9
Author: Eelco Dolstra <address@hidden>
Date: Wed Aug 20 21:26:37 2014 +0200
Use pager for more commands
---
src/nix-env/nix-env.cc | 7 ++++++-
src/nix-store/nix-store.cc | 2 ++
2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc
index 325c8b9..5116d95 100644
--- a/src/nix-env/nix-env.cc
+++ b/src/nix-env/nix-env.cc
@@ -977,6 +977,9 @@ static void opQuery(Globals & globals, Strings opFlags,
Strings opArgs)
return;
}
+ bool tty = isatty(STDOUT_FILENO);
+ RunPager pager;
+
Table table;
std::ostringstream dummy;
XMLWriter xml(true, *(xmlOutput ? &cout : &dummy));
@@ -1049,7 +1052,7 @@ static void opQuery(Globals & globals, Strings opFlags,
Strings opArgs)
}
} else {
string column = (string) "" + ch + " " + version;
- if (diff == cvGreater && isatty(STDOUT_FILENO))
+ if (diff == cvGreater && tty)
column = ANSI_RED + column + ANSI_NORMAL;
columns.push_back(column);
}
@@ -1240,6 +1243,8 @@ static void opListGenerations(Globals & globals, Strings
opFlags, Strings opArgs
int curGen;
Generations gens = findGenerations(globals.profile, curGen);
+ RunPager pager;
+
for (Generations::iterator i = gens.begin(); i != gens.end(); ++i) {
tm t;
if (!localtime_r(&i->creationTime, &t)) throw Error("cannot convert
time");
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc
index 24ecf84..8c37448 100644
--- a/src/nix-store/nix-store.cc
+++ b/src/nix-store/nix-store.cc
@@ -299,6 +299,8 @@ static void opQuery(Strings opFlags, Strings opArgs)
else if (*i == "--include-outputs") includeOutputs = true;
else throw UsageError(format("unknown flag ‘%1%’") % *i);
+ RunPager pager;
+
switch (query) {
case qOutputs: {
- 158/376: fix disappearing bash arguments, (continued)
- 158/376: fix disappearing bash arguments, Ludovic Courtès, 2015/01/28
- 150/376: Provide reasonable default flags for $LESS, Ludovic Courtès, 2015/01/28
- 149/376: Merge commit '2aa93858afee22e0c32d8f4366970976374091ac', Ludovic Courtès, 2015/01/28
- 156/376: Use PR_SET_PDEATHSIG to ensure child cleanup, Ludovic Courtès, 2015/01/28
- 155/376: Set a curl timeout on binary cache lookups, Ludovic Courtès, 2015/01/28
- 163/376: Fix manual build, Ludovic Courtès, 2015/01/28
- 159/376: Document the "out" usage in allowedReferences, Ludovic Courtès, 2015/01/28
- 154/376: Use unshare() instead of clone(), Ludovic Courtès, 2015/01/28
- 162/376: Introduce allowedRequisites feature, Ludovic Courtès, 2015/01/28
- 157/376: Fix tests, Ludovic Courtès, 2015/01/28
- 151/376: Use pager for more commands,
Ludovic Courtès <=
- 153/376: Fix a segfault in ‘nix-env -qa’, Ludovic Courtès, 2015/01/28
- 164/376: allowedRequisites: Drop stdenv mention, Ludovic Courtès, 2015/01/28
- 160/376: Fix building with Clang, Ludovic Courtès, 2015/01/28
- 170/376: Fix dependency ordering, Ludovic Courtès, 2015/01/28
- 169/376: Hack for supporting Boost on Homebrew, Ludovic Courtès, 2015/01/28
- 166/376: Shut up "Wide character" warnings in Perl scripts, Ludovic Courtès, 2015/01/28
- 167/376: Add an 'optimiseStore' remote procedure call., Ludovic Courtès, 2015/01/28
- 171/376: Fix build-remote.pl, Ludovic Courtès, 2015/01/28
- 172/376: tests/remote-builds.nix: Time out faster, Ludovic Courtès, 2015/01/28
- 176/376: Add support for using a build directory, Ludovic Courtès, 2015/01/28