From f3cf53bad93d290130a13cf4e56df54b51d5c174 Mon Sep 17 00:00:00 2001
From: jao <jao@gnu.org>
Date: Fri, 28 Jan 2022 03:21:26 +0000
Subject: Xmobar.Run.Command -> Xmobar.Plugins.Command

---
 src/Xmobar.hs                 |  4 ++--
 src/Xmobar/Plugins/Command.hs | 54 +++++++++++++++++++++++++++++++++++++++++++
 src/Xmobar/Run/Command.hs     | 54 -------------------------------------------
 src/Xmobar/Run/Template.hs    |  3 ++-
 src/Xmobar/Run/Types.hs       |  5 ++--
 5 files changed, 60 insertions(+), 60 deletions(-)
 create mode 100644 src/Xmobar/Plugins/Command.hs
 delete mode 100644 src/Xmobar/Run/Command.hs

(limited to 'src')

diff --git a/src/Xmobar.hs b/src/Xmobar.hs
index 2a32da1..ced40a5 100644
--- a/src/Xmobar.hs
+++ b/src/Xmobar.hs
@@ -3,7 +3,7 @@
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Xmobar
--- Copyright   :  (c) 2011, 2012, 2013, 2014, 2015, 2017, 2018, 2019 Jose Antonio Ortega Ruiz
+-- Copyright   :  (c) 2011, 2012, 2013, 2014, 2015, 2017, 2018, 2019, 2022 Jose Antonio Ortega Ruiz
 --                (c) 2007 Andrea Rossato
 -- License     :  BSD-style (see LICENSE)
 --
@@ -51,9 +51,9 @@ module Xmobar (xmobar
 
 import Xmobar.Run.Runnable
 import Xmobar.Run.Exec
-import Xmobar.Run.Command
 import Xmobar.Config.Types
 import Xmobar.Config.Parse
+import Xmobar.Plugins.Command
 import Xmobar.Plugins.BufferedPipeReader
 import Xmobar.Plugins.CommandReader
 import Xmobar.Plugins.Date
diff --git a/src/Xmobar/Plugins/Command.hs b/src/Xmobar/Plugins/Command.hs
new file mode 100644
index 0000000..d63f56c
--- /dev/null
+++ b/src/Xmobar/Plugins/Command.hs
@@ -0,0 +1,54 @@
+------------------------------------------------------------------------------
+-- |
+-- Module: Xmobar.Plugins.Command
+-- Copyright: (c) 2018, 2022 Jose Antonio Ortega Ruiz
+-- License: BSD3-style (see LICENSE)
+--
+-- Maintainer: jao@gnu.org
+-- Stability: unstable
+-- Portability: portable
+-- Created: Sun Dec 02, 2018 05:29
+--
+--
+-- The basic Command plugin
+--
+------------------------------------------------------------------------------
+
+
+module Xmobar.Plugins.Command where
+
+import Control.Exception (handle, SomeException(..))
+import System.Process
+import System.Exit
+import System.IO (hClose, hGetLine)
+
+import Xmobar.Run.Exec
+
+data Command = Com Program Args Alias Rate
+             | ComX Program Args String Alias Rate
+               deriving (Show,Read,Eq)
+
+type Args    = [String]
+type Program = String
+type Alias   = String
+type Rate    = Int
+
+instance Exec Command where
+    alias (ComX p _ _ a _) =
+      if p /= "" then (if a == "" then p else a) else ""
+    alias (Com p a al r) = alias (ComX p a "" al r)
+    start (Com p as al r) cb =
+      start (ComX p as ("Could not execute command " ++ p) al r) cb
+    start (ComX prog args msg _ r) cb = if r > 0 then go else exec
+        where go = doEveryTenthSeconds r exec
+              exec = do
+                (i,o,e,p) <- runInteractiveProcess prog args Nothing Nothing
+                exit <- waitForProcess p
+                let closeHandles = hClose o >> hClose i >> hClose e
+                    getL = handle (\(SomeException _) -> return "")
+                                  (hGetLine o)
+                case exit of
+                  ExitSuccess -> do str <- getL
+                                    closeHandles
+                                    cb str
+                  _ -> closeHandles >> cb msg
diff --git a/src/Xmobar/Run/Command.hs b/src/Xmobar/Run/Command.hs
deleted file mode 100644
index 430d142..0000000
--- a/src/Xmobar/Run/Command.hs
+++ /dev/null
@@ -1,54 +0,0 @@
-------------------------------------------------------------------------------
--- |
--- Module: Xmobar.Plugins.Command
--- Copyright: (c) 2018 Jose Antonio Ortega Ruiz
--- License: BSD3-style (see LICENSE)
---
--- Maintainer: jao@gnu.org
--- Stability: unstable
--- Portability: portable
--- Created: Sun Dec 02, 2018 05:29
---
---
--- The basic Command plugin
---
-------------------------------------------------------------------------------
-
-
-module Xmobar.Run.Command where
-
-import Control.Exception (handle, SomeException(..))
-import System.Process
-import System.Exit
-import System.IO (hClose, hGetLine)
-
-import Xmobar.Run.Exec
-
-data Command = Com Program Args Alias Rate
-             | ComX Program Args String Alias Rate
-               deriving (Show,Read,Eq)
-
-type Args    = [String]
-type Program = String
-type Alias   = String
-type Rate    = Int
-
-instance Exec Command where
-    alias (ComX p _ _ a _) =
-      if p /= "" then (if a == "" then p else a) else ""
-    alias (Com p a al r) = alias (ComX p a "" al r)
-    start (Com p as al r) cb =
-      start (ComX p as ("Could not execute command " ++ p) al r) cb
-    start (ComX prog args msg _ r) cb = if r > 0 then go else exec
-        where go = doEveryTenthSeconds r exec
-              exec = do
-                (i,o,e,p) <- runInteractiveProcess prog args Nothing Nothing
-                exit <- waitForProcess p
-                let closeHandles = hClose o >> hClose i >> hClose e
-                    getL = handle (\(SomeException _) -> return "")
-                                  (hGetLine o)
-                case exit of
-                  ExitSuccess -> do str <- getL
-                                    closeHandles
-                                    cb str
-                  _ -> closeHandles >> cb msg
diff --git a/src/Xmobar/Run/Template.hs b/src/Xmobar/Run/Template.hs
index 50c3a08..87c84d3 100644
--- a/src/Xmobar/Run/Template.hs
+++ b/src/Xmobar/Run/Template.hs
@@ -20,8 +20,9 @@ module Xmobar.Run.Template(parseTemplate, splitTemplate) where
 import qualified Data.Map as Map
 import Text.ParserCombinators.Parsec
 
+import Xmobar.Plugins.Command
+
 import Xmobar.Run.Exec
-import Xmobar.Run.Command
 import Xmobar.Run.Runnable
 
 defaultAlign :: String
diff --git a/src/Xmobar/Run/Types.hs b/src/Xmobar/Run/Types.hs
index 0d4ed42..69406bb 100644
--- a/src/Xmobar/Run/Types.hs
+++ b/src/Xmobar/Run/Types.hs
@@ -2,7 +2,7 @@
 ------------------------------------------------------------------------------
 -- |
 -- Module: Xmobar.Run.Types
--- Copyright: (c) 2018 Jose Antonio Ortega Ruiz
+-- Copyright: (c) 2018, 2022 Jose Antonio Ortega Ruiz
 -- License: BSD3-style (see LICENSE)
 --
 -- Maintainer: jao@gnu.org
@@ -19,6 +19,7 @@
 module Xmobar.Run.Types(runnableTypes) where
 
 import {-# SOURCE #-} Xmobar.Run.Runnable()
+import Xmobar.Plugins.Command
 import Xmobar.Plugins.Monitors
 import Xmobar.Plugins.Date
 import Xmobar.Plugins.PipeReader
@@ -45,8 +46,6 @@ import Xmobar.Plugins.DateZone
 import Xmobar.Plugins.Kraken
 #endif
 
-import Xmobar.Run.Command
-
 -- | An alias for tuple types that is more convenient for long lists.
 type a :*: b = (a, b)
 infixr :*:
-- 
cgit v1.2.3