Command with subcommands, init, new-issue, start-review, end-review

This commit is contained in:
Yann Esposito (Yogsototh) 2018-08-30 18:33:02 +02:00
parent adcb4d2df2
commit 3d9f0acc57
Signed by untrusted user who does not match committer: yogsototh
GPG key ID: 7B19A4C650D59646
2 changed files with 34 additions and 1 deletions

View file

@ -134,6 +134,7 @@ markdown wasn't created to deal with todo list, etc...
Org-mode file can handle meta-datas, can be presented with columns, sorted,
can provide agenda views, etc...
* Why is this important?
It is very important to put all those meta-data about your project inside the
repository because:

34
gpm.hs Normal file → Executable file
View file

@ -4,11 +4,43 @@
#! nix-shell -I nixpkgs="https://github.com/NixOS/nixpkgs/archive/16d475334409f7fa632929b2838421b4ffe34927.tar.gz"
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
import Protolude hiding (stdout,(%))
import Protolude hiding (stdout,(%),die)
import Turtle
main :: IO ()
main = do
x <- options "Git Project Manager" parser
case x of
Init -> init
NewIssue -> newIssue
StartReview br -> startReview br
EndReview br -> endReview br
data Command = Init
| NewIssue
| StartReview (Maybe Text)
| EndReview (Maybe Text)
deriving (Eq)
parser :: Parser Command
parser = subcommand "init" "Initialize gpm" (pure Init)
<|> subcommand "new-issue" "Create a new Issue" (pure NewIssue)
<|> StartReview <$> subcommand "start-review" "Start review (use current branch by default)"
(optional (argText "branch" "The git branch to review"))
<|> EndReview <$> subcommand "end-review" "End review (use current branch by default)"
(optional (argText "branch" "The git branch to end review"))
newIssue :: IO ()
newIssue = die "TODO"
startReview :: Maybe Text -> IO ()
startReview br = die "TODO"
endReview :: Maybe Text -> IO ()
endReview br = die "TODO"
init :: IO ()
init = do
echo "# <GPM> -- Git Project Manager"
mkNewEmptyBranch "gpm"
initIssues