diff options
author | Johannes Winkelmann <jw@smts.ch> | 2006-09-08 11:35:06 +0000 |
---|---|---|
committer | Johannes Winkelmann <jw@smts.ch> | 2006-09-08 11:35:06 +0000 |
commit | 261cc30ba2e98394ad4037c6bbded8fb85ae91d9 (patch) | |
tree | f25a5b2f2212e1b154fb18cb4d8b522972e1b549 | |
parent | 01f7f05e7855a8ddde20b5d9c256727099a8ad89 (diff) | |
download | prt-get-261cc30ba2e98394ad4037c6bbded8fb85ae91d9.tar.gz prt-get-261cc30ba2e98394ad4037c6bbded8fb85ae91d9.tar.xz |
prt-get: simplify default output of dup; allow passing a printf style pattern
git-svn-id: https://crux.nu/svn/tools/prt-get/trunk@1835 0b5ae1c7-2405-0410-a7fc-ba219f786e1e
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | doc/prt-get.8 | 16 | ||||
-rw-r--r-- | src/prtget.cpp | 20 | ||||
-rw-r--r-- | src/repository.cpp | 4 |
4 files changed, 33 insertions, 8 deletions
@@ -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<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; } } 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<string, string> >& 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 ); } } |