summaryrefslogtreecommitdiff
path: root/Utility/Quvi.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-06-01 13:52:23 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-06-01 13:52:23 -0400
commit39c13f91004b41166b786785083e78b34df0c48f (patch)
treebf5ea0acf27c9075a63d3b23b970c3ea44ecee64 /Utility/Quvi.hs
parent3a9ca30fa8740a57ea477243498339f9738102d6 (diff)
remove Params constructor from Utility.SafeCommand
This removes a bit of complexity, and should make things faster (avoids tokenizing Params string), and probably involve less garbage collection. In a few places, it was useful to use Params to avoid needing a list, but that is easily avoided. Problems noticed while doing this conversion: * Some uses of Params "oneword" which was entirely unnecessary overhead. * A few places that built up a list of parameters with ++ and then used Params to split it! Test suite passes.
Diffstat (limited to 'Utility/Quvi.hs')
-rw-r--r--Utility/Quvi.hs19
1 files changed, 10 insertions, 9 deletions
diff --git a/Utility/Quvi.hs b/Utility/Quvi.hs
index 0412116a1..8d37b1c8f 100644
--- a/Utility/Quvi.hs
+++ b/Utility/Quvi.hs
@@ -108,7 +108,8 @@ check v ps url = maybe False (not . null . pageLinks) <$> query v ps url
supported :: QuviVersion -> URLString -> IO Bool
supported NoQuvi _ = return False
supported Quvi04 url = boolSystem "quvi"
- [ Params "--verbosity mute --support"
+ [ Param "--verbosity mute"
+ , Param "--support"
, Param url
]
{- Use quvi-info to see if the url's domain is supported.
@@ -134,18 +135,18 @@ listdomains Quvi09 = concatMap (split ",")
(toCommand [Param "info", Param "-p", Param "domains"])
listdomains _ = return []
-type QuviParam = QuviVersion -> CommandParam
+type QuviParams = QuviVersion -> [CommandParam]
{- Disables progress, but not information output. -}
-quiet :: QuviParam
+quiet :: QuviParams
-- Cannot use quiet as it now disables informational output.
-- No way to disable progress.
-quiet Quvi09 = Params "--verbosity verbose"
-quiet Quvi04 = Params "--verbosity quiet"
-quiet NoQuvi = Params ""
+quiet Quvi09 = [Param "--verbosity", Param "verbose"]
+quiet Quvi04 = [Param "--verbosity", Param "quiet"]
+quiet NoQuvi = []
{- Only return http results, not streaming protocols. -}
-httponly :: QuviParam
+httponly :: QuviParams
-- No way to do it with 0.9?
-httponly Quvi04 = Params "-c http"
-httponly _ = Params "" -- No way to do it with 0.9?
+httponly Quvi04 = [Param "-c", Param "http"]
+httponly _ = [] -- No way to do it with 0.9?