diff --git a/ChangeLog b/ChangeLog index cdf65b1..1ac2de3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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) diff --git a/doc/prt-get.8 b/doc/prt-get.8 index a42ea7d..6b30270 100644 --- a/doc/prt-get.8 +++ b/doc/prt-get.8 @@ -223,10 +223,24 @@ Subtrees already shown are marked with '-->' to save some space, in 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] diff --git a/src/prtget.cpp b/src/prtget.cpp index c4924b6..7d6f7f6 100644 --- a/src/prtget.cpp +++ b/src/prtget.cpp @@ -267,14 +267,24 @@ void PrtGet::listShadowed() } 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 >::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; } } diff --git a/src/repository.cpp b/src/repository.cpp index 0b91c3d..f914118 100644 --- a/src/repository.cpp +++ b/src/repository.cpp @@ -228,9 +228,9 @@ void Repository::initFromFS( const list< pair >& rootList, } 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 ); } }