Replace Unicode quotes in user-facing strings by ASCII

Relevant RFC: NixOS/rfcs#4

$ ag -l | xargs sed -i -e "/\"/s/’/'/g;/\"/s/‘/'/g"
This commit is contained in:
Jörg Thalheim 2017-07-30 12:27:57 +01:00
parent c7654bc491
commit 2fd8f8bb99
86 changed files with 662 additions and 662 deletions

View file

@ -13,9 +13,9 @@ struct MixCat : virtual Args
{
auto st = accessor->stat(path);
if (st.type == FSAccessor::Type::tMissing)
throw Error(format("path %1% does not exist") % path);
throw Error(format("path '%1%' does not exist") % path);
if (st.type != FSAccessor::Type::tRegular)
throw Error(format("path %1% is not a regular file") % path);
throw Error(format("path '%1%' is not a regular file") % path);
std::cout << accessor->readFile(path);
}

View file

@ -28,7 +28,7 @@ MultiCommand::MultiCommand(const Commands & _commands)
assert(!command);
auto i = commands.find(ss.front());
if (i == commands.end())
throw UsageError(format("%1% is not a recognised command") % ss.front());
throw UsageError(format("'%1%' is not a recognised command") % ss.front());
command = i->second;
}});
}
@ -55,7 +55,7 @@ void MultiCommand::printHelp(const string & programName, std::ostream & out)
printTable(out, table);
out << "\n";
out << "For full documentation, run man " << programName << " or man " << programName << "-<COMMAND>.\n";
out << "For full documentation, run 'man " << programName << "' or 'man " << programName << "-<COMMAND>'.\n";
}
bool MultiCommand::processFlag(Strings::iterator & pos, Strings::iterator end)
@ -109,7 +109,7 @@ void StorePathsCommand::run(ref<Store> store)
if (all) {
if (installables.size())
throw UsageError("--all does not expect arguments");
throw UsageError("'--all' does not expect arguments");
for (auto & p : store->queryAllValidPaths())
storePaths.push_back(p);
}

View file

@ -53,12 +53,12 @@ struct Installable
virtual Buildables toBuildable()
{
throw Error("argument %s cannot be built", what());
throw Error("argument '%s' cannot be built", what());
}
virtual Value * toValue(EvalState & state)
{
throw Error("argument %s cannot be evaluated", what());
throw Error("argument '%s' cannot be evaluated", what());
}
};

View file

@ -46,7 +46,7 @@ struct CmdCopy : StorePathsCommand
void run(ref<Store> srcStore, Paths storePaths) override
{
if (srcUri.empty() && dstUri.empty())
throw UsageError("you must pass --from and/or --to");
throw UsageError("you must pass '--from' and/or '--to'");
ref<Store> dstStore = dstUri.empty() ? openStore() : openStore(dstUri);

View file

@ -41,7 +41,7 @@ struct CmdEdit : InstallablesCommand
auto dummyArgs = state->allocBindings(0);
v2 = findAlongAttrPath(*state, "meta.position", *dummyArgs, *v);
} catch (Error &) {
throw Error("package %s has no source location information", i->what());
throw Error("package '%s' has no source location information", i->what());
}
auto pos = state->forceString(*v2);
@ -49,7 +49,7 @@ struct CmdEdit : InstallablesCommand
auto colon = pos.rfind(':');
if (colon == std::string::npos)
throw Error("cannot parse meta.position attribute %s", pos);
throw Error("cannot parse meta.position attribute '%s'", pos);
std::string filename(pos, 0, colon);
int lineno = std::stoi(std::string(pos, colon + 1));
@ -67,7 +67,7 @@ struct CmdEdit : InstallablesCommand
execvp(editor.c_str(), stringsToCharPtrs(args).data());
throw SysError("cannot run editor %s", editor);
throw SysError("cannot run editor '%s'", editor);
}
}
};

View file

@ -109,7 +109,7 @@ static int compatNixHash(int argc, char * * argv)
string s = getArg(*arg, arg, end);
ht = parseHashType(s);
if (ht == htUnknown)
throw UsageError(format("unknown hash type %1%") % s);
throw UsageError(format("unknown hash type '%1%'") % s);
}
else if (*arg == "--to-base16") op = opTo16;
else if (*arg == "--to-base32") op = opTo32;

View file

@ -221,7 +221,7 @@ std::vector<std::shared_ptr<Installable>> InstallablesCommand::parseInstallables
result.push_back(std::make_shared<InstallableAttrPath>(*this, s));
else
throw UsageError("don't know what to do with argument %s", s);
throw UsageError("don't know what to do with argument '%s'", s);
}
return result;

View file

@ -39,7 +39,7 @@ struct CmdLog : InstallablesCommand
break;
}
if (!found)
throw Error("build log of path %s is not available", path);
throw Error("build log of path '%s' is not available", path);
}
}
}

View file

@ -67,7 +67,7 @@ struct MixLs : virtual Args
auto st = accessor->stat(path);
if (st.type == FSAccessor::Type::tMissing)
throw Error(format("path %1% does not exist") % path);
throw Error(format("path '%1%' does not exist") % path);
doPath(st, path,
st.type == FSAccessor::Type::tDirectory ? "." : baseNameOf(path),
showDirectory);

View file

@ -39,9 +39,9 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs
Args::printFlags(out);
std::cout <<
"\n"
"In addition, most configuration settings can be overriden using --<name> <value>.\n"
"Boolean settings can be overriden using --<name> or --no-<name>. See nix\n"
"--help-config for a list of configuration settings.\n";
"In addition, most configuration settings can be overriden using '--<name> <value>'.\n"
"Boolean settings can be overriden using '--<name>' or '--no-<name>'. See 'nix\n"
"--help-config' for a list of configuration settings.\n";
}
void showHelpAndExit()

View file

@ -397,7 +397,7 @@ bool NixRepl::processLine(string line)
return false;
else if (command != "")
throw Error(format("unknown command %1%") % command);
throw Error(format("unknown command '%1%'") % command);
else {
size_t p = line.find('=');
@ -460,7 +460,7 @@ void NixRepl::reloadFiles()
for (auto & i : old) {
if (!first) std::cout << std::endl;
first = false;
std::cout << format("Loading %1%...") % i << std::endl;
std::cout << format("Loading '%1%'...") % i << std::endl;
loadFile(i);
}
}

View file

@ -57,15 +57,15 @@ struct CmdRun : InstallablesCommand
createDirs(tmpDir + store->storeDir);
if (mount(store2->realStoreDir.c_str(), (tmpDir + store->storeDir).c_str(), "", MS_BIND, 0) == -1)
throw SysError(format("mounting %s on %s") % store2->realStoreDir % store->storeDir);
throw SysError(format("mounting '%s' on '%s'") % store2->realStoreDir % store->storeDir);
for (auto entry : readDirectory("/")) {
Path dst = tmpDir + "/" + entry.name;
if (pathExists(dst)) continue;
if (mkdir(dst.c_str(), 0700) == -1)
throw SysError(format("creating directory %s") % dst);
throw SysError(format("creating directory '%s'") % dst);
if (mount(("/" + entry.name).c_str(), dst.c_str(), "", MS_BIND | MS_REC, 0) == -1)
throw SysError(format("mounting %s on %s") % ("/" + entry.name) % dst);
throw SysError(format("mounting '%s' on '%s'") % ("/" + entry.name) % dst);
}
char * cwd = getcwd(0, 0);
@ -73,19 +73,19 @@ struct CmdRun : InstallablesCommand
Finally freeCwd([&]() { free(cwd); });
if (chroot(tmpDir.c_str()) == -1)
throw SysError(format("chrooting into %s") % tmpDir);
throw SysError(format("chrooting into '%s'") % tmpDir);
if (chdir(cwd) == -1)
throw SysError(format("chdir to %s in chroot") % cwd);
throw SysError(format("chdir to '%s' in chroot") % cwd);
} else
if (mount(store2->realStoreDir.c_str(), store->storeDir.c_str(), "", MS_BIND, 0) == -1)
throw SysError(format("mounting %s on %s") % store2->realStoreDir % store->storeDir);
throw SysError(format("mounting '%s' on '%s'") % store2->realStoreDir % store->storeDir);
writeFile("/proc/self/setgroups", "deny");
writeFile("/proc/self/uid_map", (format("%d %d %d") % uid % uid % 1).str());
writeFile("/proc/self/gid_map", (format("%d %d %d") % gid % gid % 1).str());
#else
throw Error(format("mounting the Nix store on %s is not supported on this platform") % store->storeDir);
throw Error(format("mounting the Nix store on '%s' is not supported on this platform") % store->storeDir);
#endif
}
@ -97,7 +97,7 @@ struct CmdRun : InstallablesCommand
setenv("PATH", concatStringsSep(":", unixPath).c_str(), 1);
if (execlp("bash", "bash", nullptr) == -1)
throw SysError("unable to exec bash");
throw SysError("unable to exec 'bash'");
}
};

