summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFredrik Rinnestam <fredrik@crux.nu>2017-06-17 20:29:44 +0200
committerFredrik Rinnestam <fredrik@crux.nu>2017-06-17 20:29:44 +0200
commit54dc9114702b7c83d7e47111ca2ab45faea2403c (patch)
tree7788ce89bb59fbcc517f62420e027b89be620c36
parent38e5f51b6aba611d4886cd2c69d1675b5a3e9d56 (diff)
downloadprt-get-54dc9114702b7c83d7e47111ca2ab45faea2403c.tar.gz
prt-get-54dc9114702b7c83d7e47111ca2ab45faea2403c.tar.xz
FS#593 isatty(1) check for quickdep to increase usability
-rw-r--r--src/prtget.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/prtget.cpp b/src/prtget.cpp
index 8a790bc..5e5bdc3 100644
--- a/src/prtget.cpp
+++ b/src/prtget.cpp
@@ -754,12 +754,15 @@ void PrtGet::printDepends( bool simpleListing )
const list<string>& deps = transaction.dependencies();
if ( simpleListing ) {
+ /* check if stdout is a tty, for package exclusion via: prt-get install `prt-get quickdep foobar | grep -v ^gnome-` */
+ bool const tty = isatty(1);
if ( deps.size() > 0 ) {
list<string>::const_iterator it = deps.begin();
- for ( ; it != deps.end(); ++it ) {
- cout << *it << " ";
- }
- cout << endl;
+
+ for ( ; it != deps.end(); ++it )
+ cout << *it << (tty ? " " : "\n");
+ if (tty)
+ cout << endl;
}
} else {
if ( deps.size() > 0 ) {

Generated by cgit