Safe Haskell | Safe-Inferred |
---|
Various functions used inside Gitson.
- entryPath :: FilePath -> FilePath -> FilePath
- lockPath :: FilePath
- filterFilenamesAsKeys :: [String] -> [String]
- insideDirectory :: FilePath -> IO a -> IO a
- stripWhitespaceRight :: FilePath -> FilePath
- findRepoRoot :: FilePath -> IO FilePath
- lastCommitText :: IO String
- devNull :: IO Handle
- shell :: String -> [String] -> IO ()
Documentation
entryPath :: FilePath -> FilePath -> FilePathSource
Combines two paths and adds the .json extension.
>>>
entryPath "things" "entry"
"things/entry.json"
>>>
entryPath "things/" "entry"
"things/entry.json"
filterFilenamesAsKeys :: [String] -> [String]Source
Turns a list of filenames into a list of keys.
>>>
filterFilenamesAsKeys [".", "..", "k1.json"]
["k1"]
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.
stripWhitespaceRight :: FilePath -> FilePathSource
Removes trailing whitespace like the newline you get from executing commands.
>>>
stripWhitespaceRight "/path/to/thingy \n\n\n"
"/path/to/thingy"
findRepoRoot :: FilePath -> IO FilePathSource
Finds the path to the git repository a given path belongs to.
lastCommitText :: IO StringSource
Returns the message of the last git commit in the repo where the current directory is located.