fix(agent-task/shared): add IsSessionID
Signed-off-by: Babak K. Shandiz <babakks@github.com>
This commit is contained in:
parent
a769175019
commit
5f6189be09
1 changed files with 8 additions and 0 deletions
|
|
@ -1,10 +1,14 @@
|
|||
package shared
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
|
||||
"github.com/cli/cli/v2/pkg/cmd/agent-task/capi"
|
||||
"github.com/cli/cli/v2/pkg/cmdutil"
|
||||
)
|
||||
|
||||
var uuidRE = regexp.MustCompile(`^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$`)
|
||||
|
||||
func CapiClientFunc(f *cmdutil.Factory) func() (capi.CapiClient, error) {
|
||||
return func() (capi.CapiClient, error) {
|
||||
cfg, err := f.Config()
|
||||
|
|
@ -21,3 +25,7 @@ func CapiClientFunc(f *cmdutil.Factory) func() (capi.CapiClient, error) {
|
|||
return capi.NewCAPIClient(httpClient, authCfg), nil
|
||||
}
|
||||
}
|
||||
|
||||
func IsSessionID(s string) bool {
|
||||
return uuidRE.MatchString(s)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue