From 5002b5e3915890542286487efb852c16c0ca988d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 6 Jul 2014 16:32:05 -0400 Subject: propellor spin --- src/Propellor/PrivData.hs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/Propellor/PrivData.hs') diff --git a/src/Propellor/PrivData.hs b/src/Propellor/PrivData.hs index ac7228f8..10965fe3 100644 --- a/src/Propellor/PrivData.hs +++ b/src/Propellor/PrivData.hs @@ -26,6 +26,7 @@ import Utility.SafeCommand import Utility.Misc import Utility.FileMode import Utility.Env +import Utility.Table -- | Allows a Property to access the value of a specific PrivDataField, -- for use in a specific Context. @@ -90,10 +91,17 @@ editPrivData field context = do listPrivDataFields :: IO () listPrivDataFields = do m <- decryptPrivData - putStrLn ("\nAll currently set privdata fields:") - mapM_ list $ M.keys m + putStrLn "\n" + let rows = map mkrow (M.keys m) + let table = tableWithHeader header rows + putStr $ unlines $ formatTable table where - list = putStrLn . ("\t" ++) . shellEscape . show + header = ["Field", "Context", "Hosts"] + mkrow (field, (Context context)) = + [ shellEscape $ show field + , shellEscape context + , "xxx" + ] setPrivDataTo :: PrivDataField -> Context -> PrivData -> IO () setPrivDataTo field context value = do -- cgit v1.3-2-g0d8e