* getpkg, delpkg, and so on now accept multiple arguments.

This commit is contained in:
Eelco Dolstra 2003-04-24 11:41:24 +00:00
parent 49e0d743d7
commit 9713e8577f

View file

@ -534,8 +534,7 @@ void listInstalledPkgs()
void printInfo(Strings::iterator first, Strings::iterator last) void printInfo(Strings::iterator first, Strings::iterator last)
{ {
for (Strings::iterator it = first; it != last; it++) for (Strings::iterator it = first; it != last; it++) {
{
try { try {
cout << *it << " " << queryPkgId(*it) << endl; cout << *it << " " << queryPkgId(*it) << endl;
} catch (Error & e) { // !!! more specific } catch (Error & e) { // !!! more specific
@ -632,18 +631,18 @@ Subcommands:
verify verify
Remove stale entries from the database. Remove stale entries from the database.
regfile FILENAME regfile FILENAME...
Register FILENAME keyed by its hash. Register each FILENAME keyed by its hash.
reginst HASH PATH reginst HASH PATH
Register an installed package. Register an installed package.
getpkg HASH getpkg HASH...
Ensure that the package referenced by HASH is installed. Print For each HASH, ensure that the package referenced by HASH is
out the path of the package on stdout. installed. Print out the path of the installation on stdout.
delpkg HASH delpkg HASH...
Uninstall the package referenced by HASH, disregarding any Uninstall the package referenced by each HASH, disregarding any
dependencies that other packages may have on HASH. dependencies that other packages may have on HASH.
listinst listinst
@ -652,7 +651,7 @@ Subcommands:
run HASH ARGS... run HASH ARGS...
Run the descriptor referenced by HASH with the given arguments. Run the descriptor referenced by HASH with the given arguments.
ensure HASH ensure HASH...
Like getpkg, but if HASH refers to a run descriptor, fetch only Like getpkg, but if HASH refers to a run descriptor, fetch only
the dependencies. the dependencies.
@ -707,18 +706,17 @@ void run(Strings::iterator argCur, Strings::iterator argEnd)
if (argc != 0) throw argcError; if (argc != 0) throw argcError;
verifyDB(); verifyDB();
} else if (cmd == "getpkg") { } else if (cmd == "getpkg") {
if (argc != 1) throw argcError; for (Strings::iterator it = argCur; it != argEnd; it++) {
string path = getPkg(*argCur); string path = getPkg(*it);
cout << path << endl; cout << path << endl;
}
} else if (cmd == "delpkg") { } else if (cmd == "delpkg") {
if (argc != 1) throw argcError; for_each(argCur, argEnd, delPkg);
delPkg(*argCur);
} else if (cmd == "run") { } else if (cmd == "run") {
if (argc < 1) throw argcError; if (argc < 1) throw argcError;
runPkg(*argCur, argCur + 1, argEnd); runPkg(*argCur, argCur + 1, argEnd);
} else if (cmd == "ensure") { } else if (cmd == "ensure") {
if (argc != 1) throw argcError; for_each(argCur, argEnd, ensurePkg);
ensurePkg(*argCur);
} else if (cmd == "export") { } else if (cmd == "export") {
if (argc < 1) throw argcError; if (argc < 1) throw argcError;
exportPkgs(*argCur, argCur + 1, argEnd); exportPkgs(*argCur, argCur + 1, argEnd);
@ -726,8 +724,7 @@ void run(Strings::iterator argCur, Strings::iterator argEnd)
if (argc != 2) throw argcError; if (argc != 2) throw argcError;
regPrebuilt(*argCur, argCur[1]); regPrebuilt(*argCur, argCur[1]);
} else if (cmd == "regfile") { } else if (cmd == "regfile") {
if (argc != 1) throw argcError; for_each(argCur, argEnd, registerFile);
registerFile(*argCur);
} else if (cmd == "reginst") { } else if (cmd == "reginst") {
if (argc != 2) throw argcError; if (argc != 2) throw argcError;
registerInstalledPkg(*argCur, argCur[1]); registerInstalledPkg(*argCur, argCur[1]);