-
Notifications
You must be signed in to change notification settings - Fork 330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remotelink (web link) support #411
Open
jmtd
wants to merge
2
commits into
go-jira:master
Choose a base branch
from
jmtd:remotelink-support-112
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+91
−2
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package jiracmd | ||
|
||
import ( | ||
"github.com/coryb/figtree" | ||
"github.com/coryb/oreo" | ||
|
||
"github.com/go-jira/jira" | ||
"github.com/go-jira/jira/jiracli" | ||
kingpin "gopkg.in/alecthomas/kingpin.v2" | ||
) | ||
|
||
type RemoteLinkOptions struct { | ||
jiracli.CommonOptions `yaml:",inline" json:",inline" figtree:",inline"` | ||
Issue string `yaml:"issue,omitempty" json:"issue,omitempty"` | ||
Project string `yaml:"project,omitempty" json:"project,omitempty"` | ||
// There is no existing jiradata definition for RemoteObject | ||
URL string | ||
Title string | ||
} | ||
|
||
func CmdRemoteLinkRegistry() *jiracli.CommandRegistryEntry { | ||
opts := RemoteLinkOptions {} | ||
return &jiracli.CommandRegistryEntry{ | ||
"Link an issue to a remote URI", | ||
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error { | ||
jiracli.LoadConfigs(cmd, fig, &opts) | ||
return CmdRemoteLinkUsage(cmd, &opts) | ||
}, | ||
func(o *oreo.Client, globals *jiracli.GlobalOptions) error { | ||
opts.Issue = jiracli.FormatIssue(opts.Issue, opts.Project) | ||
return CmdRemoteLink(o, globals, &opts) | ||
}, | ||
} | ||
} | ||
|
||
func CmdRemoteLinkUsage(cmd *kingpin.CmdClause, opts *RemoteLinkOptions) error { | ||
jiracli.BrowseUsage(cmd, &opts.CommonOptions) | ||
jiracli.EditorUsage(cmd, &opts.CommonOptions) | ||
jiracli.TemplateUsage(cmd, &opts.CommonOptions) | ||
|
||
cmd.Arg("ISSUE", "issue").Required().StringVar(&opts.Issue) | ||
cmd.Arg("TITLE", "Link title").Required().StringVar(&opts.Title) | ||
cmd.Arg("URL", "Link URL").Required().StringVar(&opts.URL) | ||
|
||
return nil | ||
} | ||
|
||
func CmdRemoteLink(o *oreo.Client, globals *jiracli.GlobalOptions, opts *RemoteLinkOptions) error { | ||
if err := jira.LinkRemoteIssue(o, globals.Endpoint.Value, opts.Issue, opts.URL, opts.Title); err != nil { | ||
return err | ||
} | ||
// unhandled if !globals.Quiet.Value { | ||
// unhandled if opts.Browse.Value { | ||
|
||
return nil | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you ever pick this up again, would you mind adding support for other fields? e.g. https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/doorkeeper/worker/DoorkeeperJIRAFeedWorker.php#L230-L249
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unlikely to return to this, to be honest; I think the odds of it being merged are close to zero. Although I'm still using a build with this in it personally. on my TODO list is to look at https://github.com/ankitpokhrel/jira-cli and see if that's a better candidate going forward.