Mailinglist Archive: zypp-commit (168 mails)
| < Previous | Next > |
[zypp-commit] r8083 - in /trunk/zypper: doc/zypper.8 src/zypper-info.cc src/zypper-info.h src/zypper.cc
- From: jkupec@xxxxxxxxxxxxxxxx
- Date: Sun, 09 Dec 2007 17:20:42 -0000
- Message-id: <20071209172043.013A83948D@xxxxxxxxxxxxxxxx>
Author: jkupec
Date: Sun Dec 9 18:20:42 2007
New Revision: 8083
URL: http://svn.opensuse.org/viewcvs/zypp?rev=8083&view=rev
Log:
- support for --type added to the info command
Modified:
trunk/zypper/doc/zypper.8
trunk/zypper/src/zypper-info.cc
trunk/zypper/src/zypper-info.h
trunk/zypper/src/zypper.cc
Modified: trunk/zypper/doc/zypper.8
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/doc/zypper.8?rev=8083&r1=8082&r2=8083&view=diff
==============================================================================
--- trunk/zypper/doc/zypper.8 (original)
+++ trunk/zypper/doc/zypper.8 Sun Dec 9 18:20:42 2007
@@ -49,6 +49,13 @@
Displays full info for the specified packages.
.TP
+.I \-r, \-\-repo <alias>
+Work only with the repository specified by the alias.
+.TP
+.I \-t, \-\-type <type>
+Type of resolvable (default: package)
+
+.TP
.B install (in) [options] <name> ...
.TP
.B install (in) [options] --capability <capability> ...
Modified: trunk/zypper/src/zypper-info.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-info.cc?rev=8083&r1=8082&r2=8083&view=diff
==============================================================================
--- trunk/zypper/src/zypper-info.cc (original)
+++ trunk/zypper/src/zypper-info.cc Sun Dec 9 18:20:42 2007
@@ -23,14 +23,8 @@
/**
*
*/
-void printInfo(const Zypper & zypper)
+void printInfo(const Zypper & zypper, const Resolvable::Kind & kind)
{
- Resolvable::Kind kind;
- if (zypper.command() == ZypperCommand::INFO)
- kind = ResTraits<Package>::kind;
- else if (zypper.command() == ZypperCommand::RUG_PATCH_INFO)
- kind = ResTraits<Patch>::kind;
-
ResPool pool = God->pool();
cout << endl;
@@ -67,9 +61,9 @@
cout << endl << endl;
- if (zypper.command() == ZypperCommand::INFO)
+ if (kind == ResTraits<Package>::kind)
printPkgInfo(zypper, installer.item,installed);
- else if (zypper.command() == ZypperCommand::RUG_PATCH_INFO)
+ else if (kind == ResTraits<Patch>::kind)
printPatchInfo(zypper, installer.item,installed);
}
}
Modified: trunk/zypper/src/zypper-info.h
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-info.h?rev=8083&r1=8082&r2=8083&view=diff
==============================================================================
--- trunk/zypper/src/zypper-info.h (original)
+++ trunk/zypper/src/zypper-info.h Sun Dec 9 18:20:42 2007
@@ -2,10 +2,11 @@
#define ZYPPERINFO_H_
#include "zypp/PoolItem.h"
+#include "zypp/Resolvable.h"
#include "zypper.h"
-void printInfo(const Zypper & zypper);
+void printInfo(const Zypper & zypper, const zypp::Resolvable::Kind & kind);
void printPkgInfo(const Zypper & zypper,
const zypp::PoolItem & pool_item,
Modified: trunk/zypper/src/zypper.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper.cc?rev=8083&r1=8082&r2=8083&view=diff
==============================================================================
--- trunk/zypper/src/zypper.cc (original)
+++ trunk/zypper/src/zypper.cc Sun Dec 9 18:20:42 2007
@@ -881,16 +881,17 @@
{0, 0, 0, 0}
};
specific_options = update_options;
- _command_help = _(
- // TranslatorExplanation don't translate the resolvable types
- // (see the install command comment)
+ _command_help = boost::str(format(_(
+ // TranslatorExplanation the first %s = "package, patch, pattern,
product"
+ // and the second %s = "patch"
"update (up) [options]\n"
"\n"
"Update all installed resolvables with newer versions, where
applicable.\n"
"\n"
" Command options:\n"
"\n"
- "-t, --type <type> Type of resolvable (package, patch,
pattern, product) (default: patch)\n"
+ "-t, --type <type> Type of resolvable (%s)\n"
+ " Default: %s\n"
"-r, --repo <alias> Limit updates to the repository
specified by the alias.\n"
" --skip-interactive Skip interactive updates\n"
"-l, --auto-agree-with-licenses Automatically say 'yes' to third party
license confirmation prompt.\n"
@@ -898,7 +899,7 @@
" --best-effort Do a 'best effort' approach to update,
updates to a lower than latest-and-greatest version are also acceptable\n"
" --debug-solver Create solver test case for debugging\n"
"-R, --force-resolution <on|off> Force the solver to find a solution
(even agressive)\n"
- );
+ )) % "package, patch, pattern, product" % "patch");
break;
}
@@ -1025,6 +1026,7 @@
case ZypperCommand::INFO_e:
{
static struct option info_options[] = {
+ {"type", required_argument, 0, 't'},
{"repo", required_argument, 0, 'r'},
// rug compatibility option, we have --repo
{"catalog", required_argument, 0, 'c'},
@@ -1032,16 +1034,18 @@
{0, 0, 0, 0}
};
specific_options = info_options;
- //! \todo -t option is missing (10.3+)
- _command_help = _(
- "info <name> ...\n"
- "\n"
- "Show full information for packages\n"
- "\n"
- " Command options:\n"
- "\n"
- "-r, --repo <alias> Work only with the repository specified by the
alias.\n"
- );
+ _command_help =
+ string(
+ _("info <name> ...\n"
+ "\n"
+ "Show full information for packages")) + "\n"
+ "\n" +
+ _(" Command options:") + "\n" +
+ _("-r, --repo <alias> Work only with the repository specified by the
alias.") + "\n" +
+ boost::str(format(
+ _("-t, --type <type> Type of resolvable (%s)\n"
+ " Default: %s")) % "package, patch, pattern,
product" % "package") + "\n";
+
break;
}
@@ -2019,6 +2023,23 @@
return;
}
+ switch (command().toEnum())
+ {
+ case ZypperCommand::RUG_PATCH_INFO_e:
+ kind = ResTraits<Patch>::kind;
+ break;
+ default:
+ case ZypperCommand::INFO_e:
+ // read resolvable type
+ string skind = copts.count("type")? copts["type"].front() : "package";
+ kind = string_to_kind (skind);
+ if (kind == ResObject::Kind ()) {
+ cerr << format(_("Unknown resolvable type: %s")) % skind << endl;
+ setExitCode(ZYPPER_EXIT_ERR_INVALID_ARGS);
+ return;
+ }
+ }
+
cond_init_target(*this);
init_repos(*this);
if (exitCode() != ZYPPER_EXIT_OK)
@@ -2026,7 +2047,7 @@
cond_load_resolvables(*this);
establish ();
- printInfo(*this);
+ printInfo(*this, kind);
return;
}
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx
Date: Sun Dec 9 18:20:42 2007
New Revision: 8083
URL: http://svn.opensuse.org/viewcvs/zypp?rev=8083&view=rev
Log:
- support for --type added to the info command
Modified:
trunk/zypper/doc/zypper.8
trunk/zypper/src/zypper-info.cc
trunk/zypper/src/zypper-info.h
trunk/zypper/src/zypper.cc
Modified: trunk/zypper/doc/zypper.8
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/doc/zypper.8?rev=8083&r1=8082&r2=8083&view=diff
==============================================================================
--- trunk/zypper/doc/zypper.8 (original)
+++ trunk/zypper/doc/zypper.8 Sun Dec 9 18:20:42 2007
@@ -49,6 +49,13 @@
Displays full info for the specified packages.
.TP
+.I \-r, \-\-repo <alias>
+Work only with the repository specified by the alias.
+.TP
+.I \-t, \-\-type <type>
+Type of resolvable (default: package)
+
+.TP
.B install (in) [options] <name> ...
.TP
.B install (in) [options] --capability <capability> ...
Modified: trunk/zypper/src/zypper-info.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-info.cc?rev=8083&r1=8082&r2=8083&view=diff
==============================================================================
--- trunk/zypper/src/zypper-info.cc (original)
+++ trunk/zypper/src/zypper-info.cc Sun Dec 9 18:20:42 2007
@@ -23,14 +23,8 @@
/**
*
*/
-void printInfo(const Zypper & zypper)
+void printInfo(const Zypper & zypper, const Resolvable::Kind & kind)
{
- Resolvable::Kind kind;
- if (zypper.command() == ZypperCommand::INFO)
- kind = ResTraits<Package>::kind;
- else if (zypper.command() == ZypperCommand::RUG_PATCH_INFO)
- kind = ResTraits<Patch>::kind;
-
ResPool pool = God->pool();
cout << endl;
@@ -67,9 +61,9 @@
cout << endl << endl;
- if (zypper.command() == ZypperCommand::INFO)
+ if (kind == ResTraits<Package>::kind)
printPkgInfo(zypper, installer.item,installed);
- else if (zypper.command() == ZypperCommand::RUG_PATCH_INFO)
+ else if (kind == ResTraits<Patch>::kind)
printPatchInfo(zypper, installer.item,installed);
}
}
Modified: trunk/zypper/src/zypper-info.h
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-info.h?rev=8083&r1=8082&r2=8083&view=diff
==============================================================================
--- trunk/zypper/src/zypper-info.h (original)
+++ trunk/zypper/src/zypper-info.h Sun Dec 9 18:20:42 2007
@@ -2,10 +2,11 @@
#define ZYPPERINFO_H_
#include "zypp/PoolItem.h"
+#include "zypp/Resolvable.h"
#include "zypper.h"
-void printInfo(const Zypper & zypper);
+void printInfo(const Zypper & zypper, const zypp::Resolvable::Kind & kind);
void printPkgInfo(const Zypper & zypper,
const zypp::PoolItem & pool_item,
Modified: trunk/zypper/src/zypper.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper.cc?rev=8083&r1=8082&r2=8083&view=diff
==============================================================================
--- trunk/zypper/src/zypper.cc (original)
+++ trunk/zypper/src/zypper.cc Sun Dec 9 18:20:42 2007
@@ -881,16 +881,17 @@
{0, 0, 0, 0}
};
specific_options = update_options;
- _command_help = _(
- // TranslatorExplanation don't translate the resolvable types
- // (see the install command comment)
+ _command_help = boost::str(format(_(
+ // TranslatorExplanation the first %s = "package, patch, pattern,
product"
+ // and the second %s = "patch"
"update (up) [options]\n"
"\n"
"Update all installed resolvables with newer versions, where
applicable.\n"
"\n"
" Command options:\n"
"\n"
- "-t, --type <type> Type of resolvable (package, patch,
pattern, product) (default: patch)\n"
+ "-t, --type <type> Type of resolvable (%s)\n"
+ " Default: %s\n"
"-r, --repo <alias> Limit updates to the repository
specified by the alias.\n"
" --skip-interactive Skip interactive updates\n"
"-l, --auto-agree-with-licenses Automatically say 'yes' to third party
license confirmation prompt.\n"
@@ -898,7 +899,7 @@
" --best-effort Do a 'best effort' approach to update,
updates to a lower than latest-and-greatest version are also acceptable\n"
" --debug-solver Create solver test case for debugging\n"
"-R, --force-resolution <on|off> Force the solver to find a solution
(even agressive)\n"
- );
+ )) % "package, patch, pattern, product" % "patch");
break;
}
@@ -1025,6 +1026,7 @@
case ZypperCommand::INFO_e:
{
static struct option info_options[] = {
+ {"type", required_argument, 0, 't'},
{"repo", required_argument, 0, 'r'},
// rug compatibility option, we have --repo
{"catalog", required_argument, 0, 'c'},
@@ -1032,16 +1034,18 @@
{0, 0, 0, 0}
};
specific_options = info_options;
- //! \todo -t option is missing (10.3+)
- _command_help = _(
- "info <name> ...\n"
- "\n"
- "Show full information for packages\n"
- "\n"
- " Command options:\n"
- "\n"
- "-r, --repo <alias> Work only with the repository specified by the
alias.\n"
- );
+ _command_help =
+ string(
+ _("info <name> ...\n"
+ "\n"
+ "Show full information for packages")) + "\n"
+ "\n" +
+ _(" Command options:") + "\n" +
+ _("-r, --repo <alias> Work only with the repository specified by the
alias.") + "\n" +
+ boost::str(format(
+ _("-t, --type <type> Type of resolvable (%s)\n"
+ " Default: %s")) % "package, patch, pattern,
product" % "package") + "\n";
+
break;
}
@@ -2019,6 +2023,23 @@
return;
}
+ switch (command().toEnum())
+ {
+ case ZypperCommand::RUG_PATCH_INFO_e:
+ kind = ResTraits<Patch>::kind;
+ break;
+ default:
+ case ZypperCommand::INFO_e:
+ // read resolvable type
+ string skind = copts.count("type")? copts["type"].front() : "package";
+ kind = string_to_kind (skind);
+ if (kind == ResObject::Kind ()) {
+ cerr << format(_("Unknown resolvable type: %s")) % skind << endl;
+ setExitCode(ZYPPER_EXIT_ERR_INVALID_ARGS);
+ return;
+ }
+ }
+
cond_init_target(*this);
init_repos(*this);
if (exitCode() != ZYPPER_EXIT_OK)
@@ -2026,7 +2047,7 @@
cond_load_resolvables(*this);
establish ();
- printInfo(*this);
+ printInfo(*this, kind);
return;
}
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx
| < Previous | Next > |