Safe Haskell | Safe-Inferred |
---|
Various functions used inside Gitson.
- entryPath :: FilePath -> String -> FilePath
- lockPath :: FilePath
- filterFilenamesAsKeys :: [FilePath] -> [String]
- filterDirs :: [FilePath] -> IO [FilePath]
- insideDirectory :: FilePath -> IO a -> IO a
- lastCommitText :: IO String
- shell :: String -> [String] -> IO ()
- intoMaybe :: Maybe a -> b -> Maybe (a, b)
- maybeReadIntString :: String -> Maybe (Int, String)
- nextKeyId :: [String] -> Int
Documentation
entryPath :: FilePath -> String -> FilePathSource
Combines two paths and adds the .json extension.
>>>
entryPath "things" "entry"
"things/entry.json"
>>>
entryPath "things/" "entry"
"things/entry.json"
filterFilenamesAsKeys :: [FilePath] -> [String]Source
Turns a list of filenames into a list of keys, ignoring non-JSON files.
>>>
filterFilenamesAsKeys [".", "..", "k1.json", "unrelated.file"]
["k1"]
filterDirs :: [FilePath] -> IO [FilePath]Source
Filters a list of file paths, leaving only paths to existing non-hidden directories.
insideDirectory :: FilePath -> IO a -> IO aSource
Returns an IO action that switches the current directory to a given path, executes the given IO action and switches the current directory back.
lastCommitText :: IO StringSource
Returns the message of the last git commit in the repo where the current directory is located.
shell :: String -> [String] -> IO ()Source
Runs a shell command with stdin, stdout and stderr set to devnull.