/
Main.hs
25 lines (19 loc) · 969 Bytes
/
Main.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Turtle
import Prelude hiding (FilePath)
import PromptLib (multiLinePrompt, singleLinePrompt)
import HSHLib (noArgs)
data PromptCommand = MultiLine (Maybe Text) | OneLine (Maybe Text) deriving (Show)
main :: IO ()
main = do
x <- options "Git-aware prompt: https://github.com/apauley/ps1#readme" parser
case x of
MultiLine trackBranch -> multiLinePrompt trackBranch >>= echo
OneLine trackBranch -> singleLinePrompt trackBranch >>= echo
parser :: Parser PromptCommand
parser = fmap MultiLine (subcommand "ml" "Generates a multi-line git-aware shell prompt" trackParser)
<|> fmap OneLine (subcommand "sl" "Generates a single-line git-aware shell prompt" trackParser)
trackParser :: Parser (Maybe Text)
trackParser = optional (optText "track-branch" 't'
"Track if your commits are directly on top of a branch that you may need to merge back to, eg. origin/master")