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
This commit is contained in:
Johannes Winkelmann 2006-09-08 11:35:06 +00:00
parent 01f7f05e78
commit 261cc30ba2
4 changed files with 33 additions and 8 deletions

View File

@ -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)

View File

@ -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]

View File

@ -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;
}
}

View File

@ -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 );
}
}