question with default
This commit is contained in:
parent
699a759140
commit
8ca2ed83a7
1 changed files with 27 additions and 11 deletions
|
@ -23,9 +23,10 @@ import Turtle
|
||||||
|
|
||||||
import Data.FileEmbed (embedStringFile)
|
import Data.FileEmbed (embedStringFile)
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import GPM.Helpers
|
|
||||||
import Text.Mustache
|
import Text.Mustache
|
||||||
|
|
||||||
|
import GPM.Helpers
|
||||||
|
|
||||||
data IssueOptions = IssueOptions
|
data IssueOptions = IssueOptions
|
||||||
{ interactive :: Bool
|
{ interactive :: Bool
|
||||||
, newIssue :: NewIssue
|
, newIssue :: NewIssue
|
||||||
|
@ -121,17 +122,32 @@ handleNewIssue opts = do
|
||||||
validTmpNewIssue
|
validTmpNewIssue
|
||||||
|
|
||||||
interactiveNewIssue :: NewIssue -> IO NewIssue
|
interactiveNewIssue :: NewIssue -> IO NewIssue
|
||||||
interactiveNewIssue _ =
|
interactiveNewIssue ni =
|
||||||
NewIssue <$> (fromMaybe PriorityB <$> ask "priority" "ex: A,B,C" toPriority)
|
NewIssue
|
||||||
<*> (fromMaybe "TODO" <$> ask "status" "ex: TODO, QUESTION" identity)
|
<$> (fromMaybe (priority ni)
|
||||||
<*> (fromMaybe "Issue title" <$> ask "title" "Short Description" identity)
|
<$> ask "priority" (ptot (priority ni)) toPriority)
|
||||||
<*> ask "user" "your nick" identity
|
<*> (fromMaybe (status ni)
|
||||||
<*> ask "branch" "related branch" identity
|
<$> ask "status" (status ni) identity)
|
||||||
<*> (fromMaybe [] <$> ask "tags" "comma separated tags" (T.splitOn ","))
|
<*> (fromMaybe (title ni)
|
||||||
<*> ask "assignee" "a single nick" identity
|
<$> ask "title" (title ni) identity)
|
||||||
<*> (fromMaybe [] <$> ask "reviewers" "comma separated nicks" (T.splitOn ","))
|
<*> (maybe (user ni) Just
|
||||||
<*> ask "description" "the long description" identity
|
<$>
|
||||||
|
ask "user" (fromMaybe "your name" (user ni)) identity)
|
||||||
|
<*> (maybe (branch ni) Just
|
||||||
|
<$> ask "branch" (fromMaybe "related branch" (branch ni)) identity)
|
||||||
|
<*> (fromMaybe (tags ni)
|
||||||
|
<$> ask "tags" "comma separated tags" (T.splitOn ","))
|
||||||
|
<*> (maybe (assignee ni) Just
|
||||||
|
<$> ask "assignee" "a single nick" identity)
|
||||||
|
<*> (fromMaybe (tags ni)
|
||||||
|
<$> ask "reviewers" "comma separated nicks" (T.splitOn ","))
|
||||||
|
<*> (maybe (description ni) Just
|
||||||
|
<$> ask "description" "the long description" identity)
|
||||||
where
|
where
|
||||||
|
ptot :: Priority -> Text
|
||||||
|
ptot PriorityA = "A"
|
||||||
|
ptot PriorityB = "B"
|
||||||
|
ptot PriorityC = "C"
|
||||||
ask :: Text -> Text -> (Text -> a) -> IO (Maybe a)
|
ask :: Text -> Text -> (Text -> a) -> IO (Maybe a)
|
||||||
ask field ex tr = do
|
ask field ex tr = do
|
||||||
putText $ "Please enter " <> field <> "("<> ex <>"): "
|
putText $ "Please enter " <> field <> "("<> ex <>"): "
|
||||||
|
|
Loading…
Reference in a new issue