module JsonToType.CodeGen.Common(writeRunningCommandComment) where

import System.Environment(getArgs, getProgName)
import System.IO

-- | Write a comment with urrently running command (for documentation of generated code.)
writeRunningCommandComment :: Handle -> String -> IO ()
writeRunningCommandComment :: Handle -> String -> IO ()
writeRunningCommandComment Handle
outHandle String
commentString = do
  String
prog <- IO String
getProgName
  [String]
args <- IO [String]
getArgs
  Handle -> String -> IO ()
hPutStrLn Handle
outHandle (String -> IO ()) -> String -> IO ()
forall a b. (a -> b) -> a -> b
$ [String] -> String
unwords ([String] -> String) -> [String] -> String
forall a b. (a -> b) -> a -> b
$ String
commentStringString -> [String] -> [String]
forall a. a -> [a] -> [a]
:String
progString -> [String] -> [String]
forall a. a -> [a] -> [a]
:[String]
args