Author: jw Date: 2006-09-08 13:35:06 +0200 (Fri, 08 Sep 2006) New Revision: 1835 Modified: tools/prt-get/trunk/ChangeLog tools/prt-get/trunk/doc/prt-get.8 tools/prt-get/trunk/src/prtget.cpp tools/prt-get/trunk/src/repository.cpp Log: prt-get: simplify default output of dup; allow passing a printf style pattern Modified: tools/prt-get/trunk/ChangeLog =================================================================== --- tools/prt-get/trunk/ChangeLog 2006-09-07 22:40:39 UTC (rev 1834) +++ tools/prt-get/trunk/ChangeLog 2006-09-08 11:35:06 UTC (rev 1835) @@ -2,6 +2,7 @@ - Show undecided versions in diff and sysup when using "prefer higher" - fix display bug in "dependent" - fix bug in version comparator +- Simplify output of 'dup', suggested by maro (-v -> old format) * 0.5.12 00.04.2006 Johannes Winkelmann - Add 'depinst' in 'help' (thanks Simone) Modified: tools/prt-get/trunk/doc/prt-get.8 =================================================================== --- tools/prt-get/trunk/doc/prt-get.8 2006-09-07 22:40:39 UTC (rev 1834) +++ tools/prt-get/trunk/doc/prt-get.8 2006-09-08 11:35:06 UTC (rev 1835) @@ -223,12 +223,26 @@ order to show them all, add the --all switch .TP -.B dup +.B dup [-v] [format] List ports which can be found in multiple directories configured in .B /etc/prt-get.conf +Use the verbose switch to simulate the output of version 5.12 and older (likely +to go away in the future). The format string can be used to create user +specified formats. The following symbols are currently replaced: +.TP +\ \ \ \(bu +%n \-> name of the port .TP +\ \ \ \(bu +%1 \-> Port which takes precedence + +.TP +\ \ \ \(bu +%2 \-> Port which is hidden + +.TP .B list [\-v|\-vv] [filter] [--path] [--regex] List ports available in the ports tree. It's basically the same as .B ports \-l Modified: tools/prt-get/trunk/src/prtget.cpp =================================================================== --- tools/prt-get/trunk/src/prtget.cpp 2006-09-07 22:40:39 UTC (rev 1834) +++ tools/prt-get/trunk/src/prtget.cpp 2006-09-08 11:35:06 UTC (rev 1835) @@ -267,14 +267,24 @@ } initRepo( true ); - cout << "Hidden packages:" << endl; + + string format = "%1 > %2\n"; + if (m_parser->otherArgs().size() > 0) + format = *(m_parser->otherArgs().begin()); + else if (m_parser->verbose() > 0) + format = "* %n\n %1 preceeds over \n %2\n"; + + string output; map<string, pair<string, string> >::const_iterator it = m_repo->shadowedPackages().begin(); for ( ; it != m_repo->shadowedPackages().end(); ++it ) { - string name = it->first; - cout << "* " << name << endl; - cout << " " << it->second.second << " preceeds over" << endl; - cout << " " << it->second.first << endl; + output = format; + StringHelper::replaceAll(output, "%n", it->first); + StringHelper::replaceAll(output, "%1", it->second.second); + StringHelper::replaceAll(output, "%2", it->second.first); + + StringHelper::replaceAll(output, "\\n", "\n"); + cout << output; } } Modified: tools/prt-get/trunk/src/repository.cpp =================================================================== --- tools/prt-get/trunk/src/repository.cpp 2006-09-07 22:40:39 UTC (rev 1834) +++ tools/prt-get/trunk/src/repository.cpp 2006-09-08 11:35:06 UTC (rev 1835) @@ -228,9 +228,9 @@ } else if ( listDuplicate ) { Package* old = hidden->second; string ps = p->path() + "/" + p->name() + - "-" + p->version(); + " " + p->versionReleaseString(); string os = old->path() + "/" + old->name() + - "-" + old->version(); + " " + old->versionReleaseString(); m_shadowedPackages[name] = make_pair( ps, os ); } }