From ceece8eb3de04edbc84deb683225f05c763aa1b0 Mon Sep 17 00:00:00 2001 From: slotThe Date: Mon, 3 Feb 2020 09:38:02 +0100 Subject: New function `getArgvs` to get all values from user input --- src/Xmobar/Plugins/Monitors/Common/Run.hs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/Xmobar/Plugins/Monitors/Common/Run.hs') diff --git a/src/Xmobar/Plugins/Monitors/Common/Run.hs b/src/Xmobar/Plugins/Monitors/Common/Run.hs index 74a7695..a73a6fb 100644 --- a/src/Xmobar/Plugins/Monitors/Common/Run.hs +++ b/src/Xmobar/Plugins/Monitors/Common/Run.hs @@ -19,6 +19,7 @@ module Xmobar.Plugins.Monitors.Common.Run ( runM , runMD , runMB , runMBD + , getArgvs ) where import Control.Exception (SomeException,handle) @@ -55,6 +56,13 @@ options = , Option "E" ["maxtwidthellipsis"] (ReqArg MaxTotalWidthEllipsis "Maximum total width ellipsis") "Ellipsis to be added to the total text when it has reached its max width." ] +-- | Get all argument values out of a list of arguments. +getArgvs :: [String] -> [String] +getArgvs args = + case getOpt Permute options args of + (_, n, [] ) -> n + (_, _, errs) -> errs + doArgs :: [String] -> ([String] -> Monitor String) -> ([String] -> Monitor Bool) -- cgit v1.2.3