diff --git a/Hledger/Cli/Main.hs b/Hledger/Cli/Main.hs
--- a/Hledger/Cli/Main.hs
+++ b/Hledger/Cli/Main.hs
@@ -87,7 +87,8 @@
         showModeHelpOr mode f | "help" `in_` (rawopts_ opts) = putStr $ showModeHelp mode
                               | otherwise = f
         matchedaddon = headDef "" $ filter (cmd `isPrefixOf`) addons
-        shellcmd = printf "%s-%s %s" progname matchedaddon (unwords' args)
+        shellcmd = printf "%s-%s %s" progname matchedaddon (unwords' argswithoutcmd)
+        argswithoutcmd = args1 ++ drop 1 args2 where (args1,args2) = break (== cmd) args
 
 {- tests:
 
diff --git a/Hledger/Cli/Options.hs b/Hledger/Cli/Options.hs
--- a/Hledger/Cli/Options.hs
+++ b/Hledger/Cli/Options.hs
@@ -53,6 +53,7 @@
  ,modeGroupFlags = Group {
      groupUnnamed = helpflags
     ,groupHidden = [flagNone ["binary-filename"] (setboolopt "binary-filename") "show the download filename for this executable, and exit"]
+                   ++ fileflags -- quietly permit these flags before COMMAND as well
     ,groupNamed = []
     }
  ,modeArgs = ([], Just mainargsflag)
@@ -136,15 +137,9 @@
  ,flagVersion (setboolopt "version")
  ]
 
-mainargsflag = flagArg f ""
-    where f s opts = let as = words' s
-                         cmd = headDef "" as
-                         args = drop (length cmd + 1) s
-                     in Right $ setopt "command" cmd $ setopt "args" args opts
-
+mainargsflag    = flagArg (\s opts -> Right $ setopt "args" s opts) ""
 commandargsflag = flagArg (\s opts -> Right $ setopt "args" s opts) "[PATTERNS]"
-
-addonargsflag = flagArg (\s opts -> Right $ setopt "args" s opts) "[ARGS]"
+addonargsflag   = flagArg (\s opts -> Right $ setopt "args" s opts) "[ARGS]"
 
 commandmode names = defmode {modeNames=names, modeValue=[("command",headDef "" names)]}
 
@@ -315,7 +310,7 @@
                             ,quarterly_ = boolopt "quarterly" rawopts
                             ,yearly_    = boolopt "yearly" rawopts
                             ,format_    = maybestringopt "format" rawopts
-                            ,patterns_  = words'' prefixes $ singleQuoteIfNeeded $ stringopt "args" rawopts
+                            ,patterns_  = listofstringopt "args" rawopts
                             }
              }
 
diff --git a/Hledger/Cli/Version.hs b/Hledger/Cli/Version.hs
--- a/Hledger/Cli/Version.hs
+++ b/Hledger/Cli/Version.hs
@@ -20,7 +20,7 @@
 -- version and PATCHLEVEL are set by the make process
 
 version :: String
-version       = "0.15.1"
+version       = "0.15.2"
 
 patchlevel :: String
 #ifdef PATCHLEVEL
diff --git a/hledger.cabal b/hledger.cabal
--- a/hledger.cabal
+++ b/hledger.cabal
@@ -1,5 +1,5 @@
 name:           hledger
-version: 0.15.1
+version: 0.15.2
 category:       Finance
 synopsis:       The main command-line interface for the hledger accounting tool.
 description:
@@ -57,7 +57,7 @@
                   Hledger.Cli.Stats
   -- should be the same as below
   build-depends:
-                  hledger-lib == 0.15
+                  hledger-lib == 0.15.2
                  ,base >= 3 && < 5
                  ,containers
                  ,cmdargs >= 0.8   && < 0.9
@@ -107,7 +107,7 @@
   ghc-options:    -threaded -W
   -- should be the same as above
   build-depends:
-                  hledger-lib == 0.15
+                  hledger-lib == 0.15.2
                  ,base >= 3 && < 5
                  ,containers
                  ,cmdargs >= 0.8   && < 0.9
