Skip to content

Commit

Permalink
Update changelog date and version num
Browse files Browse the repository at this point in the history
  • Loading branch information
tbidne committed Apr 3, 2022
1 parent 8d15dbc commit 3bc42e4
Show file tree
Hide file tree
Showing 28 changed files with 335 additions and 335 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Revision history for shell-run

## 0.1.0.0 -- 2022-02-24
## 0.1 -- 2022-04-03

* First version. Released on an unsuspecting world.
2 changes: 1 addition & 1 deletion shell-run.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.4
name: shell-run
version: 0.1.0.0
version: 0.1
license: BSD-3-Clause
license-file: LICENSE
tested-with: GHC ==8.10.7 || ==9.0.2 || ==9.2.1
Expand Down
2 changes: 1 addition & 1 deletion src/ShellRun.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- | This module is the entry point to the @Shell-Run@ library used by
-- the @Shell-Run@ executable.
--
-- @since 0.1.0.0
-- @since 0.1
module ShellRun
( ShellT,
runShellT,
Expand Down
44 changes: 22 additions & 22 deletions src/ShellRun/Args.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

-- | Provides functionality for parsing command line arguments.
--
-- @since 0.1.0.0
-- @since 0.1
module ShellRun.Args
( Args (..),
ALineTruncation (..),
Expand Down Expand Up @@ -62,78 +62,78 @@ import Text.Read qualified as TR
-- type from 'Truncation' to add a third option, to detect the terminal size
-- automatically.
--
-- @since 0.1.0.0
-- @since 0.1
data ALineTruncation
= -- | @since 0.1.0.0
= -- | @since 0.1
Undetected (Truncation 'TCmdLine)
| -- | @since 0.1.0.0
| -- | @since 0.1
Detected
deriving
( -- | @since 0.1.0.0
( -- | @since 0.1
Eq,
-- | @since 0.1.0.0
-- | @since 0.1
Show
)

makePrismLabels ''ALineTruncation

-- | Type for parsing command line args.
--
-- @since 0.1.0.0
-- @since 0.1
data Args = MkArgs
{ -- | Whether to log commands.
--
-- @since 0.1.0.0
-- @since 0.1
cmdLogging :: CmdLogging,
-- | Overarching option for logging. If it is false then all logging is
-- disabled.
--
-- @since 0.1.0.0
-- @since 0.1
globalLogging :: Bool,
-- | Optional path to log file.
--
-- @since 0.1.0.0
-- @since 0.1
fileLogging :: FilePathDefault,
-- | Whether to display command by (key) name or command.
--
-- @since 0.1.0.0
-- @since 0.1
cmdDisplay :: CmdDisplay,
-- | Optional legend file.
--
-- @since 0.1.0.0
-- @since 0.1
legend :: FilePathDefault,
-- | Timeout.
--
-- @since 0.1.0.0
-- @since 0.1
timeout :: Timeout,
-- | The max number of command characters to display in the logs.
--
-- @since 0.1.0.0
-- @since 0.1
cmdNameTrunc :: Truncation 'TCmdName,
-- | The max number of line characters to display in the logs.
--
-- @since 0.1.0.0
-- @since 0.1
cmdLineTrunc :: ALineTruncation,
-- | List of commands.
--
-- @since 0.1.0.0
-- @since 0.1
commands :: NonEmptySeq Text
}
deriving
( -- | @since 0.1.0.0
( -- | @since 0.1
Eq,
-- | @since 0.1.0.0
-- | @since 0.1
Show
)

makeFieldLabelsNoPrefix ''Args

-- | @since 0.1.0.0
-- | @since 0.1
instance Semigroup ALineTruncation where
Undetected x <> Undetected y = Undetected (x <> y)
_ <> _ = Detected

-- | @since 0.1.0.0
-- | @since 0.1
instance Monoid ALineTruncation where
mempty = Undetected mempty

Expand All @@ -153,7 +153,7 @@ instance Monoid ALineTruncation where
-- commands = "ls" :|^ fromList []
-- }
--
-- @since 0.1.0.0
-- @since 0.1
defaultArgs :: NonEmptySeq Text -> Args
defaultArgs cmds =
MkArgs
Expand All @@ -170,7 +170,7 @@ defaultArgs cmds =

-- | 'ParserInfo' type for parsing 'Args'.
--
-- @since 0.1.0.0
-- @since 0.1
parserInfoArgs :: ParserInfo Args
parserInfoArgs =
ParserInfo
Expand Down
12 changes: 6 additions & 6 deletions src/ShellRun/Class/MonadShell.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-- | Provides the `MonadShell` typeclass.
--
-- @since 0.1.0.0
-- @since 0.1
module ShellRun.Class.MonadShell
( MonadShell (..),
runShell,
Expand All @@ -20,29 +20,29 @@ import System.FilePath ((</>))

-- | The core typeclass for @shell-run@.
--
-- @since 0.1.0.0
-- @since 0.1
type MonadShell :: (Type -> Type) -> Constraint
class Monad m => MonadShell m where
-- | Returns the default directory e.g. Xdg config dir.
--
-- @since 0.1.0.0
-- @since 0.1
getDefaultDir :: m FilePath

-- | Given a filepath, attempts to read and parse the file into
-- a `LegendMap`.
--
-- @since 0.1.0.0
-- @since 0.1
legendPathToMap :: FilePath -> m (Either LegendErr LegendMap)

-- | Runs commands.
--
-- @since 0.1.0.0
-- @since 0.1
runCommands :: NonEmptySeq Command -> m ()

-- | `runShell` is the entry point for running shell commands i.e.
-- `MonadShell` instances.
--
-- @since 0.1.0.0
-- @since 0.1
runShell ::
( HasCommands env,
HasLegend env,
Expand Down
10 changes: 5 additions & 5 deletions src/ShellRun/Class/MonadTime.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-- | Provides the 'MonadTime' class.
--
-- @since 0.1.0.0
-- @since 0.1
module ShellRun.Class.MonadTime
( MonadTime (..),
)
Expand All @@ -12,15 +12,15 @@ import ShellRun.Prelude

-- | Class for retrieving the current system time.
--
-- @since 0.1.0.0
-- @since 0.1
class Monad m => MonadTime m where
-- | @since 0.1.0.0
-- | @since 0.1
getSystemTime :: m UTCTime

-- | @since 0.1.0.0
-- | @since 0.1
instance MonadTime IO where
getSystemTime = Clock.getCurrentTime

-- | @since 0.1.0.0
-- | @since 0.1
instance MonadTime m => MonadTime (ReaderT e m) where
getSystemTime = lift getSystemTime
18 changes: 9 additions & 9 deletions src/ShellRun/Command.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

-- | Provides the 'Command' wrapper for commands.
--
-- @since 0.1.0.0
-- @since 0.1
module ShellRun.Command
( Command (..),
translateCommands,
Expand All @@ -31,27 +31,27 @@ import ShellRun.Utils qualified as U

-- | Wrapper for shell commands.
--
-- @since 0.1.0.0
-- @since 0.1
data Command = MkCommand
{ -- | The key name for the command, for display purposes.
--
-- @since 0.1.0.0
-- @since 0.1
getKey :: Maybe Text,
-- | The shell command to run.
--
-- @since 0.1.0.0
-- @since 0.1
command :: Text
}
deriving stock
( -- | @since 0.1.0.0
( -- | @since 0.1
Eq,
-- | @since 0.1.0.0
-- | @since 0.1
Generic,
-- | @since 0.1.0.0
-- | @since 0.1
Show
)
deriving anyclass
( -- | @since 0.1.0.0
( -- | @since 0.1
Hashable
)

Expand Down Expand Up @@ -99,7 +99,7 @@ instance IsString Command where
-- :}
-- Left (CyclicKeyErr "a -> b -> c -> a")
--
-- @since 0.1.0.0
-- @since 0.1
translateCommands :: LegendMap -> NonEmptySeq Text -> Either LegendErr (NonEmptySeq Command)
translateCommands mp (t :|^ ts) = sequenceA $ U.foldMap1 (lineToCommands mp) t ts

Expand Down
18 changes: 9 additions & 9 deletions src/ShellRun/Data/FilePathDefault.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

-- | Provides the 'FilePathDefault' type.
--
-- @since 0.1.0.0
-- @since 0.1
module ShellRun.Data.FilePathDefault
( FilePathDefault (..),
)
Expand All @@ -13,29 +13,29 @@ import ShellRun.Prelude

-- | FilePath option that includes none and default possibilities.
--
-- @since 0.1.0.0
-- @since 0.1
data FilePathDefault
= -- | @since 0.1.0.0
= -- | @since 0.1
FPNone
| -- | @since 0.1.0.0
| -- | @since 0.1
FPDefault
| -- | @since 0.1.0.0
| -- | @since 0.1
FPManual FilePath
deriving
( -- | @since 0.1.0.0
( -- | @since 0.1
Eq,
-- | @since 0.1.0.0
-- | @since 0.1
Show
)

-- | @since 0.1.0.0
-- | @since 0.1
instance Semigroup FilePathDefault where
FPManual f <> _ = FPManual f
_ <> FPManual f = FPManual f
FPDefault <> _ = FPDefault
FPNone <> r = r

-- | @since 0.1.0.0
-- | @since 0.1
instance Monoid FilePathDefault where
mempty = FPNone

Expand Down
14 changes: 7 additions & 7 deletions src/ShellRun/Data/InfNum.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

-- | Provides numerical types for dealing with infinity.
--
-- @since 0.1.0.0
-- @since 0.1
module ShellRun.Data.InfNum
( PosInfNum (..),
)
Expand All @@ -13,18 +13,18 @@ import ShellRun.Prelude

-- | Represents a numerical type with positive infinity.
--
-- @since 0.1.0.0
-- @since 0.1
data PosInfNum a
= -- | @since 0.1.0.0
= -- | @since 0.1
PFin a
| -- | @since 0.1.0.0
| -- | @since 0.1
PPosInf
deriving
( -- | @since 0.1.0.0
( -- | @since 0.1
Eq,
-- | @since 0.1.0.0
-- | @since 0.1
Ord,
-- | @since 0.1.0.0
-- | @since 0.1
Show
)

Expand Down
Loading

0 comments on commit 3bc42e4

Please sign in to comment.