Commit fb8425ec authored by Lisa's avatar Lisa

Possibility to update dbs and then install in one command now added

parent 970e6f55
......@@ -148,8 +148,7 @@ CmdLine::CmdLine()
upgrade.addOption(ignore);
upgrade.addOption(ignoregroup);
AkabeiOperation help(APM::NoType, APM::Help, "h", "help", "Shows the help message", false);
AkabeiOperation help(APM::NoType, APM::Help, "h", "help", "Shows the help message", false);
AkabeiOperation version(APM::NoType, APM::Version, "v", "version", "Shows Akabei version", false);
QList<AkabeiOperation *> tmp;
......@@ -172,7 +171,7 @@ CmdLine::CmdLine()
}
/* These are the only operation we need to access directly later, so better speed up searches a bit */
specialOperations << removeallcache << help << version;
specialOperations << removeallcache << help << version << install;
}
AkabeiOption::AkabeiOption(APM::OptionName n, const char *cs, const char *cl, const char *desc, bool hasArg)
......@@ -425,6 +424,14 @@ void CmdLine::parse(int argc, char** argv)
m_freeArgs << args->arg(i);
}
/*
* Exception: -Sy without args just updates the databases, while
* -Sy with args first updates and then installs the packages
*/
if (!m_freeArgs.isEmpty() && m_operations.contains(APM::UpdateDatabases)) {
m_operations.insert(APM::Install, specialOperations.last());
}
if (!m_freeArgs.isEmpty() && !freeArgsRequired()) {
throw CmdLineException("unexpected free arguments.");
}
......
......@@ -23,23 +23,22 @@
namespace APM
{
enum OperationType {
NoType, DatabaseOperationType, QueryOperationType, RemoveOperationType, SyncOperationType, UpgradeOperationType
NoType, DatabaseOperationType, QueryOperationType, RemoveOperationType, SyncOperationType, UpgradeOperationType, PerformOperationType
};
typedef enum OperationType OperationType;
enum OptionName {
QueryPackageFile, ShowLocal, ShowLess, InstallAsDeps, InstallAsExplicit,
SkipDependencyCheck, Force, DownloadOnly, OnlyNeeded, Ignore, IgnoreGroup, DatabaseOnly,
RemoveConfig, Recursive,
RootDir, CacheDir, DBPath
RemoveConfig, Recursive, RootDir, CacheDir, DBPath
};
typedef enum OptionName OptionName;
enum OperationName {
None,
ShowChangelog, ShowInstalledAsDeps, ShowInstalledExplicitely, ShowPackagesOfGroup, ShowPackagesOfGroupLocal, ShowInformationLocal,
ShowInformation, CheckFiles, ShowOwner, ShowNotRequired, ShowUpgradeable,
Install, RemoveOldFromCache, RemoveAllCache, ListRepo, Search, UpdateDatabases, UpdateSystem,
UpdateDatabases, ShowChangelog, ShowInstalledAsDeps, ShowInstalledExplicitely, ShowPackagesOfGroup,
ShowPackagesOfGroupLocal, ShowInformationLocal, ShowInformation, CheckFiles, ShowOwner, ShowNotRequired, ShowUpgradeable,
Install, RemoveOldFromCache, RemoveAllCache, ListRepo, Search, UpdateSystem,
Remove, Cascade, Unneeded, SearchLocal,
DatabaseOperation, Upgrade, Help, Version
};
......@@ -111,7 +110,7 @@ class CmdLine
{
private:
APM::OperationType m_type;
QHash<APM::OperationName, AkabeiOperation> m_operations;
QMap<APM::OperationName, AkabeiOperation> m_operations;
QHash<APM::OptionName, AkabeiOption> m_options;
QStringList m_freeArgs;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment