aboutsummaryrefslogtreecommitdiff
path: root/src/libmain
diff options
context:
space:
mode:
Diffstat (limited to 'src/libmain')
-rw-r--r--src/libmain/common-args.cc2
-rw-r--r--src/libmain/common-args.hh4
-rw-r--r--src/libmain/shared.cc16
-rw-r--r--src/libmain/shared.hh14
4 files changed, 19 insertions, 17 deletions
diff --git a/src/libmain/common-args.cc b/src/libmain/common-args.cc
index c43e9ebd2..12f5403ea 100644
--- a/src/libmain/common-args.cc
+++ b/src/libmain/common-args.cc
@@ -4,7 +4,7 @@
namespace nix {
-MixCommonArgs::MixCommonArgs(const string & programName)
+MixCommonArgs::MixCommonArgs(const std::string & programName)
: programName(programName)
{
addFlag({
diff --git a/src/libmain/common-args.hh b/src/libmain/common-args.hh
index 31bdf527a..25453b8c6 100644
--- a/src/libmain/common-args.hh
+++ b/src/libmain/common-args.hh
@@ -11,8 +11,8 @@ class MixCommonArgs : public virtual Args
{
void initialFlagsProcessed() override;
public:
- string programName;
- MixCommonArgs(const string & programName);
+ std::string programName;
+ MixCommonArgs(const std::string & programName);
protected:
virtual void pluginsInited() {}
};
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc
index f605184bb..47fc7ab2e 100644
--- a/src/libmain/shared.cc
+++ b/src/libmain/shared.cc
@@ -94,7 +94,7 @@ void printMissing(ref<Store> store, const StorePathSet & willBuild,
}
-string getArg(const string & opt,
+std::string getArg(const std::string & opt,
Strings::iterator & i, const Strings::iterator & end)
{
++i;
@@ -227,6 +227,8 @@ LegacyArgs::LegacyArgs(const std::string & programName,
std::function<bool(Strings::iterator & arg, const Strings::iterator & end)> parseArg)
: MixCommonArgs(programName), parseArg(parseArg)
{
+ printError("FOO %s", programName);
+
addFlag({
.longName = "no-build-output",
.shortName = 'Q',
@@ -322,14 +324,14 @@ void parseCmdLine(int argc, char * * argv,
}
-void parseCmdLine(const string & programName, const Strings & args,
+void parseCmdLine(const std::string & programName, const Strings & args,
std::function<bool(Strings::iterator & arg, const Strings::iterator & end)> parseArg)
{
LegacyArgs(programName, parseArg).parseCmdline(args);
}
-void printVersion(const string & programName)
+void printVersion(const std::string & programName)
{
std::cout << format("%1% (Nix) %2%") % programName % nixVersion << std::endl;
if (verbosity > lvlInfo) {
@@ -352,7 +354,7 @@ void printVersion(const string & programName)
}
-void showManPage(const string & name)
+void showManPage(const std::string & name)
{
restoreProcessContext();
setenv("MANPATH", settings.nixManDir.c_str(), 1);
@@ -361,13 +363,13 @@ void showManPage(const string & name)
}
-int handleExceptions(const string & programName, std::function<void()> fun)
+int handleExceptions(const std::string & programName, std::function<void()> fun)
{
ReceiveInterrupts receiveInterrupts; // FIXME: need better place for this
ErrorInfo::programName = baseNameOf(programName);
- string error = ANSI_RED "error:" ANSI_NORMAL " ";
+ std::string error = ANSI_RED "error:" ANSI_NORMAL " ";
try {
try {
fun();
@@ -407,7 +409,7 @@ RunPager::RunPager()
if (!isatty(STDOUT_FILENO)) return;
char * pager = getenv("NIX_PAGER");
if (!pager) pager = getenv("PAGER");
- if (pager && ((string) pager == "" || (string) pager == "cat")) return;
+ if (pager && ((std::string) pager == "" || (std::string) pager == "cat")) return;
Pipe toPager;
toPager.create();
diff --git a/src/libmain/shared.hh b/src/libmain/shared.hh
index ed012959b..0cc56d47d 100644
--- a/src/libmain/shared.hh
+++ b/src/libmain/shared.hh
@@ -22,7 +22,7 @@ public:
virtual ~Exit();
};
-int handleExceptions(const string & programName, std::function<void()> fun);
+int handleExceptions(const std::string & programName, std::function<void()> fun);
/* Don't forget to call initPlugins() after settings are initialized! */
void initNix();
@@ -30,10 +30,10 @@ void initNix();
void parseCmdLine(int argc, char * * argv,
std::function<bool(Strings::iterator & arg, const Strings::iterator & end)> parseArg);
-void parseCmdLine(const string & programName, const Strings & args,
+void parseCmdLine(const std::string & programName, const Strings & args,
std::function<bool(Strings::iterator & arg, const Strings::iterator & end)> parseArg);
-void printVersion(const string & programName);
+void printVersion(const std::string & programName);
/* Ugh. No better place to put this. */
void printGCWarning();
@@ -50,10 +50,10 @@ void printMissing(ref<Store> store, const StorePathSet & willBuild,
const StorePathSet & willSubstitute, const StorePathSet & unknown,
uint64_t downloadSize, uint64_t narSize, Verbosity lvl = lvlInfo);
-string getArg(const string & opt,
+std::string getArg(const std::string & opt,
Strings::iterator & i, const Strings::iterator & end);
-template<class N> N getIntArg(const string & opt,
+template<class N> N getIntArg(const std::string & opt,
Strings::iterator & i, const Strings::iterator & end, bool allowUnit)
{
++i;
@@ -76,7 +76,7 @@ struct LegacyArgs : public MixCommonArgs
/* Show the manual page for the specified program. */
-void showManPage(const string & name);
+void showManPage(const std::string & name);
/* The constructor of this class starts a pager if stdout is a
terminal and $PAGER is set. Stdout is redirected to the pager. */
@@ -96,7 +96,7 @@ extern volatile ::sig_atomic_t blockInt;
/* GC helpers. */
-string showBytes(uint64_t bytes);
+std::string showBytes(uint64_t bytes);
struct GCResults;