Add interactive mode for tea milestone create
#310
No reviewers
Labels
No Label
kind/breaking
kind/bug
kind/build
kind/dependency
kind/deployment
kind/docs
kind
enhancement
kind
feature
kind/proposal
kind
question
kind
refactor
kind/security
kind/testing
kind/translation
priority/critical
priority/high
priority/low
priority/medium
reviewed/duplicate
reviewed/invalid
reviewed/wontfix
skip-changelog
status/blocked
status/has-backport
status/has-pull
status/needs-backport
status/needs-feedback
status/needs-reviews
status/wip
upstream/gitea
upstream/sdk
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: gitea/tea#310
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "YakoYakoYokuYoku/tea:interactive-ms"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #245.
@ -0,0 +18,4 @@
// title is required
if len(title) == 0 {
fmt.Printf("Title is required\n")
return fmt.Errorf("Title is required")
Add interactive mode for `tea issue create`to Add interactive mode for `tea milestone create`Thanks ?
Do you plan to ask for the deadline as well? That would be great as it prepares for #303
Yeah, let's do that.
@noerw May I ask you the date layout for the deadline (see time.Parse)?
by the way pleace "update branch" ...
@ -43,28 +42,22 @@ var CmdMilestonesCreate = cli.Command{
func runMilestonesCreate(cmd *cli.Context) error {
ctx := context.InitCommand(cmd)
ctx.Ensure(context.CtxRequirement{RemoteRepo: true})
isn't
ctx.Ensure(context.CtxRequirement{RemoteRepo: true})
still needed?cc @noerw
It is.
@YakoYakoYokuYoku Regarding time parsing: I'd do something similar to
edit: doe RFC3339 accept date only? If not, we should accept a date in RFC3339 structure, but with only the date..
a169550f62
to747fa1345f
It seems that
time.RFC3339
doesn't support an ISO 8601 date structure with only the date, but we could nest twotime.Parse
s (one withtime.RFC3339
and the other with"2006-01-02"
) or we could usedateparse.ParseAny
.edit:
dateparse
is also ingo.mod
.@YakoYakoYokuYoku Sounds good to me to have "2006-01-02" and RFC3339 as fallback. I'd avoid another dependencyScratch that, we already have dateparse ? Lets go for
dateparse.ParseLocal
Yeah I know that I'm using
time.Parse
here, but I would be thankful if the reviews point out other important things.@ -0,0 +16,4 @@
)
// CreateMilestone interactively creates a milestone
func CreateMilestone(login *config.Login, owner, repo string, deadline *time.Time, state gitea.StateType) error {
No need for the deadline & state params: They will never be set anyway
didn't he add a flag for this?
Yeah, but interactive mode won't be enabled if there is a flag set..
We could ofcourse change the condition to go into interactive mode, if not all mandatory flags are provided, but idk if that's better
no interactive should only if no flags are pressent - how would you integrate tea into scripts if it would ask you the whole time ...
@ -0,0 +39,4 @@
}
// deadline
promptI = &survey.Input{Message: "Milestone deadline [no due date]:"}
I'd put the date parsing inside a
survey.Validator
similar topromptRepoSlug()
. This lets users iterate on wrong inputs, instead of failing the entire commandGotcha, thx for pointing that out ?
@ -64,2 +68,2 @@
if err != nil {
return err
if ctx.NumFlags() == 0 {
return interact.CreateMilestone(ctx.Login, ctx.Owner, ctx.Repo, deadline, state)
@ -0,0 +17,4 @@
// CreateMilestone interactively creates a milestone
func CreateMilestone(login *config.Login, owner, repo string, deadline *time.Time, state gitea.StateType) error {
var title, description, dueDate string
@ -0,0 +59,4 @@
title,
description,
deadline,
state)
@YakoYakoYokuYoku nice work 👍
You welcome too ?