about summary refs log tree commit diff
path: root/src/nix/hash.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-10-24T10·45+0200
committerEelco Dolstra <edolstra@gmail.com>2017-10-24T10·58+0200
commit0d59f1ca49c9f7f3b2edaadcf590360ec66a6257 (patch)
treea03d53d84fb61eb354e2634705d8a076f0c1c76d /src/nix/hash.cc
parent25f32625e2f2a3a1e1b3a3811da82f21c3a3b880 (diff)
nix: Respect -I, --arg, --argstr
Also, random cleanup to argument handling.
Diffstat (limited to 'src/nix/hash.cc')
-rw-r--r--src/nix/hash.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/nix/hash.cc b/src/nix/hash.cc
index 923dabb103d3..64062fb97955 100644
--- a/src/nix/hash.cc
+++ b/src/nix/hash.cc
@@ -12,14 +12,16 @@ struct CmdHash : Command
     Base base = Base16;
     bool truncate = false;
     HashType ht = htSHA512;
-    Strings paths;
+    std::vector<std::string> paths;
 
     CmdHash(Mode mode) : mode(mode)
     {
         mkFlag(0, "base64", "print hash in base-64", &base, Base64);
         mkFlag(0, "base32", "print hash in base-32 (Nix-specific)", &base, Base32);
         mkFlag(0, "base16", "print hash in base-16", &base, Base16);
-        mkHashTypeFlag("type", &ht);
+        mkFlag()
+            .longName("type")
+            .mkHashTypeFlag(&ht);
         expectArgs("paths", &paths);
     }
 
@@ -53,11 +55,13 @@ struct CmdToBase : Command
 {
     Base base;
     HashType ht = htSHA512;
-    Strings args;
+    std::vector<std::string> args;
 
     CmdToBase(Base base) : base(base)
     {
-        mkHashTypeFlag("type", &ht);
+        mkFlag()
+            .longName("type")
+            .mkHashTypeFlag(&ht);
         expectArgs("strings", &args);
     }
 
@@ -95,7 +99,7 @@ static int compatNixHash(int argc, char * * argv)
     bool base32 = false;
     bool truncate = false;
     enum { opHash, opTo32, opTo16 } op = opHash;
-    Strings ss;
+    std::vector<std::string> ss;
 
     parseCmdLine(argc, argv, [&](Strings::iterator & arg, const Strings::iterator & end) {
         if (*arg == "--help")