View file

@ -76,7 +76,7 @@ struct CmdSearch : SourceExprCommand, MixJSON
std::function<void(Value *, std::string, bool, JSONObject *)> doExpr;
doExpr = [&](Value * v, std::string attrPath, bool toplevel, JSONObject * cache) {
debug("at attribute %s", attrPath);
debug("at attribute '%s'", attrPath);
try {
@ -152,7 +152,7 @@ struct CmdSearch : SourceExprCommand, MixJSON
auto attrs = v->attrs;
Bindings::iterator j = attrs->find(sRecurse);
if (j == attrs->end() || !state->forceBool(*j->value, *j->pos)) {
debug("skip attribute %s", attrPath);
debug("skip attribute '%s'", attrPath);
return;
}
}
@ -175,7 +175,7 @@ struct CmdSearch : SourceExprCommand, MixJSON
} catch (AssertionError & e) {
} catch (Error & e) {
if (!toplevel) {
e.addPrefix(fmt("While evaluating the attribute %s:\n", attrPath));
e.addPrefix(fmt("While evaluating the attribute '%s':\n", attrPath));
throw;
}
}
@ -203,7 +203,7 @@ struct CmdSearch : SourceExprCommand, MixJSON
doExpr(getSourceExpr(*state), "", true, cache.get());
if (rename(tmpFile.c_str(), jsonCacheFileName.c_str()) == -1)
throw SysError("cannot rename %s to %s", tmpFile, jsonCacheFileName);
throw SysError("cannot rename '%s' to '%s'", tmpFile, jsonCacheFileName);
}
}
};

View file

@ -35,7 +35,7 @@ struct CmdCopySigs : StorePathsCommand
void run(ref<Store> store, Paths storePaths) override
{
if (substituterUris.empty())
throw UsageError("you must specify at least one substituter using -s");
throw UsageError("you must specify at least one substituter using '-s'");
// FIXME: factor out commonality with MixVerify.
std::vector<ref<Store>> substituters;
@ -50,7 +50,7 @@ struct CmdCopySigs : StorePathsCommand
//logger->setExpected(doneLabel, storePaths.size());
auto doPath = [&](const Path & storePath) {
//Activity act(*logger, lvlInfo, format("getting signatures for %s") % storePath);
//Activity act(*logger, lvlInfo, format("getting signatures for '%s'") % storePath);
checkInterrupt();
@ -117,7 +117,7 @@ struct CmdSignPaths : StorePathsCommand
void run(ref<Store> store, Paths storePaths) override
{
if (secretKeyFile.empty())
throw UsageError("you must specify a secret key file using -k");
throw UsageError("you must specify a secret key file using '-k'");
SecretKey secretKey(readFile(secretKeyFile));

View file

@ -78,7 +78,7 @@ struct CmdVerify : StorePathsCommand
try {
checkInterrupt();
//Activity act(*logger, lvlInfo, format("checking %s") % storePath);
//Activity act(*logger, lvlInfo, format("checking '%s'") % storePath);
auto info = store->queryPathInfo(storePath);
@ -93,7 +93,7 @@ struct CmdVerify : StorePathsCommand
//logger->incProgress(corruptedLabel);
corrupted = 1;
printError(
format("path %s was modified! expected hash %s, got %s")
format("path '%s' was modified! expected hash '%s', got '%s'")
% info->path % info->narHash.to_string() % hash.first.to_string());
}
@ -144,7 +144,7 @@ struct CmdVerify : StorePathsCommand
if (!good) {
//logger->incProgress(untrustedLabel);
untrusted++;
printError(format("path %s is untrusted") % info->path);
printError(format("path '%s' is untrusted") % info->path);
}
}