Skip to content

Commit

Permalink
💡 Finish haddock
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Middendorf committed Apr 10, 2020
1 parent a58f31f commit ef8fab5
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/NixManager/Admin/ValidRebuildModes.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import Data.Text ( Text )
descriptionForValidRebuildMode :: NixRebuildMode -> Maybe Text
descriptionForValidRebuildMode m = lookup m validRebuildModesWithDescription

-- | List of all valid rebuild modes with a description
validRebuildModesWithDescription :: [(NixRebuildMode, Text)]
validRebuildModesWithDescription =
[ ( NixRebuildSwitch
Expand Down
7 changes: 4 additions & 3 deletions src/NixManager/NixPackageMeta.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ import Data.Aeson ( FromJSON
, (.:)
)

-- | Metadata for a Nix package. This is a companion module to "NixManager.NixPackage"
data NixPackageMeta = NixPackageMeta {
_npmName :: Text
, _npmVersion :: Text
, _npmDescription :: Text
_npmName :: Text -- ^ Package name
, _npmVersion :: Text -- ^ Package version
, _npmDescription :: Text -- ^ Package description
} deriving(Eq,Show)

makeLenses ''NixPackageMeta
Expand Down
9 changes: 9 additions & 0 deletions src/NixManager/PosixTools.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{-|
Description: Bash expressions for some POSIX tools
Bash expressions for some POSIX tools
-}
{-# LANGUAGE OverloadedStrings #-}
module NixManager.PosixTools
( mkdir
Expand All @@ -23,16 +28,20 @@ import Data.Text ( Text
)
import Data.List.NonEmpty ( NonEmpty )

-- | Wrapper for @mkdir@ (first parameter specifies recursion)
mkdir :: Bool -> NonEmpty FilePath -> Expr
mkdir recursive paths = Command
"mkdir"
(mwhen recursive ["-p"] <> toList (LiteralArg . pack <$> paths))

-- | Wrapper for @cp@
cp :: FilePath -> FilePath -> Expr
cp from to = Command "cp" (LiteralArg <$> [pack from, pack to])

-- | Wrapper for @mv@
mv :: FilePath -> FilePath -> Expr
mv from to = Command "mv" (LiteralArg <$> [pack from, pack to])

-- | Wrapper for @kill@ (currently only @-9@)
kill :: Pid -> Expr
kill pid = Command "kill" ["-9", RawArg (showText pid)]
2 changes: 1 addition & 1 deletion src/NixManager/Util.hs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import qualified Data.Text.Encoding as Encoding
-- | Since we’re working with 'Text' as much as possible, we’re using a text based error type instead of the customary 'Either String'
type TextualError = Either Text

-- | Convert something showable to 'Text'. Notably 'String' and 'Exception' types.
-- | Convert something showable to 'Text'. Notably 'String' and @Exception@ types.
fromShowableError :: Show ex => Either ex e -> TextualError e
fromShowableError = first showText

Expand Down
4 changes: 2 additions & 2 deletions src/NixManager/View/ComboBox.hs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ data ComboBoxProperties = ComboBoxProperties {

makeLenses ''ComboBoxProperties

-- ^ Triggered when the combobox changes its value to a new index
-- | Triggered when the combobox changes its value to a new index
newtype ComboBoxChangeEvent = ComboBoxChangeEvent Int

-- ^ Build a Combobox from Gtk attributes and some user-defined ones
-- | Build a Combobox from Gtk attributes and some user-defined ones
comboBox
:: Vector (Attribute Gtk.ComboBoxText ComboBoxChangeEvent)
-> ComboBoxProperties
Expand Down
3 changes: 2 additions & 1 deletion src/NixManager/View/Css.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Data.ByteString ( ByteString )
import qualified GI.Gdk as Gdk
import qualified GI.Gtk as Gtk


-- | Global app Stylesheet
styles :: ByteString
styles = mconcat
[ ".package-row-installed { background-color: #cdffcd; }"
Expand All @@ -30,6 +30,7 @@ styles = mconcat
, ".nixos-manager-grey-background { background-color: #eeeeee; }"
]

-- | Initialize CSS stylesheets
initCss :: IO ()
initCss = do
cssProvider <- Gtk.cssProviderNew
Expand Down

0 comments on commit ef8fab5

Please sign in to comment.