mirror of
https://github.com/onyx-and-iris/ignr.git
synced 2026-04-18 07:13:33 +00:00
move api list/get calls into runPrompt
add --height/-H flag to new command add template language to template. This may be useful if combining gitignores.
This commit is contained in:
10
context.go
10
context.go
@@ -8,9 +8,15 @@ import (
|
||||
|
||||
type contextKey string
|
||||
|
||||
const clientKey contextKey = "client"
|
||||
var clientKey = contextKey("client")
|
||||
|
||||
func getClientFromContext(ctx context.Context) (*github.Client, bool) {
|
||||
// withClient returns a new context with the GitHub client set.
|
||||
func withClient(ctx context.Context, client *github.Client) context.Context {
|
||||
return context.WithValue(ctx, clientKey, client)
|
||||
}
|
||||
|
||||
// clientFromContext retrieves the GitHub client from the context.
|
||||
func clientFromContext(ctx context.Context) (*github.Client, bool) {
|
||||
client, ok := ctx.Value(clientKey).(*github.Client)
|
||||
return client, ok
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user