feat(agent-task view): support PR /agent-sessions/* URL as argument
Signed-off-by: Babak K. Shandiz <babakks@github.com>
This commit is contained in:
parent
7e21837f3d
commit
3798d98969
2 changed files with 11 additions and 0 deletions
|
|
@ -80,6 +80,8 @@ func NewCmdView(f *cmdutil.Factory, runF func(*ViewOptions) error) *cobra.Comman
|
|||
opts.SelectorArg = args[0]
|
||||
if shared.IsSessionID(opts.SelectorArg) {
|
||||
opts.SessionID = opts.SelectorArg
|
||||
} else if sessionID, err := shared.ParsePullRequestAgentSessionURL(opts.SelectorArg); err == nil {
|
||||
opts.SessionID = sessionID
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,15 @@ func TestNewCmdList(t *testing.T) {
|
|||
SessionID: "00000000-0000-0000-0000-000000000000",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "PR agent-session URL arg tty",
|
||||
tty: true,
|
||||
args: "https://github.com/OWNER/REPO/pull/101/agent-sessions/00000000-0000-0000-0000-000000000000",
|
||||
wantOpts: ViewOptions{
|
||||
SelectorArg: "https://github.com/OWNER/REPO/pull/101/agent-sessions/00000000-0000-0000-0000-000000000000",
|
||||
SessionID: "00000000-0000-0000-0000-000000000000",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "non-session ID arg tty",
|
||||
tty: true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue