Repository navigation
Conversation
|
|
||
| func PreserveInput(io *iostreams.IOStreams, ims *IssueMetadataState, defs Defaults, doPreserve *bool) func() { | ||
| return func() { | ||
| if ims.Body == defs.Body && ims.Title == defs.Title { |
There was a problem hiding this comment.
Considering that the metadata state has more information than just the body and title I don't know if this check against the default body and title is very valuable. I would say that in the cases of failure where we want to dump the output we should write to disk whatever information we have regardless of what it is.
There was a problem hiding this comment.
i want a check like this so if someone ctrl-c's immediately we don't litter the filesystem; but I'm realizing I should just augment it with nil checks for metadata.
| // this extra newline guards against appending to the end of a survey line | ||
| fmt.Fprintln(out) | ||
|
|
||
| data, err := json.Marshal(ims) |
There was a problem hiding this comment.
I like writing the output in json, as it allows flexibility for if we want to add in recovery options later on but is still usable to end users right away using jq.
| } | ||
|
|
||
| doPreserveInput := false | ||
| defer shared.PreserveInput(opts.IO, &tb, defs, &doPreserveInput)() |
There was a problem hiding this comment.
This may be too much magic but I was wondering if we could do something like https://play.golang.org/p/Fu9C96Gcr-C so that we don't need to tell the PreserveInput function when to preserve the input or not, it would be able to check if the calling function was going to return an error and then do its work if so. This path would entail refactoring createRun to have a named output.
There was a problem hiding this comment.
mm, i'm open to that. we don't tend to use named outputs but i think it could help, here
I'd really like for this to be a part of the flow! Without it, I feel like we're still leaving people at a dead end unless we give them a way to use that output to try again. Building off of that, could we remember this file and prompt the user with some kind of "try again?" option? Maybe when you run |
we can certainly try that; I'll start with the |
|
Updated with I think for now I'd rather restoring be manual. The current state of this PR is a better situation than what we have now in trunk and, if it turns out to be sufficient, means we don't have to manage a prompt that might get annoying if not implemented properly. Since there's been no objection to the approach up til now I'll expand this to cover issue creation and add tests. |
|
@vilmibm I'm totally fine with just the |
|
switching to #2408 |
Closes #906
This is a proposal for mitigating failed pr/issue creation.
Preserved input can be restored (including metadata) like this:
notes
jq .Body--jsonoptionquestions
is json reasonable? i'm thinking i could add a--jsonflag to[pr|issue] createthat could ingest a json file which has utility beyond just recovering from failureis using temp dir instead of current working directory reasonable?