diff options
author | Ben Burdette <bburdette@protonmail.com> | 2022-04-07 13:42:01 -0600 |
---|---|---|
committer | Ben Burdette <bburdette@protonmail.com> | 2022-04-07 13:42:01 -0600 |
commit | 1a93ac8133381eb692416c4e46b1706faa5cd89f (patch) | |
tree | 9a559f977ad6213c055099f6f2ab6be96f0c551b /src/libmain | |
parent | d2ec9b4e15718e42720787140d7825dcbfd73249 (diff) | |
parent | 8b1e328d5d0ae7d3a4a8f6012ec065b59674ed4a (diff) |
Merge remote-tracking branch 'upstream/master' into upstream-merge
Diffstat (limited to 'src/libmain')
-rw-r--r-- | src/libmain/common-args.cc | 2 | ||||
-rw-r--r-- | src/libmain/common-args.hh | 4 | ||||
-rw-r--r-- | src/libmain/shared.cc | 15 | ||||
-rw-r--r-- | src/libmain/shared.hh | 14 |
4 files changed, 18 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..562d1b414 100644 --- a/src/libmain/shared.cc +++ b/src/libmain/shared.cc @@ -1,6 +1,7 @@ #include "globals.hh" #include "shared.hh" #include "store-api.hh" +#include "gc-store.hh" #include "util.hh" #include "loggers.hh" @@ -94,7 +95,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; @@ -322,14 +323,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 +353,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 +362,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 +408,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; |