Don't filter out empty arguments

This commit is contained in:
Tom Sydney Kerckhove 2022-11-14 15:55:09 +01:00
parent f3a1f3938a
commit 4c6126b887

View File

@ -17,6 +17,7 @@ import Data.Maybe
import qualified Data.Text as T import qualified Data.Text as T
import Data.Version import Data.Version
import Data.Yaml (FromJSON, ToJSON) import Data.Yaml (FromJSON, ToJSON)
import Debug.Trace
import qualified Env import qualified Env
import GHC.Generics (Generic) import GHC.Generics (Generic)
import Options.Applicative as OptParse import Options.Applicative as OptParse
@ -348,9 +349,10 @@ parseCommandFlags =
'\'' -> "\\\'" '\'' -> "\\\'"
c -> [c] c -> [c]
quote = ("\"" <>) . (<> "\"") . concatMap escapeChar quote = ("\"" <>) . (<> "\"") . concatMap escapeChar
quoteIfNecessary "" = quote ""
quoteIfNecessary s = if ' ' `elem` s then quote s else s quoteIfNecessary s = if ' ' `elem` s then quote s else s
pieceBackTogether = unwords . map quoteIfNecessary pieceBackTogether = unwords . map quoteIfNecessary
in pieceBackTogether <$> many commandArg in pieceBackTogether . traceShowId <$> many commandArg
defaultConfigFileCompleter :: IO [String] defaultConfigFileCompleter :: IO [String]
defaultConfigFileCompleter = do defaultConfigFileCompleter = do