repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
sequence
docstring
stringlengths
6
2.61k
docstring_tokens
sequence
sha
stringlengths
40
40
url
stringlengths
85
252
partition
stringclasses
1 value
go-swagger/go-swagger
examples/oauth2/restapi/operations/oauth_sample_api.go
NewOauthSampleAPI
func NewOauthSampleAPI(spec *loads.Document) *OauthSampleAPI { return &OauthSampleAPI{ handlers: make(map[string]map[string]http.Handler), formats: strfmt.Default, defaultConsumes: "application/json", defaultProduces: "application/json", customConsumers: make(map[string]runtime.Consumer), customProducers: make(map[string]runtime.Producer), ServerShutdown: func() {}, spec: spec, ServeError: errors.ServeError, BasicAuthenticator: security.BasicAuth, APIKeyAuthenticator: security.APIKeyAuth, BearerAuthenticator: security.BearerAuth, JSONConsumer: runtime.JSONConsumer(), JSONProducer: runtime.JSONProducer(), GetAuthCallbackHandler: GetAuthCallbackHandlerFunc(func(params GetAuthCallbackParams) middleware.Responder { return middleware.NotImplemented("operation GetAuthCallback has not yet been implemented") }), GetLoginHandler: GetLoginHandlerFunc(func(params GetLoginParams) middleware.Responder { return middleware.NotImplemented("operation GetLogin has not yet been implemented") }), CustomersCreateHandler: customers.CreateHandlerFunc(func(params customers.CreateParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation CustomersCreate has not yet been implemented") }), CustomersGetIDHandler: customers.GetIDHandlerFunc(func(params customers.GetIDParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation CustomersGetID has not yet been implemented") }), OauthSecurityAuth: func(token string, scopes []string) (*models.Principal, error) { return nil, errors.NotImplemented("oauth2 bearer auth (OauthSecurity) has not yet been implemented") }, // default authorizer is authorized meaning no requests are blocked APIAuthorizer: security.Authorized(), } }
go
func NewOauthSampleAPI(spec *loads.Document) *OauthSampleAPI { return &OauthSampleAPI{ handlers: make(map[string]map[string]http.Handler), formats: strfmt.Default, defaultConsumes: "application/json", defaultProduces: "application/json", customConsumers: make(map[string]runtime.Consumer), customProducers: make(map[string]runtime.Producer), ServerShutdown: func() {}, spec: spec, ServeError: errors.ServeError, BasicAuthenticator: security.BasicAuth, APIKeyAuthenticator: security.APIKeyAuth, BearerAuthenticator: security.BearerAuth, JSONConsumer: runtime.JSONConsumer(), JSONProducer: runtime.JSONProducer(), GetAuthCallbackHandler: GetAuthCallbackHandlerFunc(func(params GetAuthCallbackParams) middleware.Responder { return middleware.NotImplemented("operation GetAuthCallback has not yet been implemented") }), GetLoginHandler: GetLoginHandlerFunc(func(params GetLoginParams) middleware.Responder { return middleware.NotImplemented("operation GetLogin has not yet been implemented") }), CustomersCreateHandler: customers.CreateHandlerFunc(func(params customers.CreateParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation CustomersCreate has not yet been implemented") }), CustomersGetIDHandler: customers.GetIDHandlerFunc(func(params customers.GetIDParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation CustomersGetID has not yet been implemented") }), OauthSecurityAuth: func(token string, scopes []string) (*models.Principal, error) { return nil, errors.NotImplemented("oauth2 bearer auth (OauthSecurity) has not yet been implemented") }, // default authorizer is authorized meaning no requests are blocked APIAuthorizer: security.Authorized(), } }
[ "func", "NewOauthSampleAPI", "(", "spec", "*", "loads", ".", "Document", ")", "*", "OauthSampleAPI", "{", "return", "&", "OauthSampleAPI", "{", "handlers", ":", "make", "(", "map", "[", "string", "]", "map", "[", "string", "]", "http", ".", "Handler", ")", ",", "formats", ":", "strfmt", ".", "Default", ",", "defaultConsumes", ":", "\"", "\"", ",", "defaultProduces", ":", "\"", "\"", ",", "customConsumers", ":", "make", "(", "map", "[", "string", "]", "runtime", ".", "Consumer", ")", ",", "customProducers", ":", "make", "(", "map", "[", "string", "]", "runtime", ".", "Producer", ")", ",", "ServerShutdown", ":", "func", "(", ")", "{", "}", ",", "spec", ":", "spec", ",", "ServeError", ":", "errors", ".", "ServeError", ",", "BasicAuthenticator", ":", "security", ".", "BasicAuth", ",", "APIKeyAuthenticator", ":", "security", ".", "APIKeyAuth", ",", "BearerAuthenticator", ":", "security", ".", "BearerAuth", ",", "JSONConsumer", ":", "runtime", ".", "JSONConsumer", "(", ")", ",", "JSONProducer", ":", "runtime", ".", "JSONProducer", "(", ")", ",", "GetAuthCallbackHandler", ":", "GetAuthCallbackHandlerFunc", "(", "func", "(", "params", "GetAuthCallbackParams", ")", "middleware", ".", "Responder", "{", "return", "middleware", ".", "NotImplemented", "(", "\"", "\"", ")", "\n", "}", ")", ",", "GetLoginHandler", ":", "GetLoginHandlerFunc", "(", "func", "(", "params", "GetLoginParams", ")", "middleware", ".", "Responder", "{", "return", "middleware", ".", "NotImplemented", "(", "\"", "\"", ")", "\n", "}", ")", ",", "CustomersCreateHandler", ":", "customers", ".", "CreateHandlerFunc", "(", "func", "(", "params", "customers", ".", "CreateParams", ",", "principal", "*", "models", ".", "Principal", ")", "middleware", ".", "Responder", "{", "return", "middleware", ".", "NotImplemented", "(", "\"", "\"", ")", "\n", "}", ")", ",", "CustomersGetIDHandler", ":", "customers", ".", "GetIDHandlerFunc", "(", "func", "(", "params", "customers", ".", "GetIDParams", ",", "principal", "*", "models", ".", "Principal", ")", "middleware", ".", "Responder", "{", "return", "middleware", ".", "NotImplemented", "(", "\"", "\"", ")", "\n", "}", ")", ",", "OauthSecurityAuth", ":", "func", "(", "token", "string", ",", "scopes", "[", "]", "string", ")", "(", "*", "models", ".", "Principal", ",", "error", ")", "{", "return", "nil", ",", "errors", ".", "NotImplemented", "(", "\"", "\"", ")", "\n", "}", ",", "// default authorizer is authorized meaning no requests are blocked", "APIAuthorizer", ":", "security", ".", "Authorized", "(", ")", ",", "}", "\n", "}" ]
// NewOauthSampleAPI creates a new OauthSample instance
[ "NewOauthSampleAPI", "creates", "a", "new", "OauthSample", "instance" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/oauth2/restapi/operations/oauth_sample_api.go#L28-L64
train
go-swagger/go-swagger
examples/oauth2/restapi/operations/oauth_sample_api.go
Validate
func (o *OauthSampleAPI) Validate() error { var unregistered []string if o.JSONConsumer == nil { unregistered = append(unregistered, "JSONConsumer") } if o.JSONProducer == nil { unregistered = append(unregistered, "JSONProducer") } if o.OauthSecurityAuth == nil { unregistered = append(unregistered, "OauthSecurityAuth") } if o.GetAuthCallbackHandler == nil { unregistered = append(unregistered, "GetAuthCallbackHandler") } if o.GetLoginHandler == nil { unregistered = append(unregistered, "GetLoginHandler") } if o.CustomersCreateHandler == nil { unregistered = append(unregistered, "customers.CreateHandler") } if o.CustomersGetIDHandler == nil { unregistered = append(unregistered, "customers.GetIDHandler") } if len(unregistered) > 0 { return fmt.Errorf("missing registration: %s", strings.Join(unregistered, ", ")) } return nil }
go
func (o *OauthSampleAPI) Validate() error { var unregistered []string if o.JSONConsumer == nil { unregistered = append(unregistered, "JSONConsumer") } if o.JSONProducer == nil { unregistered = append(unregistered, "JSONProducer") } if o.OauthSecurityAuth == nil { unregistered = append(unregistered, "OauthSecurityAuth") } if o.GetAuthCallbackHandler == nil { unregistered = append(unregistered, "GetAuthCallbackHandler") } if o.GetLoginHandler == nil { unregistered = append(unregistered, "GetLoginHandler") } if o.CustomersCreateHandler == nil { unregistered = append(unregistered, "customers.CreateHandler") } if o.CustomersGetIDHandler == nil { unregistered = append(unregistered, "customers.GetIDHandler") } if len(unregistered) > 0 { return fmt.Errorf("missing registration: %s", strings.Join(unregistered, ", ")) } return nil }
[ "func", "(", "o", "*", "OauthSampleAPI", ")", "Validate", "(", ")", "error", "{", "var", "unregistered", "[", "]", "string", "\n\n", "if", "o", ".", "JSONConsumer", "==", "nil", "{", "unregistered", "=", "append", "(", "unregistered", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "o", ".", "JSONProducer", "==", "nil", "{", "unregistered", "=", "append", "(", "unregistered", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "o", ".", "OauthSecurityAuth", "==", "nil", "{", "unregistered", "=", "append", "(", "unregistered", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "o", ".", "GetAuthCallbackHandler", "==", "nil", "{", "unregistered", "=", "append", "(", "unregistered", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "o", ".", "GetLoginHandler", "==", "nil", "{", "unregistered", "=", "append", "(", "unregistered", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "o", ".", "CustomersCreateHandler", "==", "nil", "{", "unregistered", "=", "append", "(", "unregistered", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "o", ".", "CustomersGetIDHandler", "==", "nil", "{", "unregistered", "=", "append", "(", "unregistered", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "len", "(", "unregistered", ")", ">", "0", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "strings", ".", "Join", "(", "unregistered", ",", "\"", "\"", ")", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
// Validate validates the registrations in the OauthSampleAPI
[ "Validate", "validates", "the", "registrations", "in", "the", "OauthSampleAPI" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/oauth2/restapi/operations/oauth_sample_api.go#L161-L197
train
go-swagger/go-swagger
examples/oauth2/restapi/operations/oauth_sample_api.go
Context
func (o *OauthSampleAPI) Context() *middleware.Context { if o.context == nil { o.context = middleware.NewRoutableContext(o.spec, o, nil) } return o.context }
go
func (o *OauthSampleAPI) Context() *middleware.Context { if o.context == nil { o.context = middleware.NewRoutableContext(o.spec, o, nil) } return o.context }
[ "func", "(", "o", "*", "OauthSampleAPI", ")", "Context", "(", ")", "*", "middleware", ".", "Context", "{", "if", "o", ".", "context", "==", "nil", "{", "o", ".", "context", "=", "middleware", ".", "NewRoutableContext", "(", "o", ".", "spec", ",", "o", ",", "nil", ")", "\n", "}", "\n\n", "return", "o", ".", "context", "\n", "}" ]
// Context returns the middleware context for the oauth sample API
[ "Context", "returns", "the", "middleware", "context", "for", "the", "oauth", "sample", "API" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/oauth2/restapi/operations/oauth_sample_api.go#L287-L293
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/list_tasks_parameters.go
NewListTasksParams
func NewListTasksParams() *ListTasksParams { var ( pageSizeDefault = int32(20) ) return &ListTasksParams{ PageSize: &pageSizeDefault, timeout: cr.DefaultTimeout, } }
go
func NewListTasksParams() *ListTasksParams { var ( pageSizeDefault = int32(20) ) return &ListTasksParams{ PageSize: &pageSizeDefault, timeout: cr.DefaultTimeout, } }
[ "func", "NewListTasksParams", "(", ")", "*", "ListTasksParams", "{", "var", "(", "pageSizeDefault", "=", "int32", "(", "20", ")", "\n", ")", "\n", "return", "&", "ListTasksParams", "{", "PageSize", ":", "&", "pageSizeDefault", ",", "timeout", ":", "cr", ".", "DefaultTimeout", ",", "}", "\n", "}" ]
// NewListTasksParams creates a new ListTasksParams object // with the default values initialized.
[ "NewListTasksParams", "creates", "a", "new", "ListTasksParams", "object", "with", "the", "default", "values", "initialized", "." ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/list_tasks_parameters.go#L23-L32
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/list_tasks_parameters.go
NewListTasksParamsWithTimeout
func NewListTasksParamsWithTimeout(timeout time.Duration) *ListTasksParams { var ( pageSizeDefault = int32(20) ) return &ListTasksParams{ PageSize: &pageSizeDefault, timeout: timeout, } }
go
func NewListTasksParamsWithTimeout(timeout time.Duration) *ListTasksParams { var ( pageSizeDefault = int32(20) ) return &ListTasksParams{ PageSize: &pageSizeDefault, timeout: timeout, } }
[ "func", "NewListTasksParamsWithTimeout", "(", "timeout", "time", ".", "Duration", ")", "*", "ListTasksParams", "{", "var", "(", "pageSizeDefault", "=", "int32", "(", "20", ")", "\n", ")", "\n", "return", "&", "ListTasksParams", "{", "PageSize", ":", "&", "pageSizeDefault", ",", "timeout", ":", "timeout", ",", "}", "\n", "}" ]
// NewListTasksParamsWithTimeout creates a new ListTasksParams object // with the default values initialized, and the ability to set a timeout on a request
[ "NewListTasksParamsWithTimeout", "creates", "a", "new", "ListTasksParams", "object", "with", "the", "default", "values", "initialized", "and", "the", "ability", "to", "set", "a", "timeout", "on", "a", "request" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/list_tasks_parameters.go#L36-L45
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/list_tasks_parameters.go
NewListTasksParamsWithContext
func NewListTasksParamsWithContext(ctx context.Context) *ListTasksParams { var ( pageSizeDefault = int32(20) ) return &ListTasksParams{ PageSize: &pageSizeDefault, Context: ctx, } }
go
func NewListTasksParamsWithContext(ctx context.Context) *ListTasksParams { var ( pageSizeDefault = int32(20) ) return &ListTasksParams{ PageSize: &pageSizeDefault, Context: ctx, } }
[ "func", "NewListTasksParamsWithContext", "(", "ctx", "context", ".", "Context", ")", "*", "ListTasksParams", "{", "var", "(", "pageSizeDefault", "=", "int32", "(", "20", ")", "\n", ")", "\n", "return", "&", "ListTasksParams", "{", "PageSize", ":", "&", "pageSizeDefault", ",", "Context", ":", "ctx", ",", "}", "\n", "}" ]
// NewListTasksParamsWithContext creates a new ListTasksParams object // with the default values initialized, and the ability to set a context for a request
[ "NewListTasksParamsWithContext", "creates", "a", "new", "ListTasksParams", "object", "with", "the", "default", "values", "initialized", "and", "the", "ability", "to", "set", "a", "context", "for", "a", "request" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/list_tasks_parameters.go#L49-L58
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/list_tasks_parameters.go
NewListTasksParamsWithHTTPClient
func NewListTasksParamsWithHTTPClient(client *http.Client) *ListTasksParams { var ( pageSizeDefault = int32(20) ) return &ListTasksParams{ PageSize: &pageSizeDefault, HTTPClient: client, } }
go
func NewListTasksParamsWithHTTPClient(client *http.Client) *ListTasksParams { var ( pageSizeDefault = int32(20) ) return &ListTasksParams{ PageSize: &pageSizeDefault, HTTPClient: client, } }
[ "func", "NewListTasksParamsWithHTTPClient", "(", "client", "*", "http", ".", "Client", ")", "*", "ListTasksParams", "{", "var", "(", "pageSizeDefault", "=", "int32", "(", "20", ")", "\n", ")", "\n", "return", "&", "ListTasksParams", "{", "PageSize", ":", "&", "pageSizeDefault", ",", "HTTPClient", ":", "client", ",", "}", "\n", "}" ]
// NewListTasksParamsWithHTTPClient creates a new ListTasksParams object // with the default values initialized, and the ability to set a custom HTTPClient for a request
[ "NewListTasksParamsWithHTTPClient", "creates", "a", "new", "ListTasksParams", "object", "with", "the", "default", "values", "initialized", "and", "the", "ability", "to", "set", "a", "custom", "HTTPClient", "for", "a", "request" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/list_tasks_parameters.go#L62-L70
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/list_tasks_parameters.go
WithTimeout
func (o *ListTasksParams) WithTimeout(timeout time.Duration) *ListTasksParams { o.SetTimeout(timeout) return o }
go
func (o *ListTasksParams) WithTimeout(timeout time.Duration) *ListTasksParams { o.SetTimeout(timeout) return o }
[ "func", "(", "o", "*", "ListTasksParams", ")", "WithTimeout", "(", "timeout", "time", ".", "Duration", ")", "*", "ListTasksParams", "{", "o", ".", "SetTimeout", "(", "timeout", ")", "\n", "return", "o", "\n", "}" ]
// WithTimeout adds the timeout to the list tasks params
[ "WithTimeout", "adds", "the", "timeout", "to", "the", "list", "tasks", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/list_tasks_parameters.go#L104-L107
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/list_tasks_parameters.go
WithContext
func (o *ListTasksParams) WithContext(ctx context.Context) *ListTasksParams { o.SetContext(ctx) return o }
go
func (o *ListTasksParams) WithContext(ctx context.Context) *ListTasksParams { o.SetContext(ctx) return o }
[ "func", "(", "o", "*", "ListTasksParams", ")", "WithContext", "(", "ctx", "context", ".", "Context", ")", "*", "ListTasksParams", "{", "o", ".", "SetContext", "(", "ctx", ")", "\n", "return", "o", "\n", "}" ]
// WithContext adds the context to the list tasks params
[ "WithContext", "adds", "the", "context", "to", "the", "list", "tasks", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/list_tasks_parameters.go#L115-L118
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/list_tasks_parameters.go
WithHTTPClient
func (o *ListTasksParams) WithHTTPClient(client *http.Client) *ListTasksParams { o.SetHTTPClient(client) return o }
go
func (o *ListTasksParams) WithHTTPClient(client *http.Client) *ListTasksParams { o.SetHTTPClient(client) return o }
[ "func", "(", "o", "*", "ListTasksParams", ")", "WithHTTPClient", "(", "client", "*", "http", ".", "Client", ")", "*", "ListTasksParams", "{", "o", ".", "SetHTTPClient", "(", "client", ")", "\n", "return", "o", "\n", "}" ]
// WithHTTPClient adds the HTTPClient to the list tasks params
[ "WithHTTPClient", "adds", "the", "HTTPClient", "to", "the", "list", "tasks", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/list_tasks_parameters.go#L126-L129
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/list_tasks_parameters.go
WithPageSize
func (o *ListTasksParams) WithPageSize(pageSize *int32) *ListTasksParams { o.SetPageSize(pageSize) return o }
go
func (o *ListTasksParams) WithPageSize(pageSize *int32) *ListTasksParams { o.SetPageSize(pageSize) return o }
[ "func", "(", "o", "*", "ListTasksParams", ")", "WithPageSize", "(", "pageSize", "*", "int32", ")", "*", "ListTasksParams", "{", "o", ".", "SetPageSize", "(", "pageSize", ")", "\n", "return", "o", "\n", "}" ]
// WithPageSize adds the pageSize to the list tasks params
[ "WithPageSize", "adds", "the", "pageSize", "to", "the", "list", "tasks", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/list_tasks_parameters.go#L137-L140
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/list_tasks_parameters.go
WithSinceID
func (o *ListTasksParams) WithSinceID(sinceID *int64) *ListTasksParams { o.SetSinceID(sinceID) return o }
go
func (o *ListTasksParams) WithSinceID(sinceID *int64) *ListTasksParams { o.SetSinceID(sinceID) return o }
[ "func", "(", "o", "*", "ListTasksParams", ")", "WithSinceID", "(", "sinceID", "*", "int64", ")", "*", "ListTasksParams", "{", "o", ".", "SetSinceID", "(", "sinceID", ")", "\n", "return", "o", "\n", "}" ]
// WithSinceID adds the sinceID to the list tasks params
[ "WithSinceID", "adds", "the", "sinceID", "to", "the", "list", "tasks", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/list_tasks_parameters.go#L148-L151
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/list_tasks_parameters.go
WithStatus
func (o *ListTasksParams) WithStatus(status []string) *ListTasksParams { o.SetStatus(status) return o }
go
func (o *ListTasksParams) WithStatus(status []string) *ListTasksParams { o.SetStatus(status) return o }
[ "func", "(", "o", "*", "ListTasksParams", ")", "WithStatus", "(", "status", "[", "]", "string", ")", "*", "ListTasksParams", "{", "o", ".", "SetStatus", "(", "status", ")", "\n", "return", "o", "\n", "}" ]
// WithStatus adds the status to the list tasks params
[ "WithStatus", "adds", "the", "status", "to", "the", "list", "tasks", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/list_tasks_parameters.go#L159-L162
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/list_tasks_parameters.go
WithTags
func (o *ListTasksParams) WithTags(tags []string) *ListTasksParams { o.SetTags(tags) return o }
go
func (o *ListTasksParams) WithTags(tags []string) *ListTasksParams { o.SetTags(tags) return o }
[ "func", "(", "o", "*", "ListTasksParams", ")", "WithTags", "(", "tags", "[", "]", "string", ")", "*", "ListTasksParams", "{", "o", ".", "SetTags", "(", "tags", ")", "\n", "return", "o", "\n", "}" ]
// WithTags adds the tags to the list tasks params
[ "WithTags", "adds", "the", "tags", "to", "the", "list", "tasks", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/list_tasks_parameters.go#L170-L173
train
go-swagger/go-swagger
examples/todo-list/client/todos/find_parameters.go
WithTimeout
func (o *FindParams) WithTimeout(timeout time.Duration) *FindParams { o.SetTimeout(timeout) return o }
go
func (o *FindParams) WithTimeout(timeout time.Duration) *FindParams { o.SetTimeout(timeout) return o }
[ "func", "(", "o", "*", "FindParams", ")", "WithTimeout", "(", "timeout", "time", ".", "Duration", ")", "*", "FindParams", "{", "o", ".", "SetTimeout", "(", "timeout", ")", "\n", "return", "o", "\n", "}" ]
// WithTimeout adds the timeout to the find params
[ "WithTimeout", "adds", "the", "timeout", "to", "the", "find", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/todo-list/client/todos/find_parameters.go#L78-L81
train
go-swagger/go-swagger
examples/todo-list/client/todos/find_parameters.go
WithContext
func (o *FindParams) WithContext(ctx context.Context) *FindParams { o.SetContext(ctx) return o }
go
func (o *FindParams) WithContext(ctx context.Context) *FindParams { o.SetContext(ctx) return o }
[ "func", "(", "o", "*", "FindParams", ")", "WithContext", "(", "ctx", "context", ".", "Context", ")", "*", "FindParams", "{", "o", ".", "SetContext", "(", "ctx", ")", "\n", "return", "o", "\n", "}" ]
// WithContext adds the context to the find params
[ "WithContext", "adds", "the", "context", "to", "the", "find", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/todo-list/client/todos/find_parameters.go#L89-L92
train
go-swagger/go-swagger
examples/todo-list/client/todos/find_parameters.go
WithHTTPClient
func (o *FindParams) WithHTTPClient(client *http.Client) *FindParams { o.SetHTTPClient(client) return o }
go
func (o *FindParams) WithHTTPClient(client *http.Client) *FindParams { o.SetHTTPClient(client) return o }
[ "func", "(", "o", "*", "FindParams", ")", "WithHTTPClient", "(", "client", "*", "http", ".", "Client", ")", "*", "FindParams", "{", "o", ".", "SetHTTPClient", "(", "client", ")", "\n", "return", "o", "\n", "}" ]
// WithHTTPClient adds the HTTPClient to the find params
[ "WithHTTPClient", "adds", "the", "HTTPClient", "to", "the", "find", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/todo-list/client/todos/find_parameters.go#L100-L103
train
go-swagger/go-swagger
examples/todo-list/client/todos/find_parameters.go
WithXRateLimit
func (o *FindParams) WithXRateLimit(xRateLimit int32) *FindParams { o.SetXRateLimit(xRateLimit) return o }
go
func (o *FindParams) WithXRateLimit(xRateLimit int32) *FindParams { o.SetXRateLimit(xRateLimit) return o }
[ "func", "(", "o", "*", "FindParams", ")", "WithXRateLimit", "(", "xRateLimit", "int32", ")", "*", "FindParams", "{", "o", ".", "SetXRateLimit", "(", "xRateLimit", ")", "\n", "return", "o", "\n", "}" ]
// WithXRateLimit adds the xRateLimit to the find params
[ "WithXRateLimit", "adds", "the", "xRateLimit", "to", "the", "find", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/todo-list/client/todos/find_parameters.go#L111-L114
train
go-swagger/go-swagger
examples/todo-list/client/todos/find_parameters.go
WithLimit
func (o *FindParams) WithLimit(limit int32) *FindParams { o.SetLimit(limit) return o }
go
func (o *FindParams) WithLimit(limit int32) *FindParams { o.SetLimit(limit) return o }
[ "func", "(", "o", "*", "FindParams", ")", "WithLimit", "(", "limit", "int32", ")", "*", "FindParams", "{", "o", ".", "SetLimit", "(", "limit", ")", "\n", "return", "o", "\n", "}" ]
// WithLimit adds the limit to the find params
[ "WithLimit", "adds", "the", "limit", "to", "the", "find", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/todo-list/client/todos/find_parameters.go#L122-L125
train
go-swagger/go-swagger
examples/todo-list/client/todos/find_parameters.go
WithTags
func (o *FindParams) WithTags(tags []int32) *FindParams { o.SetTags(tags) return o }
go
func (o *FindParams) WithTags(tags []int32) *FindParams { o.SetTags(tags) return o }
[ "func", "(", "o", "*", "FindParams", ")", "WithTags", "(", "tags", "[", "]", "int32", ")", "*", "FindParams", "{", "o", ".", "SetTags", "(", "tags", ")", "\n", "return", "o", "\n", "}" ]
// WithTags adds the tags to the find params
[ "WithTags", "adds", "the", "tags", "to", "the", "find", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/todo-list/client/todos/find_parameters.go#L133-L136
train
go-swagger/go-swagger
examples/composed-auth/restapi/operations/get_account_responses.go
WithStatusCode
func (o *GetAccountDefault) WithStatusCode(code int) *GetAccountDefault { o._statusCode = code return o }
go
func (o *GetAccountDefault) WithStatusCode(code int) *GetAccountDefault { o._statusCode = code return o }
[ "func", "(", "o", "*", "GetAccountDefault", ")", "WithStatusCode", "(", "code", "int", ")", "*", "GetAccountDefault", "{", "o", ".", "_statusCode", "=", "code", "\n", "return", "o", "\n", "}" ]
// WithStatusCode adds the status to the get account default response
[ "WithStatusCode", "adds", "the", "status", "to", "the", "get", "account", "default", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/composed-auth/restapi/operations/get_account_responses.go#L107-L110
train
go-swagger/go-swagger
examples/composed-auth/restapi/operations/get_account_responses.go
WithPayload
func (o *GetAccountDefault) WithPayload(payload *models.Error) *GetAccountDefault { o.Payload = payload return o }
go
func (o *GetAccountDefault) WithPayload(payload *models.Error) *GetAccountDefault { o.Payload = payload return o }
[ "func", "(", "o", "*", "GetAccountDefault", ")", "WithPayload", "(", "payload", "*", "models", ".", "Error", ")", "*", "GetAccountDefault", "{", "o", ".", "Payload", "=", "payload", "\n", "return", "o", "\n", "}" ]
// WithPayload adds the payload to the get account default response
[ "WithPayload", "adds", "the", "payload", "to", "the", "get", "account", "default", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/composed-auth/restapi/operations/get_account_responses.go#L118-L121
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/get_task_comments_parameters.go
NewGetTaskCommentsParams
func NewGetTaskCommentsParams() *GetTaskCommentsParams { var ( pageSizeDefault = int32(20) ) return &GetTaskCommentsParams{ PageSize: &pageSizeDefault, timeout: cr.DefaultTimeout, } }
go
func NewGetTaskCommentsParams() *GetTaskCommentsParams { var ( pageSizeDefault = int32(20) ) return &GetTaskCommentsParams{ PageSize: &pageSizeDefault, timeout: cr.DefaultTimeout, } }
[ "func", "NewGetTaskCommentsParams", "(", ")", "*", "GetTaskCommentsParams", "{", "var", "(", "pageSizeDefault", "=", "int32", "(", "20", ")", "\n", ")", "\n", "return", "&", "GetTaskCommentsParams", "{", "PageSize", ":", "&", "pageSizeDefault", ",", "timeout", ":", "cr", ".", "DefaultTimeout", ",", "}", "\n", "}" ]
// NewGetTaskCommentsParams creates a new GetTaskCommentsParams object // with the default values initialized.
[ "NewGetTaskCommentsParams", "creates", "a", "new", "GetTaskCommentsParams", "object", "with", "the", "default", "values", "initialized", "." ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/get_task_comments_parameters.go#L23-L32
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/get_task_comments_parameters.go
NewGetTaskCommentsParamsWithTimeout
func NewGetTaskCommentsParamsWithTimeout(timeout time.Duration) *GetTaskCommentsParams { var ( pageSizeDefault = int32(20) ) return &GetTaskCommentsParams{ PageSize: &pageSizeDefault, timeout: timeout, } }
go
func NewGetTaskCommentsParamsWithTimeout(timeout time.Duration) *GetTaskCommentsParams { var ( pageSizeDefault = int32(20) ) return &GetTaskCommentsParams{ PageSize: &pageSizeDefault, timeout: timeout, } }
[ "func", "NewGetTaskCommentsParamsWithTimeout", "(", "timeout", "time", ".", "Duration", ")", "*", "GetTaskCommentsParams", "{", "var", "(", "pageSizeDefault", "=", "int32", "(", "20", ")", "\n", ")", "\n", "return", "&", "GetTaskCommentsParams", "{", "PageSize", ":", "&", "pageSizeDefault", ",", "timeout", ":", "timeout", ",", "}", "\n", "}" ]
// NewGetTaskCommentsParamsWithTimeout creates a new GetTaskCommentsParams object // with the default values initialized, and the ability to set a timeout on a request
[ "NewGetTaskCommentsParamsWithTimeout", "creates", "a", "new", "GetTaskCommentsParams", "object", "with", "the", "default", "values", "initialized", "and", "the", "ability", "to", "set", "a", "timeout", "on", "a", "request" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/get_task_comments_parameters.go#L36-L45
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/get_task_comments_parameters.go
NewGetTaskCommentsParamsWithContext
func NewGetTaskCommentsParamsWithContext(ctx context.Context) *GetTaskCommentsParams { var ( pageSizeDefault = int32(20) ) return &GetTaskCommentsParams{ PageSize: &pageSizeDefault, Context: ctx, } }
go
func NewGetTaskCommentsParamsWithContext(ctx context.Context) *GetTaskCommentsParams { var ( pageSizeDefault = int32(20) ) return &GetTaskCommentsParams{ PageSize: &pageSizeDefault, Context: ctx, } }
[ "func", "NewGetTaskCommentsParamsWithContext", "(", "ctx", "context", ".", "Context", ")", "*", "GetTaskCommentsParams", "{", "var", "(", "pageSizeDefault", "=", "int32", "(", "20", ")", "\n", ")", "\n", "return", "&", "GetTaskCommentsParams", "{", "PageSize", ":", "&", "pageSizeDefault", ",", "Context", ":", "ctx", ",", "}", "\n", "}" ]
// NewGetTaskCommentsParamsWithContext creates a new GetTaskCommentsParams object // with the default values initialized, and the ability to set a context for a request
[ "NewGetTaskCommentsParamsWithContext", "creates", "a", "new", "GetTaskCommentsParams", "object", "with", "the", "default", "values", "initialized", "and", "the", "ability", "to", "set", "a", "context", "for", "a", "request" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/get_task_comments_parameters.go#L49-L58
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/get_task_comments_parameters.go
NewGetTaskCommentsParamsWithHTTPClient
func NewGetTaskCommentsParamsWithHTTPClient(client *http.Client) *GetTaskCommentsParams { var ( pageSizeDefault = int32(20) ) return &GetTaskCommentsParams{ PageSize: &pageSizeDefault, HTTPClient: client, } }
go
func NewGetTaskCommentsParamsWithHTTPClient(client *http.Client) *GetTaskCommentsParams { var ( pageSizeDefault = int32(20) ) return &GetTaskCommentsParams{ PageSize: &pageSizeDefault, HTTPClient: client, } }
[ "func", "NewGetTaskCommentsParamsWithHTTPClient", "(", "client", "*", "http", ".", "Client", ")", "*", "GetTaskCommentsParams", "{", "var", "(", "pageSizeDefault", "=", "int32", "(", "20", ")", "\n", ")", "\n", "return", "&", "GetTaskCommentsParams", "{", "PageSize", ":", "&", "pageSizeDefault", ",", "HTTPClient", ":", "client", ",", "}", "\n", "}" ]
// NewGetTaskCommentsParamsWithHTTPClient creates a new GetTaskCommentsParams object // with the default values initialized, and the ability to set a custom HTTPClient for a request
[ "NewGetTaskCommentsParamsWithHTTPClient", "creates", "a", "new", "GetTaskCommentsParams", "object", "with", "the", "default", "values", "initialized", "and", "the", "ability", "to", "set", "a", "custom", "HTTPClient", "for", "a", "request" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/get_task_comments_parameters.go#L62-L70
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/get_task_comments_parameters.go
WithTimeout
func (o *GetTaskCommentsParams) WithTimeout(timeout time.Duration) *GetTaskCommentsParams { o.SetTimeout(timeout) return o }
go
func (o *GetTaskCommentsParams) WithTimeout(timeout time.Duration) *GetTaskCommentsParams { o.SetTimeout(timeout) return o }
[ "func", "(", "o", "*", "GetTaskCommentsParams", ")", "WithTimeout", "(", "timeout", "time", ".", "Duration", ")", "*", "GetTaskCommentsParams", "{", "o", ".", "SetTimeout", "(", "timeout", ")", "\n", "return", "o", "\n", "}" ]
// WithTimeout adds the timeout to the get task comments params
[ "WithTimeout", "adds", "the", "timeout", "to", "the", "get", "task", "comments", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/get_task_comments_parameters.go#L99-L102
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/get_task_comments_parameters.go
WithContext
func (o *GetTaskCommentsParams) WithContext(ctx context.Context) *GetTaskCommentsParams { o.SetContext(ctx) return o }
go
func (o *GetTaskCommentsParams) WithContext(ctx context.Context) *GetTaskCommentsParams { o.SetContext(ctx) return o }
[ "func", "(", "o", "*", "GetTaskCommentsParams", ")", "WithContext", "(", "ctx", "context", ".", "Context", ")", "*", "GetTaskCommentsParams", "{", "o", ".", "SetContext", "(", "ctx", ")", "\n", "return", "o", "\n", "}" ]
// WithContext adds the context to the get task comments params
[ "WithContext", "adds", "the", "context", "to", "the", "get", "task", "comments", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/get_task_comments_parameters.go#L110-L113
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/get_task_comments_parameters.go
WithHTTPClient
func (o *GetTaskCommentsParams) WithHTTPClient(client *http.Client) *GetTaskCommentsParams { o.SetHTTPClient(client) return o }
go
func (o *GetTaskCommentsParams) WithHTTPClient(client *http.Client) *GetTaskCommentsParams { o.SetHTTPClient(client) return o }
[ "func", "(", "o", "*", "GetTaskCommentsParams", ")", "WithHTTPClient", "(", "client", "*", "http", ".", "Client", ")", "*", "GetTaskCommentsParams", "{", "o", ".", "SetHTTPClient", "(", "client", ")", "\n", "return", "o", "\n", "}" ]
// WithHTTPClient adds the HTTPClient to the get task comments params
[ "WithHTTPClient", "adds", "the", "HTTPClient", "to", "the", "get", "task", "comments", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/get_task_comments_parameters.go#L121-L124
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/get_task_comments_parameters.go
WithID
func (o *GetTaskCommentsParams) WithID(id int64) *GetTaskCommentsParams { o.SetID(id) return o }
go
func (o *GetTaskCommentsParams) WithID(id int64) *GetTaskCommentsParams { o.SetID(id) return o }
[ "func", "(", "o", "*", "GetTaskCommentsParams", ")", "WithID", "(", "id", "int64", ")", "*", "GetTaskCommentsParams", "{", "o", ".", "SetID", "(", "id", ")", "\n", "return", "o", "\n", "}" ]
// WithID adds the id to the get task comments params
[ "WithID", "adds", "the", "id", "to", "the", "get", "task", "comments", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/get_task_comments_parameters.go#L132-L135
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/get_task_comments_parameters.go
WithPageSize
func (o *GetTaskCommentsParams) WithPageSize(pageSize *int32) *GetTaskCommentsParams { o.SetPageSize(pageSize) return o }
go
func (o *GetTaskCommentsParams) WithPageSize(pageSize *int32) *GetTaskCommentsParams { o.SetPageSize(pageSize) return o }
[ "func", "(", "o", "*", "GetTaskCommentsParams", ")", "WithPageSize", "(", "pageSize", "*", "int32", ")", "*", "GetTaskCommentsParams", "{", "o", ".", "SetPageSize", "(", "pageSize", ")", "\n", "return", "o", "\n", "}" ]
// WithPageSize adds the pageSize to the get task comments params
[ "WithPageSize", "adds", "the", "pageSize", "to", "the", "get", "task", "comments", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/get_task_comments_parameters.go#L143-L146
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/get_task_comments_parameters.go
WithSince
func (o *GetTaskCommentsParams) WithSince(since *strfmt.DateTime) *GetTaskCommentsParams { o.SetSince(since) return o }
go
func (o *GetTaskCommentsParams) WithSince(since *strfmt.DateTime) *GetTaskCommentsParams { o.SetSince(since) return o }
[ "func", "(", "o", "*", "GetTaskCommentsParams", ")", "WithSince", "(", "since", "*", "strfmt", ".", "DateTime", ")", "*", "GetTaskCommentsParams", "{", "o", ".", "SetSince", "(", "since", ")", "\n", "return", "o", "\n", "}" ]
// WithSince adds the since to the get task comments params
[ "WithSince", "adds", "the", "since", "to", "the", "get", "task", "comments", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/get_task_comments_parameters.go#L154-L157
train
go-swagger/go-swagger
examples/task-tracker/restapi/operations/tasks/add_comment_to_task_responses.go
WithStatusCode
func (o *AddCommentToTaskDefault) WithStatusCode(code int) *AddCommentToTaskDefault { o._statusCode = code return o }
go
func (o *AddCommentToTaskDefault) WithStatusCode(code int) *AddCommentToTaskDefault { o._statusCode = code return o }
[ "func", "(", "o", "*", "AddCommentToTaskDefault", ")", "WithStatusCode", "(", "code", "int", ")", "*", "AddCommentToTaskDefault", "{", "o", ".", "_statusCode", "=", "code", "\n", "return", "o", "\n", "}" ]
// WithStatusCode adds the status to the add comment to task default response
[ "WithStatusCode", "adds", "the", "status", "to", "the", "add", "comment", "to", "task", "default", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/add_comment_to_task_responses.go#L69-L72
train
go-swagger/go-swagger
examples/task-tracker/restapi/operations/tasks/add_comment_to_task_responses.go
WithXErrorCode
func (o *AddCommentToTaskDefault) WithXErrorCode(xErrorCode string) *AddCommentToTaskDefault { o.XErrorCode = xErrorCode return o }
go
func (o *AddCommentToTaskDefault) WithXErrorCode(xErrorCode string) *AddCommentToTaskDefault { o.XErrorCode = xErrorCode return o }
[ "func", "(", "o", "*", "AddCommentToTaskDefault", ")", "WithXErrorCode", "(", "xErrorCode", "string", ")", "*", "AddCommentToTaskDefault", "{", "o", ".", "XErrorCode", "=", "xErrorCode", "\n", "return", "o", "\n", "}" ]
// WithXErrorCode adds the xErrorCode to the add comment to task default response
[ "WithXErrorCode", "adds", "the", "xErrorCode", "to", "the", "add", "comment", "to", "task", "default", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/add_comment_to_task_responses.go#L80-L83
train
go-swagger/go-swagger
examples/task-tracker/restapi/operations/tasks/add_comment_to_task_responses.go
WithPayload
func (o *AddCommentToTaskDefault) WithPayload(payload *models.Error) *AddCommentToTaskDefault { o.Payload = payload return o }
go
func (o *AddCommentToTaskDefault) WithPayload(payload *models.Error) *AddCommentToTaskDefault { o.Payload = payload return o }
[ "func", "(", "o", "*", "AddCommentToTaskDefault", ")", "WithPayload", "(", "payload", "*", "models", ".", "Error", ")", "*", "AddCommentToTaskDefault", "{", "o", ".", "Payload", "=", "payload", "\n", "return", "o", "\n", "}" ]
// WithPayload adds the payload to the add comment to task default response
[ "WithPayload", "adds", "the", "payload", "to", "the", "add", "comment", "to", "task", "default", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/add_comment_to_task_responses.go#L91-L94
train
go-swagger/go-swagger
examples/task-tracker/restapi/operations/tasks/get_task_comments.go
NewGetTaskComments
func NewGetTaskComments(ctx *middleware.Context, handler GetTaskCommentsHandler) *GetTaskComments { return &GetTaskComments{Context: ctx, Handler: handler} }
go
func NewGetTaskComments(ctx *middleware.Context, handler GetTaskCommentsHandler) *GetTaskComments { return &GetTaskComments{Context: ctx, Handler: handler} }
[ "func", "NewGetTaskComments", "(", "ctx", "*", "middleware", ".", "Context", ",", "handler", "GetTaskCommentsHandler", ")", "*", "GetTaskComments", "{", "return", "&", "GetTaskComments", "{", "Context", ":", "ctx", ",", "Handler", ":", "handler", "}", "\n", "}" ]
// NewGetTaskComments creates a new http.Handler for the get task comments operation
[ "NewGetTaskComments", "creates", "a", "new", "http", ".", "Handler", "for", "the", "get", "task", "comments", "operation" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/get_task_comments.go#L28-L30
train
go-swagger/go-swagger
examples/generated/restapi/operations/store/get_order_by_id_responses.go
WithPayload
func (o *GetOrderByIDOK) WithPayload(payload *models.Order) *GetOrderByIDOK { o.Payload = payload return o }
go
func (o *GetOrderByIDOK) WithPayload(payload *models.Order) *GetOrderByIDOK { o.Payload = payload return o }
[ "func", "(", "o", "*", "GetOrderByIDOK", ")", "WithPayload", "(", "payload", "*", "models", ".", "Order", ")", "*", "GetOrderByIDOK", "{", "o", ".", "Payload", "=", "payload", "\n", "return", "o", "\n", "}" ]
// WithPayload adds the payload to the get order by Id o k response
[ "WithPayload", "adds", "the", "payload", "to", "the", "get", "order", "by", "Id", "o", "k", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/generated/restapi/operations/store/get_order_by_id_responses.go#L38-L41
train
go-swagger/go-swagger
examples/generated/restapi/operations/store/place_order.go
NewPlaceOrder
func NewPlaceOrder(ctx *middleware.Context, handler PlaceOrderHandler) *PlaceOrder { return &PlaceOrder{Context: ctx, Handler: handler} }
go
func NewPlaceOrder(ctx *middleware.Context, handler PlaceOrderHandler) *PlaceOrder { return &PlaceOrder{Context: ctx, Handler: handler} }
[ "func", "NewPlaceOrder", "(", "ctx", "*", "middleware", ".", "Context", ",", "handler", "PlaceOrderHandler", ")", "*", "PlaceOrder", "{", "return", "&", "PlaceOrder", "{", "Context", ":", "ctx", ",", "Handler", ":", "handler", "}", "\n", "}" ]
// NewPlaceOrder creates a new http.Handler for the place order operation
[ "NewPlaceOrder", "creates", "a", "new", "http", ".", "Handler", "for", "the", "place", "order", "operation" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/generated/restapi/operations/store/place_order.go#L28-L30
train
go-swagger/go-swagger
cmd/swagger/commands/generate/shared.go
SetFlattenOptions
func (f *FlattenCmdOptions) SetFlattenOptions(dflt *analysis.FlattenOpts) (res *analysis.FlattenOpts) { res = &analysis.FlattenOpts{} if dflt != nil { *res = *dflt } if f == nil { return } verboseIsSet := false minimalIsSet := false //removeUnusedIsSet := false expandIsSet := false if f.WithExpand { res.Expand = true expandIsSet = true } for _, opt := range f.WithFlatten { if opt == "verbose" { res.Verbose = true verboseIsSet = true } if opt == "noverbose" && !verboseIsSet { // verbose flag takes precedence res.Verbose = false verboseIsSet = true } if opt == "remove-unused" { res.RemoveUnused = true //removeUnusedIsSet = true } if opt == "expand" { res.Expand = true expandIsSet = true } if opt == "full" && !minimalIsSet && !expandIsSet { // minimal flag takes precedence res.Minimal = false minimalIsSet = true } if opt == "minimal" && !expandIsSet { // expand flag takes precedence res.Minimal = true minimalIsSet = true } } return }
go
func (f *FlattenCmdOptions) SetFlattenOptions(dflt *analysis.FlattenOpts) (res *analysis.FlattenOpts) { res = &analysis.FlattenOpts{} if dflt != nil { *res = *dflt } if f == nil { return } verboseIsSet := false minimalIsSet := false //removeUnusedIsSet := false expandIsSet := false if f.WithExpand { res.Expand = true expandIsSet = true } for _, opt := range f.WithFlatten { if opt == "verbose" { res.Verbose = true verboseIsSet = true } if opt == "noverbose" && !verboseIsSet { // verbose flag takes precedence res.Verbose = false verboseIsSet = true } if opt == "remove-unused" { res.RemoveUnused = true //removeUnusedIsSet = true } if opt == "expand" { res.Expand = true expandIsSet = true } if opt == "full" && !minimalIsSet && !expandIsSet { // minimal flag takes precedence res.Minimal = false minimalIsSet = true } if opt == "minimal" && !expandIsSet { // expand flag takes precedence res.Minimal = true minimalIsSet = true } } return }
[ "func", "(", "f", "*", "FlattenCmdOptions", ")", "SetFlattenOptions", "(", "dflt", "*", "analysis", ".", "FlattenOpts", ")", "(", "res", "*", "analysis", ".", "FlattenOpts", ")", "{", "res", "=", "&", "analysis", ".", "FlattenOpts", "{", "}", "\n", "if", "dflt", "!=", "nil", "{", "*", "res", "=", "*", "dflt", "\n", "}", "\n", "if", "f", "==", "nil", "{", "return", "\n", "}", "\n", "verboseIsSet", ":=", "false", "\n", "minimalIsSet", ":=", "false", "\n", "//removeUnusedIsSet := false", "expandIsSet", ":=", "false", "\n", "if", "f", ".", "WithExpand", "{", "res", ".", "Expand", "=", "true", "\n", "expandIsSet", "=", "true", "\n", "}", "\n", "for", "_", ",", "opt", ":=", "range", "f", ".", "WithFlatten", "{", "if", "opt", "==", "\"", "\"", "{", "res", ".", "Verbose", "=", "true", "\n", "verboseIsSet", "=", "true", "\n", "}", "\n", "if", "opt", "==", "\"", "\"", "&&", "!", "verboseIsSet", "{", "// verbose flag takes precedence", "res", ".", "Verbose", "=", "false", "\n", "verboseIsSet", "=", "true", "\n", "}", "\n", "if", "opt", "==", "\"", "\"", "{", "res", ".", "RemoveUnused", "=", "true", "\n", "//removeUnusedIsSet = true", "}", "\n", "if", "opt", "==", "\"", "\"", "{", "res", ".", "Expand", "=", "true", "\n", "expandIsSet", "=", "true", "\n", "}", "\n", "if", "opt", "==", "\"", "\"", "&&", "!", "minimalIsSet", "&&", "!", "expandIsSet", "{", "// minimal flag takes precedence", "res", ".", "Minimal", "=", "false", "\n", "minimalIsSet", "=", "true", "\n", "}", "\n", "if", "opt", "==", "\"", "\"", "&&", "!", "expandIsSet", "{", "// expand flag takes precedence", "res", ".", "Minimal", "=", "true", "\n", "minimalIsSet", "=", "true", "\n", "}", "\n", "}", "\n", "return", "\n", "}" ]
// SetFlattenOptions builds flatten options from command line args
[ "SetFlattenOptions", "builds", "flatten", "options", "from", "command", "line", "args" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/cmd/swagger/commands/generate/shared.go#L23-L69
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/restapi/operations/pet/pet_list.go
NewPetList
func NewPetList(ctx *middleware.Context, handler PetListHandler) *PetList { return &PetList{Context: ctx, Handler: handler} }
go
func NewPetList(ctx *middleware.Context, handler PetListHandler) *PetList { return &PetList{Context: ctx, Handler: handler} }
[ "func", "NewPetList", "(", "ctx", "*", "middleware", ".", "Context", ",", "handler", "PetListHandler", ")", "*", "PetList", "{", "return", "&", "PetList", "{", "Context", ":", "ctx", ",", "Handler", ":", "handler", "}", "\n", "}" ]
// NewPetList creates a new http.Handler for the pet list operation
[ "NewPetList", "creates", "a", "new", "http", ".", "Handler", "for", "the", "pet", "list", "operation" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/restapi/operations/pet/pet_list.go#L28-L30
train
go-swagger/go-swagger
examples/composed-auth/restapi/operations/get_orders_for_item_parameters.go
bindItemID
func (o *GetOrdersForItemParams) bindItemID(rawData []string, hasKey bool, formats strfmt.Registry) error { var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: true // Parameter is provided by construction from the route o.ItemID = raw return nil }
go
func (o *GetOrdersForItemParams) bindItemID(rawData []string, hasKey bool, formats strfmt.Registry) error { var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] } // Required: true // Parameter is provided by construction from the route o.ItemID = raw return nil }
[ "func", "(", "o", "*", "GetOrdersForItemParams", ")", "bindItemID", "(", "rawData", "[", "]", "string", ",", "hasKey", "bool", ",", "formats", "strfmt", ".", "Registry", ")", "error", "{", "var", "raw", "string", "\n", "if", "len", "(", "rawData", ")", ">", "0", "{", "raw", "=", "rawData", "[", "len", "(", "rawData", ")", "-", "1", "]", "\n", "}", "\n\n", "// Required: true", "// Parameter is provided by construction from the route", "o", ".", "ItemID", "=", "raw", "\n\n", "return", "nil", "\n", "}" ]
// bindItemID binds and validates parameter ItemID from path.
[ "bindItemID", "binds", "and", "validates", "parameter", "ItemID", "from", "path", "." ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/composed-auth/restapi/operations/get_orders_for_item_parameters.go#L61-L73
train
go-swagger/go-swagger
cmd/swagger/commands/mixin.go
MixinFiles
func (c *MixinSpec) MixinFiles(primaryFile string, mixinFiles []string, w io.Writer) ([]string, error) { primaryDoc, err := loads.Spec(primaryFile) if err != nil { return nil, err } primary := primaryDoc.Spec() var mixins []*spec.Swagger for _, mixinFile := range mixinFiles { mixin, lerr := loads.Spec(mixinFile) if lerr != nil { return nil, lerr } mixins = append(mixins, mixin.Spec()) } collisions := analysis.Mixin(primary, mixins...) analysis.FixEmptyResponseDescriptions(primary) return collisions, writeToFile(primary, !c.Compact, c.Format, string(c.Output)) }
go
func (c *MixinSpec) MixinFiles(primaryFile string, mixinFiles []string, w io.Writer) ([]string, error) { primaryDoc, err := loads.Spec(primaryFile) if err != nil { return nil, err } primary := primaryDoc.Spec() var mixins []*spec.Swagger for _, mixinFile := range mixinFiles { mixin, lerr := loads.Spec(mixinFile) if lerr != nil { return nil, lerr } mixins = append(mixins, mixin.Spec()) } collisions := analysis.Mixin(primary, mixins...) analysis.FixEmptyResponseDescriptions(primary) return collisions, writeToFile(primary, !c.Compact, c.Format, string(c.Output)) }
[ "func", "(", "c", "*", "MixinSpec", ")", "MixinFiles", "(", "primaryFile", "string", ",", "mixinFiles", "[", "]", "string", ",", "w", "io", ".", "Writer", ")", "(", "[", "]", "string", ",", "error", ")", "{", "primaryDoc", ",", "err", ":=", "loads", ".", "Spec", "(", "primaryFile", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "primary", ":=", "primaryDoc", ".", "Spec", "(", ")", "\n\n", "var", "mixins", "[", "]", "*", "spec", ".", "Swagger", "\n", "for", "_", ",", "mixinFile", ":=", "range", "mixinFiles", "{", "mixin", ",", "lerr", ":=", "loads", ".", "Spec", "(", "mixinFile", ")", "\n", "if", "lerr", "!=", "nil", "{", "return", "nil", ",", "lerr", "\n", "}", "\n", "mixins", "=", "append", "(", "mixins", ",", "mixin", ".", "Spec", "(", ")", ")", "\n", "}", "\n\n", "collisions", ":=", "analysis", ".", "Mixin", "(", "primary", ",", "mixins", "...", ")", "\n", "analysis", ".", "FixEmptyResponseDescriptions", "(", "primary", ")", "\n\n", "return", "collisions", ",", "writeToFile", "(", "primary", ",", "!", "c", ".", "Compact", ",", "c", ".", "Format", ",", "string", "(", "c", ".", "Output", ")", ")", "\n", "}" ]
// MixinFiles is a convenience function for Mixin that reads the given // swagger files, adds the mixins to primary, calls // FixEmptyResponseDescriptions on the primary, and writes the primary // with mixins to the given writer in JSON. Returns the warning // messages for collisions that occurred during mixin process and any // error.
[ "MixinFiles", "is", "a", "convenience", "function", "for", "Mixin", "that", "reads", "the", "given", "swagger", "files", "adds", "the", "mixins", "to", "primary", "calls", "FixEmptyResponseDescriptions", "on", "the", "primary", "and", "writes", "the", "primary", "with", "mixins", "to", "the", "given", "writer", "in", "JSON", ".", "Returns", "the", "warning", "messages", "for", "collisions", "that", "occurred", "during", "mixin", "process", "and", "any", "error", "." ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/cmd/swagger/commands/mixin.go#L82-L103
train
go-swagger/go-swagger
examples/generated/restapi/operations/pet/delete_pet.go
NewDeletePet
func NewDeletePet(ctx *middleware.Context, handler DeletePetHandler) *DeletePet { return &DeletePet{Context: ctx, Handler: handler} }
go
func NewDeletePet(ctx *middleware.Context, handler DeletePetHandler) *DeletePet { return &DeletePet{Context: ctx, Handler: handler} }
[ "func", "NewDeletePet", "(", "ctx", "*", "middleware", ".", "Context", ",", "handler", "DeletePetHandler", ")", "*", "DeletePet", "{", "return", "&", "DeletePet", "{", "Context", ":", "ctx", ",", "Handler", ":", "handler", "}", "\n", "}" ]
// NewDeletePet creates a new http.Handler for the delete pet operation
[ "NewDeletePet", "creates", "a", "new", "http", ".", "Handler", "for", "the", "delete", "pet", "operation" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/generated/restapi/operations/pet/delete_pet.go#L28-L30
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/upload_task_file_parameters.go
WithTimeout
func (o *UploadTaskFileParams) WithTimeout(timeout time.Duration) *UploadTaskFileParams { o.SetTimeout(timeout) return o }
go
func (o *UploadTaskFileParams) WithTimeout(timeout time.Duration) *UploadTaskFileParams { o.SetTimeout(timeout) return o }
[ "func", "(", "o", "*", "UploadTaskFileParams", ")", "WithTimeout", "(", "timeout", "time", ".", "Duration", ")", "*", "UploadTaskFileParams", "{", "o", ".", "SetTimeout", "(", "timeout", ")", "\n", "return", "o", "\n", "}" ]
// WithTimeout adds the timeout to the upload task file params
[ "WithTimeout", "adds", "the", "timeout", "to", "the", "upload", "task", "file", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/upload_task_file_parameters.go#L87-L90
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/upload_task_file_parameters.go
WithContext
func (o *UploadTaskFileParams) WithContext(ctx context.Context) *UploadTaskFileParams { o.SetContext(ctx) return o }
go
func (o *UploadTaskFileParams) WithContext(ctx context.Context) *UploadTaskFileParams { o.SetContext(ctx) return o }
[ "func", "(", "o", "*", "UploadTaskFileParams", ")", "WithContext", "(", "ctx", "context", ".", "Context", ")", "*", "UploadTaskFileParams", "{", "o", ".", "SetContext", "(", "ctx", ")", "\n", "return", "o", "\n", "}" ]
// WithContext adds the context to the upload task file params
[ "WithContext", "adds", "the", "context", "to", "the", "upload", "task", "file", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/upload_task_file_parameters.go#L98-L101
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/upload_task_file_parameters.go
WithHTTPClient
func (o *UploadTaskFileParams) WithHTTPClient(client *http.Client) *UploadTaskFileParams { o.SetHTTPClient(client) return o }
go
func (o *UploadTaskFileParams) WithHTTPClient(client *http.Client) *UploadTaskFileParams { o.SetHTTPClient(client) return o }
[ "func", "(", "o", "*", "UploadTaskFileParams", ")", "WithHTTPClient", "(", "client", "*", "http", ".", "Client", ")", "*", "UploadTaskFileParams", "{", "o", ".", "SetHTTPClient", "(", "client", ")", "\n", "return", "o", "\n", "}" ]
// WithHTTPClient adds the HTTPClient to the upload task file params
[ "WithHTTPClient", "adds", "the", "HTTPClient", "to", "the", "upload", "task", "file", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/upload_task_file_parameters.go#L109-L112
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/upload_task_file_parameters.go
WithDescription
func (o *UploadTaskFileParams) WithDescription(description *string) *UploadTaskFileParams { o.SetDescription(description) return o }
go
func (o *UploadTaskFileParams) WithDescription(description *string) *UploadTaskFileParams { o.SetDescription(description) return o }
[ "func", "(", "o", "*", "UploadTaskFileParams", ")", "WithDescription", "(", "description", "*", "string", ")", "*", "UploadTaskFileParams", "{", "o", ".", "SetDescription", "(", "description", ")", "\n", "return", "o", "\n", "}" ]
// WithDescription adds the description to the upload task file params
[ "WithDescription", "adds", "the", "description", "to", "the", "upload", "task", "file", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/upload_task_file_parameters.go#L120-L123
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/upload_task_file_parameters.go
WithFile
func (o *UploadTaskFileParams) WithFile(file runtime.NamedReadCloser) *UploadTaskFileParams { o.SetFile(file) return o }
go
func (o *UploadTaskFileParams) WithFile(file runtime.NamedReadCloser) *UploadTaskFileParams { o.SetFile(file) return o }
[ "func", "(", "o", "*", "UploadTaskFileParams", ")", "WithFile", "(", "file", "runtime", ".", "NamedReadCloser", ")", "*", "UploadTaskFileParams", "{", "o", ".", "SetFile", "(", "file", ")", "\n", "return", "o", "\n", "}" ]
// WithFile adds the file to the upload task file params
[ "WithFile", "adds", "the", "file", "to", "the", "upload", "task", "file", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/upload_task_file_parameters.go#L131-L134
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/upload_task_file_parameters.go
WithID
func (o *UploadTaskFileParams) WithID(id int64) *UploadTaskFileParams { o.SetID(id) return o }
go
func (o *UploadTaskFileParams) WithID(id int64) *UploadTaskFileParams { o.SetID(id) return o }
[ "func", "(", "o", "*", "UploadTaskFileParams", ")", "WithID", "(", "id", "int64", ")", "*", "UploadTaskFileParams", "{", "o", ".", "SetID", "(", "id", ")", "\n", "return", "o", "\n", "}" ]
// WithID adds the id to the upload task file params
[ "WithID", "adds", "the", "id", "to", "the", "upload", "task", "file", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/upload_task_file_parameters.go#L142-L145
train
go-swagger/go-swagger
examples/generated/restapi/operations/user/get_user_by_name.go
NewGetUserByName
func NewGetUserByName(ctx *middleware.Context, handler GetUserByNameHandler) *GetUserByName { return &GetUserByName{Context: ctx, Handler: handler} }
go
func NewGetUserByName(ctx *middleware.Context, handler GetUserByNameHandler) *GetUserByName { return &GetUserByName{Context: ctx, Handler: handler} }
[ "func", "NewGetUserByName", "(", "ctx", "*", "middleware", ".", "Context", ",", "handler", "GetUserByNameHandler", ")", "*", "GetUserByName", "{", "return", "&", "GetUserByName", "{", "Context", ":", "ctx", ",", "Handler", ":", "handler", "}", "\n", "}" ]
// NewGetUserByName creates a new http.Handler for the get user by name operation
[ "NewGetUserByName", "creates", "a", "new", "http", ".", "Handler", "for", "the", "get", "user", "by", "name", "operation" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/generated/restapi/operations/user/get_user_by_name.go#L28-L30
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/restapi/operations/store/order_get.go
NewOrderGet
func NewOrderGet(ctx *middleware.Context, handler OrderGetHandler) *OrderGet { return &OrderGet{Context: ctx, Handler: handler} }
go
func NewOrderGet(ctx *middleware.Context, handler OrderGetHandler) *OrderGet { return &OrderGet{Context: ctx, Handler: handler} }
[ "func", "NewOrderGet", "(", "ctx", "*", "middleware", ".", "Context", ",", "handler", "OrderGetHandler", ")", "*", "OrderGet", "{", "return", "&", "OrderGet", "{", "Context", ":", "ctx", ",", "Handler", ":", "handler", "}", "\n", "}" ]
// NewOrderGet creates a new http.Handler for the order get operation
[ "NewOrderGet", "creates", "a", "new", "http", ".", "Handler", "for", "the", "order", "get", "operation" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/restapi/operations/store/order_get.go#L28-L30
train
go-swagger/go-swagger
examples/task-tracker/restapi/operations/tasks/add_comment_to_task.go
NewAddCommentToTask
func NewAddCommentToTask(ctx *middleware.Context, handler AddCommentToTaskHandler) *AddCommentToTask { return &AddCommentToTask{Context: ctx, Handler: handler} }
go
func NewAddCommentToTask(ctx *middleware.Context, handler AddCommentToTaskHandler) *AddCommentToTask { return &AddCommentToTask{Context: ctx, Handler: handler} }
[ "func", "NewAddCommentToTask", "(", "ctx", "*", "middleware", ".", "Context", ",", "handler", "AddCommentToTaskHandler", ")", "*", "AddCommentToTask", "{", "return", "&", "AddCommentToTask", "{", "Context", ":", "ctx", ",", "Handler", ":", "handler", "}", "\n", "}" ]
// NewAddCommentToTask creates a new http.Handler for the add comment to task operation
[ "NewAddCommentToTask", "creates", "a", "new", "http", ".", "Handler", "for", "the", "add", "comment", "to", "task", "operation" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/add_comment_to_task.go#L32-L34
train
go-swagger/go-swagger
examples/stream-server/models/mark.go
Validate
func (m *Mark) Validate(formats strfmt.Registry) error { var res []error if err := m.validateRemains(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
go
func (m *Mark) Validate(formats strfmt.Registry) error { var res []error if err := m.validateRemains(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
[ "func", "(", "m", "*", "Mark", ")", "Validate", "(", "formats", "strfmt", ".", "Registry", ")", "error", "{", "var", "res", "[", "]", "error", "\n\n", "if", "err", ":=", "m", ".", "validateRemains", "(", "formats", ")", ";", "err", "!=", "nil", "{", "res", "=", "append", "(", "res", ",", "err", ")", "\n", "}", "\n\n", "if", "len", "(", "res", ")", ">", "0", "{", "return", "errors", ".", "CompositeValidationError", "(", "res", "...", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// Validate validates this mark
[ "Validate", "validates", "this", "mark" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/stream-server/models/mark.go#L26-L37
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/get_task_details_parameters.go
WithTimeout
func (o *GetTaskDetailsParams) WithTimeout(timeout time.Duration) *GetTaskDetailsParams { o.SetTimeout(timeout) return o }
go
func (o *GetTaskDetailsParams) WithTimeout(timeout time.Duration) *GetTaskDetailsParams { o.SetTimeout(timeout) return o }
[ "func", "(", "o", "*", "GetTaskDetailsParams", ")", "WithTimeout", "(", "timeout", "time", ".", "Duration", ")", "*", "GetTaskDetailsParams", "{", "o", ".", "SetTimeout", "(", "timeout", ")", "\n", "return", "o", "\n", "}" ]
// WithTimeout adds the timeout to the get task details params
[ "WithTimeout", "adds", "the", "timeout", "to", "the", "get", "task", "details", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/get_task_details_parameters.go#L77-L80
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/get_task_details_parameters.go
WithContext
func (o *GetTaskDetailsParams) WithContext(ctx context.Context) *GetTaskDetailsParams { o.SetContext(ctx) return o }
go
func (o *GetTaskDetailsParams) WithContext(ctx context.Context) *GetTaskDetailsParams { o.SetContext(ctx) return o }
[ "func", "(", "o", "*", "GetTaskDetailsParams", ")", "WithContext", "(", "ctx", "context", ".", "Context", ")", "*", "GetTaskDetailsParams", "{", "o", ".", "SetContext", "(", "ctx", ")", "\n", "return", "o", "\n", "}" ]
// WithContext adds the context to the get task details params
[ "WithContext", "adds", "the", "context", "to", "the", "get", "task", "details", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/get_task_details_parameters.go#L88-L91
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/get_task_details_parameters.go
WithHTTPClient
func (o *GetTaskDetailsParams) WithHTTPClient(client *http.Client) *GetTaskDetailsParams { o.SetHTTPClient(client) return o }
go
func (o *GetTaskDetailsParams) WithHTTPClient(client *http.Client) *GetTaskDetailsParams { o.SetHTTPClient(client) return o }
[ "func", "(", "o", "*", "GetTaskDetailsParams", ")", "WithHTTPClient", "(", "client", "*", "http", ".", "Client", ")", "*", "GetTaskDetailsParams", "{", "o", ".", "SetHTTPClient", "(", "client", ")", "\n", "return", "o", "\n", "}" ]
// WithHTTPClient adds the HTTPClient to the get task details params
[ "WithHTTPClient", "adds", "the", "HTTPClient", "to", "the", "get", "task", "details", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/get_task_details_parameters.go#L99-L102
train
go-swagger/go-swagger
examples/task-tracker/client/tasks/get_task_details_parameters.go
WithID
func (o *GetTaskDetailsParams) WithID(id int64) *GetTaskDetailsParams { o.SetID(id) return o }
go
func (o *GetTaskDetailsParams) WithID(id int64) *GetTaskDetailsParams { o.SetID(id) return o }
[ "func", "(", "o", "*", "GetTaskDetailsParams", ")", "WithID", "(", "id", "int64", ")", "*", "GetTaskDetailsParams", "{", "o", ".", "SetID", "(", "id", ")", "\n", "return", "o", "\n", "}" ]
// WithID adds the id to the get task details params
[ "WithID", "adds", "the", "id", "to", "the", "get", "task", "details", "params" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/client/tasks/get_task_details_parameters.go#L110-L113
train
go-swagger/go-swagger
examples/tutorials/custom-server/gen/restapi/operations/greeter_api.go
NewGreeterAPI
func NewGreeterAPI(spec *loads.Document) *GreeterAPI { return &GreeterAPI{ handlers: make(map[string]map[string]http.Handler), formats: strfmt.Default, defaultConsumes: "application/json", defaultProduces: "application/json", customConsumers: make(map[string]runtime.Consumer), customProducers: make(map[string]runtime.Producer), ServerShutdown: func() {}, spec: spec, ServeError: errors.ServeError, BasicAuthenticator: security.BasicAuth, APIKeyAuthenticator: security.APIKeyAuth, BearerAuthenticator: security.BearerAuth, JSONConsumer: runtime.JSONConsumer(), TxtProducer: runtime.TextProducer(), GetGreetingHandler: GetGreetingHandlerFunc(func(params GetGreetingParams) middleware.Responder { return middleware.NotImplemented("operation GetGreeting has not yet been implemented") }), } }
go
func NewGreeterAPI(spec *loads.Document) *GreeterAPI { return &GreeterAPI{ handlers: make(map[string]map[string]http.Handler), formats: strfmt.Default, defaultConsumes: "application/json", defaultProduces: "application/json", customConsumers: make(map[string]runtime.Consumer), customProducers: make(map[string]runtime.Producer), ServerShutdown: func() {}, spec: spec, ServeError: errors.ServeError, BasicAuthenticator: security.BasicAuth, APIKeyAuthenticator: security.APIKeyAuth, BearerAuthenticator: security.BearerAuth, JSONConsumer: runtime.JSONConsumer(), TxtProducer: runtime.TextProducer(), GetGreetingHandler: GetGreetingHandlerFunc(func(params GetGreetingParams) middleware.Responder { return middleware.NotImplemented("operation GetGreeting has not yet been implemented") }), } }
[ "func", "NewGreeterAPI", "(", "spec", "*", "loads", ".", "Document", ")", "*", "GreeterAPI", "{", "return", "&", "GreeterAPI", "{", "handlers", ":", "make", "(", "map", "[", "string", "]", "map", "[", "string", "]", "http", ".", "Handler", ")", ",", "formats", ":", "strfmt", ".", "Default", ",", "defaultConsumes", ":", "\"", "\"", ",", "defaultProduces", ":", "\"", "\"", ",", "customConsumers", ":", "make", "(", "map", "[", "string", "]", "runtime", ".", "Consumer", ")", ",", "customProducers", ":", "make", "(", "map", "[", "string", "]", "runtime", ".", "Producer", ")", ",", "ServerShutdown", ":", "func", "(", ")", "{", "}", ",", "spec", ":", "spec", ",", "ServeError", ":", "errors", ".", "ServeError", ",", "BasicAuthenticator", ":", "security", ".", "BasicAuth", ",", "APIKeyAuthenticator", ":", "security", ".", "APIKeyAuth", ",", "BearerAuthenticator", ":", "security", ".", "BearerAuth", ",", "JSONConsumer", ":", "runtime", ".", "JSONConsumer", "(", ")", ",", "TxtProducer", ":", "runtime", ".", "TextProducer", "(", ")", ",", "GetGreetingHandler", ":", "GetGreetingHandlerFunc", "(", "func", "(", "params", "GetGreetingParams", ")", "middleware", ".", "Responder", "{", "return", "middleware", ".", "NotImplemented", "(", "\"", "\"", ")", "\n", "}", ")", ",", "}", "\n", "}" ]
// NewGreeterAPI creates a new Greeter instance
[ "NewGreeterAPI", "creates", "a", "new", "Greeter", "instance" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/tutorials/custom-server/gen/restapi/operations/greeter_api.go#L24-L44
train
go-swagger/go-swagger
examples/tutorials/custom-server/gen/restapi/operations/greeter_api.go
Validate
func (o *GreeterAPI) Validate() error { var unregistered []string if o.JSONConsumer == nil { unregistered = append(unregistered, "JSONConsumer") } if o.TxtProducer == nil { unregistered = append(unregistered, "TxtProducer") } if o.GetGreetingHandler == nil { unregistered = append(unregistered, "GetGreetingHandler") } if len(unregistered) > 0 { return fmt.Errorf("missing registration: %s", strings.Join(unregistered, ", ")) } return nil }
go
func (o *GreeterAPI) Validate() error { var unregistered []string if o.JSONConsumer == nil { unregistered = append(unregistered, "JSONConsumer") } if o.TxtProducer == nil { unregistered = append(unregistered, "TxtProducer") } if o.GetGreetingHandler == nil { unregistered = append(unregistered, "GetGreetingHandler") } if len(unregistered) > 0 { return fmt.Errorf("missing registration: %s", strings.Join(unregistered, ", ")) } return nil }
[ "func", "(", "o", "*", "GreeterAPI", ")", "Validate", "(", ")", "error", "{", "var", "unregistered", "[", "]", "string", "\n\n", "if", "o", ".", "JSONConsumer", "==", "nil", "{", "unregistered", "=", "append", "(", "unregistered", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "o", ".", "TxtProducer", "==", "nil", "{", "unregistered", "=", "append", "(", "unregistered", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "o", ".", "GetGreetingHandler", "==", "nil", "{", "unregistered", "=", "append", "(", "unregistered", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "len", "(", "unregistered", ")", ">", "0", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "strings", ".", "Join", "(", "unregistered", ",", "\"", "\"", ")", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
// Validate validates the registrations in the GreeterAPI
[ "Validate", "validates", "the", "registrations", "in", "the", "GreeterAPI" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/tutorials/custom-server/gen/restapi/operations/greeter_api.go#L128-L148
train
go-swagger/go-swagger
examples/tutorials/custom-server/gen/restapi/operations/greeter_api.go
Context
func (o *GreeterAPI) Context() *middleware.Context { if o.context == nil { o.context = middleware.NewRoutableContext(o.spec, o, nil) } return o.context }
go
func (o *GreeterAPI) Context() *middleware.Context { if o.context == nil { o.context = middleware.NewRoutableContext(o.spec, o, nil) } return o.context }
[ "func", "(", "o", "*", "GreeterAPI", ")", "Context", "(", ")", "*", "middleware", ".", "Context", "{", "if", "o", ".", "context", "==", "nil", "{", "o", ".", "context", "=", "middleware", ".", "NewRoutableContext", "(", "o", ".", "spec", ",", "o", ",", "nil", ")", "\n", "}", "\n\n", "return", "o", ".", "context", "\n", "}" ]
// Context returns the middleware context for the greeter API
[ "Context", "returns", "the", "middleware", "context", "for", "the", "greeter", "API" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/tutorials/custom-server/gen/restapi/operations/greeter_api.go#L226-L232
train
go-swagger/go-swagger
examples/tutorials/custom-server/gen/restapi/operations/get_greeting_responses.go
WithPayload
func (o *GetGreetingOK) WithPayload(payload string) *GetGreetingOK { o.Payload = payload return o }
go
func (o *GetGreetingOK) WithPayload(payload string) *GetGreetingOK { o.Payload = payload return o }
[ "func", "(", "o", "*", "GetGreetingOK", ")", "WithPayload", "(", "payload", "string", ")", "*", "GetGreetingOK", "{", "o", ".", "Payload", "=", "payload", "\n", "return", "o", "\n", "}" ]
// WithPayload adds the payload to the get greeting o k response
[ "WithPayload", "adds", "the", "payload", "to", "the", "get", "greeting", "o", "k", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/tutorials/custom-server/gen/restapi/operations/get_greeting_responses.go#L36-L39
train
go-swagger/go-swagger
examples/generated/restapi/operations/user/get_user_by_name_responses.go
WithPayload
func (o *GetUserByNameOK) WithPayload(payload *models.User) *GetUserByNameOK { o.Payload = payload return o }
go
func (o *GetUserByNameOK) WithPayload(payload *models.User) *GetUserByNameOK { o.Payload = payload return o }
[ "func", "(", "o", "*", "GetUserByNameOK", ")", "WithPayload", "(", "payload", "*", "models", ".", "User", ")", "*", "GetUserByNameOK", "{", "o", ".", "Payload", "=", "payload", "\n", "return", "o", "\n", "}" ]
// WithPayload adds the payload to the get user by name o k response
[ "WithPayload", "adds", "the", "payload", "to", "the", "get", "user", "by", "name", "o", "k", "response" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/generated/restapi/operations/user/get_user_by_name_responses.go#L38-L41
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/restapi/configure_petstore.go
Handler
func Handler(c Config) (http.Handler, error) { h, _, err := HandlerAPI(c) return h, err }
go
func Handler(c Config) (http.Handler, error) { h, _, err := HandlerAPI(c) return h, err }
[ "func", "Handler", "(", "c", "Config", ")", "(", "http", ".", "Handler", ",", "error", ")", "{", "h", ",", "_", ",", "err", ":=", "HandlerAPI", "(", "c", ")", "\n", "return", "h", ",", "err", "\n", "}" ]
// Handler returns an http.Handler given the handler configuration // It mounts all the business logic implementers in the right routing.
[ "Handler", "returns", "an", "http", ".", "Handler", "given", "the", "handler", "configuration", "It", "mounts", "all", "the", "business", "logic", "implementers", "in", "the", "right", "routing", "." ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/restapi/configure_petstore.go#L68-L71
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/restapi/configure_petstore.go
swaggerCopy
func swaggerCopy(orig json.RawMessage) json.RawMessage { c := make(json.RawMessage, len(orig)) copy(c, orig) return c }
go
func swaggerCopy(orig json.RawMessage) json.RawMessage { c := make(json.RawMessage, len(orig)) copy(c, orig) return c }
[ "func", "swaggerCopy", "(", "orig", "json", ".", "RawMessage", ")", "json", ".", "RawMessage", "{", "c", ":=", "make", "(", "json", ".", "RawMessage", ",", "len", "(", "orig", ")", ")", "\n", "copy", "(", "c", ",", "orig", ")", "\n", "return", "c", "\n", "}" ]
// swaggerCopy copies the swagger json to prevent data races in runtime
[ "swaggerCopy", "copies", "the", "swagger", "json", "to", "prevent", "data", "races", "in", "runtime" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/restapi/configure_petstore.go#L150-L154
train
go-swagger/go-swagger
examples/contributed-templates/stratoscale/restapi/operations/store/order_create.go
NewOrderCreate
func NewOrderCreate(ctx *middleware.Context, handler OrderCreateHandler) *OrderCreate { return &OrderCreate{Context: ctx, Handler: handler} }
go
func NewOrderCreate(ctx *middleware.Context, handler OrderCreateHandler) *OrderCreate { return &OrderCreate{Context: ctx, Handler: handler} }
[ "func", "NewOrderCreate", "(", "ctx", "*", "middleware", ".", "Context", ",", "handler", "OrderCreateHandler", ")", "*", "OrderCreate", "{", "return", "&", "OrderCreate", "{", "Context", ":", "ctx", ",", "Handler", ":", "handler", "}", "\n", "}" ]
// NewOrderCreate creates a new http.Handler for the order create operation
[ "NewOrderCreate", "creates", "a", "new", "http", ".", "Handler", "for", "the", "order", "create", "operation" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/contributed-templates/stratoscale/restapi/operations/store/order_create.go#L28-L30
train
go-swagger/go-swagger
examples/task-tracker/restapi/operations/tasks/delete_task.go
NewDeleteTask
func NewDeleteTask(ctx *middleware.Context, handler DeleteTaskHandler) *DeleteTask { return &DeleteTask{Context: ctx, Handler: handler} }
go
func NewDeleteTask(ctx *middleware.Context, handler DeleteTaskHandler) *DeleteTask { return &DeleteTask{Context: ctx, Handler: handler} }
[ "func", "NewDeleteTask", "(", "ctx", "*", "middleware", ".", "Context", ",", "handler", "DeleteTaskHandler", ")", "*", "DeleteTask", "{", "return", "&", "DeleteTask", "{", "Context", ":", "ctx", ",", "Handler", ":", "handler", "}", "\n", "}" ]
// NewDeleteTask creates a new http.Handler for the delete task operation
[ "NewDeleteTask", "creates", "a", "new", "http", ".", "Handler", "for", "the", "delete", "task", "operation" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/task-tracker/restapi/operations/tasks/delete_task.go#L28-L30
train
go-swagger/go-swagger
examples/authentication/client/auth_sample_client.go
New
func New(transport runtime.ClientTransport, formats strfmt.Registry) *AuthSample { // ensure nullable parameters have default if formats == nil { formats = strfmt.Default } cli := new(AuthSample) cli.Transport = transport cli.Customers = customers.New(transport, formats) return cli }
go
func New(transport runtime.ClientTransport, formats strfmt.Registry) *AuthSample { // ensure nullable parameters have default if formats == nil { formats = strfmt.Default } cli := new(AuthSample) cli.Transport = transport cli.Customers = customers.New(transport, formats) return cli }
[ "func", "New", "(", "transport", "runtime", ".", "ClientTransport", ",", "formats", "strfmt", ".", "Registry", ")", "*", "AuthSample", "{", "// ensure nullable parameters have default", "if", "formats", "==", "nil", "{", "formats", "=", "strfmt", ".", "Default", "\n", "}", "\n\n", "cli", ":=", "new", "(", "AuthSample", ")", "\n", "cli", ".", "Transport", "=", "transport", "\n\n", "cli", ".", "Customers", "=", "customers", ".", "New", "(", "transport", ",", "formats", ")", "\n\n", "return", "cli", "\n", "}" ]
// New creates a new auth sample client
[ "New", "creates", "a", "new", "auth", "sample", "client" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/examples/authentication/client/auth_sample_client.go#L51-L63
train
go-swagger/go-swagger
generator/support.go
GenerateServer
func GenerateServer(name string, modelNames, operationIDs []string, opts *GenOpts) error { generator, err := newAppGenerator(name, modelNames, operationIDs, opts) if err != nil { return err } return generator.Generate() }
go
func GenerateServer(name string, modelNames, operationIDs []string, opts *GenOpts) error { generator, err := newAppGenerator(name, modelNames, operationIDs, opts) if err != nil { return err } return generator.Generate() }
[ "func", "GenerateServer", "(", "name", "string", ",", "modelNames", ",", "operationIDs", "[", "]", "string", ",", "opts", "*", "GenOpts", ")", "error", "{", "generator", ",", "err", ":=", "newAppGenerator", "(", "name", ",", "modelNames", ",", "operationIDs", ",", "opts", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "generator", ".", "Generate", "(", ")", "\n", "}" ]
// GenerateServer generates a server application
[ "GenerateServer", "generates", "a", "server", "application" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/generator/support.go#L39-L45
train
go-swagger/go-swagger
generator/support.go
GenerateSupport
func GenerateSupport(name string, modelNames, operationIDs []string, opts *GenOpts) error { generator, err := newAppGenerator(name, modelNames, operationIDs, opts) if err != nil { return err } return generator.GenerateSupport(nil) }
go
func GenerateSupport(name string, modelNames, operationIDs []string, opts *GenOpts) error { generator, err := newAppGenerator(name, modelNames, operationIDs, opts) if err != nil { return err } return generator.GenerateSupport(nil) }
[ "func", "GenerateSupport", "(", "name", "string", ",", "modelNames", ",", "operationIDs", "[", "]", "string", ",", "opts", "*", "GenOpts", ")", "error", "{", "generator", ",", "err", ":=", "newAppGenerator", "(", "name", ",", "modelNames", ",", "operationIDs", ",", "opts", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "generator", ".", "GenerateSupport", "(", "nil", ")", "\n", "}" ]
// GenerateSupport generates the supporting files for an API
[ "GenerateSupport", "generates", "the", "supporting", "files", "for", "an", "API" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/generator/support.go#L48-L54
train
go-swagger/go-swagger
generator/support.go
checkPrefixAndFetchRelativePath
func checkPrefixAndFetchRelativePath(childpath string, parentpath string) (bool, string) { // Windows (local) file systems - NTFS, as well as FAT and variants // are case insensitive. cp, pp := childpath, parentpath if goruntime.GOOS == "windows" { cp = strings.ToLower(cp) pp = strings.ToLower(pp) } if strings.HasPrefix(cp, pp) { pth, err := filepath.Rel(parentpath, childpath) if err != nil { log.Fatalln(err) } return true, pth } return false, "" }
go
func checkPrefixAndFetchRelativePath(childpath string, parentpath string) (bool, string) { // Windows (local) file systems - NTFS, as well as FAT and variants // are case insensitive. cp, pp := childpath, parentpath if goruntime.GOOS == "windows" { cp = strings.ToLower(cp) pp = strings.ToLower(pp) } if strings.HasPrefix(cp, pp) { pth, err := filepath.Rel(parentpath, childpath) if err != nil { log.Fatalln(err) } return true, pth } return false, "" }
[ "func", "checkPrefixAndFetchRelativePath", "(", "childpath", "string", ",", "parentpath", "string", ")", "(", "bool", ",", "string", ")", "{", "// Windows (local) file systems - NTFS, as well as FAT and variants", "// are case insensitive.", "cp", ",", "pp", ":=", "childpath", ",", "parentpath", "\n", "if", "goruntime", ".", "GOOS", "==", "\"", "\"", "{", "cp", "=", "strings", ".", "ToLower", "(", "cp", ")", "\n", "pp", "=", "strings", ".", "ToLower", "(", "pp", ")", "\n", "}", "\n\n", "if", "strings", ".", "HasPrefix", "(", "cp", ",", "pp", ")", "{", "pth", ",", "err", ":=", "filepath", ".", "Rel", "(", "parentpath", ",", "childpath", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Fatalln", "(", "err", ")", "\n", "}", "\n", "return", "true", ",", "pth", "\n", "}", "\n\n", "return", "false", ",", "\"", "\"", "\n\n", "}" ]
// 1. Checks if the child path and parent path coincide. // 2. If they do return child path relative to parent path. // 3. Everything else return false
[ "1", ".", "Checks", "if", "the", "child", "path", "and", "parent", "path", "coincide", ".", "2", ".", "If", "they", "do", "return", "child", "path", "relative", "to", "parent", "path", ".", "3", ".", "Everything", "else", "return", "false" ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/generator/support.go#L177-L196
train
go-swagger/go-swagger
generator/support.go
generateReadableSpec
func generateReadableSpec(spec []byte) string { buf := &bytes.Buffer{} for _, b := range string(spec) { if b == '`' { buf.WriteString("`+\"`\"+`") } else { buf.WriteRune(b) } } return buf.String() }
go
func generateReadableSpec(spec []byte) string { buf := &bytes.Buffer{} for _, b := range string(spec) { if b == '`' { buf.WriteString("`+\"`\"+`") } else { buf.WriteRune(b) } } return buf.String() }
[ "func", "generateReadableSpec", "(", "spec", "[", "]", "byte", ")", "string", "{", "buf", ":=", "&", "bytes", ".", "Buffer", "{", "}", "\n", "for", "_", ",", "b", ":=", "range", "string", "(", "spec", ")", "{", "if", "b", "==", "'`'", "{", "buf", ".", "WriteString", "(", "\"", "\\\"", "\\\"", "\"", ")", "\n", "}", "else", "{", "buf", ".", "WriteRune", "(", "b", ")", "\n", "}", "\n", "}", "\n", "return", "buf", ".", "String", "(", ")", "\n", "}" ]
// generateReadableSpec makes swagger json spec as a string instead of bytes // the only character that needs to be escaped is '`' symbol, since it cannot be escaped in the GO string // that is quoted as `string data`. The function doesn't care about the beginning or the ending of the // string it escapes since all data that needs to be escaped is always in the middle of the swagger spec.
[ "generateReadableSpec", "makes", "swagger", "json", "spec", "as", "a", "string", "instead", "of", "bytes", "the", "only", "character", "that", "needs", "to", "be", "escaped", "is", "symbol", "since", "it", "cannot", "be", "escaped", "in", "the", "GO", "string", "that", "is", "quoted", "as", "string", "data", ".", "The", "function", "doesn", "t", "care", "about", "the", "beginning", "or", "the", "ending", "of", "the", "string", "it", "escapes", "since", "all", "data", "that", "needs", "to", "be", "escaped", "is", "always", "in", "the", "middle", "of", "the", "swagger", "spec", "." ]
ffefbd274717d6fa3bcca1c494487edf1f48104b
https://github.com/go-swagger/go-swagger/blob/ffefbd274717d6fa3bcca1c494487edf1f48104b/generator/support.go#L745-L755
train
gizak/termui
buffer.go
NewCell
func NewCell(rune rune, args ...interface{}) Cell { style := StyleClear if len(args) == 1 { style = args[0].(Style) } return Cell{ Rune: rune, Style: style, } }
go
func NewCell(rune rune, args ...interface{}) Cell { style := StyleClear if len(args) == 1 { style = args[0].(Style) } return Cell{ Rune: rune, Style: style, } }
[ "func", "NewCell", "(", "rune", "rune", ",", "args", "...", "interface", "{", "}", ")", "Cell", "{", "style", ":=", "StyleClear", "\n", "if", "len", "(", "args", ")", "==", "1", "{", "style", "=", "args", "[", "0", "]", ".", "(", "Style", ")", "\n", "}", "\n", "return", "Cell", "{", "Rune", ":", "rune", ",", "Style", ":", "style", ",", "}", "\n", "}" ]
// NewCell takes 1 to 2 arguments // 1st argument = rune // 2nd argument = optional style
[ "NewCell", "takes", "1", "to", "2", "arguments", "1st", "argument", "=", "rune", "2nd", "argument", "=", "optional", "style" ]
213738dbc71cff7412f8dae6d9f27ce4c379dc38
https://github.com/gizak/termui/blob/213738dbc71cff7412f8dae6d9f27ce4c379dc38/buffer.go#L27-L36
train
gizak/termui
widgets/list.go
ScrollAmount
func (self *List) ScrollAmount(amount int) { if len(self.Rows)-int(self.SelectedRow) <= amount { self.SelectedRow = len(self.Rows) - 1 } else if int(self.SelectedRow)+amount < 0 { self.SelectedRow = 0 } else { self.SelectedRow += amount } }
go
func (self *List) ScrollAmount(amount int) { if len(self.Rows)-int(self.SelectedRow) <= amount { self.SelectedRow = len(self.Rows) - 1 } else if int(self.SelectedRow)+amount < 0 { self.SelectedRow = 0 } else { self.SelectedRow += amount } }
[ "func", "(", "self", "*", "List", ")", "ScrollAmount", "(", "amount", "int", ")", "{", "if", "len", "(", "self", ".", "Rows", ")", "-", "int", "(", "self", ".", "SelectedRow", ")", "<=", "amount", "{", "self", ".", "SelectedRow", "=", "len", "(", "self", ".", "Rows", ")", "-", "1", "\n", "}", "else", "if", "int", "(", "self", ".", "SelectedRow", ")", "+", "amount", "<", "0", "{", "self", ".", "SelectedRow", "=", "0", "\n", "}", "else", "{", "self", ".", "SelectedRow", "+=", "amount", "\n", "}", "\n", "}" ]
// ScrollAmount scrolls by amount given. If amount is < 0, then scroll up. // There is no need to set self.topRow, as this will be set automatically when drawn, // since if the selected item is off screen then the topRow variable will change accordingly.
[ "ScrollAmount", "scrolls", "by", "amount", "given", ".", "If", "amount", "is", "<", "0", "then", "scroll", "up", ".", "There", "is", "no", "need", "to", "set", "self", ".", "topRow", "as", "this", "will", "be", "set", "automatically", "when", "drawn", "since", "if", "the", "selected", "item", "is", "off", "screen", "then", "the", "topRow", "variable", "will", "change", "accordingly", "." ]
213738dbc71cff7412f8dae6d9f27ce4c379dc38
https://github.com/gizak/termui/blob/213738dbc71cff7412f8dae6d9f27ce4c379dc38/widgets/list.go#L91-L99
train
gizak/termui
widgets/sparkline.go
NewSparkline
func NewSparkline() *Sparkline { return &Sparkline{ TitleStyle: Theme.Sparkline.Title, LineColor: Theme.Sparkline.Line, } }
go
func NewSparkline() *Sparkline { return &Sparkline{ TitleStyle: Theme.Sparkline.Title, LineColor: Theme.Sparkline.Line, } }
[ "func", "NewSparkline", "(", ")", "*", "Sparkline", "{", "return", "&", "Sparkline", "{", "TitleStyle", ":", "Theme", ".", "Sparkline", ".", "Title", ",", "LineColor", ":", "Theme", ".", "Sparkline", ".", "Line", ",", "}", "\n", "}" ]
// NewSparkline returns a unrenderable single sparkline that needs to be added to a SparklineGroup
[ "NewSparkline", "returns", "a", "unrenderable", "single", "sparkline", "that", "needs", "to", "be", "added", "to", "a", "SparklineGroup" ]
213738dbc71cff7412f8dae6d9f27ce4c379dc38
https://github.com/gizak/termui/blob/213738dbc71cff7412f8dae6d9f27ce4c379dc38/widgets/sparkline.go#L30-L35
train
gizak/termui
grid.go
NewCol
func NewCol(ratio float64, i ...interface{}) GridItem { _, ok := i[0].(Drawable) entry := i[0] if !ok { entry = i } return GridItem{ Type: col, Entry: entry, IsLeaf: ok, ratio: ratio, } }
go
func NewCol(ratio float64, i ...interface{}) GridItem { _, ok := i[0].(Drawable) entry := i[0] if !ok { entry = i } return GridItem{ Type: col, Entry: entry, IsLeaf: ok, ratio: ratio, } }
[ "func", "NewCol", "(", "ratio", "float64", ",", "i", "...", "interface", "{", "}", ")", "GridItem", "{", "_", ",", "ok", ":=", "i", "[", "0", "]", ".", "(", "Drawable", ")", "\n", "entry", ":=", "i", "[", "0", "]", "\n", "if", "!", "ok", "{", "entry", "=", "i", "\n", "}", "\n", "return", "GridItem", "{", "Type", ":", "col", ",", "Entry", ":", "entry", ",", "IsLeaf", ":", "ok", ",", "ratio", ":", "ratio", ",", "}", "\n", "}" ]
// NewCol takes a height percentage and either a widget or a Row or Column
[ "NewCol", "takes", "a", "height", "percentage", "and", "either", "a", "widget", "or", "a", "Row", "or", "Column" ]
213738dbc71cff7412f8dae6d9f27ce4c379dc38
https://github.com/gizak/termui/blob/213738dbc71cff7412f8dae6d9f27ce4c379dc38/grid.go#L41-L53
train
gizak/termui
grid.go
NewRow
func NewRow(ratio float64, i ...interface{}) GridItem { _, ok := i[0].(Drawable) entry := i[0] if !ok { entry = i } return GridItem{ Type: row, Entry: entry, IsLeaf: ok, ratio: ratio, } }
go
func NewRow(ratio float64, i ...interface{}) GridItem { _, ok := i[0].(Drawable) entry := i[0] if !ok { entry = i } return GridItem{ Type: row, Entry: entry, IsLeaf: ok, ratio: ratio, } }
[ "func", "NewRow", "(", "ratio", "float64", ",", "i", "...", "interface", "{", "}", ")", "GridItem", "{", "_", ",", "ok", ":=", "i", "[", "0", "]", ".", "(", "Drawable", ")", "\n", "entry", ":=", "i", "[", "0", "]", "\n", "if", "!", "ok", "{", "entry", "=", "i", "\n", "}", "\n", "return", "GridItem", "{", "Type", ":", "row", ",", "Entry", ":", "entry", ",", "IsLeaf", ":", "ok", ",", "ratio", ":", "ratio", ",", "}", "\n", "}" ]
// NewRow takes a width percentage and either a widget or a Row or Column
[ "NewRow", "takes", "a", "width", "percentage", "and", "either", "a", "widget", "or", "a", "Row", "or", "Column" ]
213738dbc71cff7412f8dae6d9f27ce4c379dc38
https://github.com/gizak/termui/blob/213738dbc71cff7412f8dae6d9f27ce4c379dc38/grid.go#L56-L68
train
gizak/termui
grid.go
Set
func (self *Grid) Set(entries ...interface{}) { entry := GridItem{ Type: row, Entry: entries, IsLeaf: false, ratio: 1.0, } self.setHelper(entry, 1.0, 1.0) }
go
func (self *Grid) Set(entries ...interface{}) { entry := GridItem{ Type: row, Entry: entries, IsLeaf: false, ratio: 1.0, } self.setHelper(entry, 1.0, 1.0) }
[ "func", "(", "self", "*", "Grid", ")", "Set", "(", "entries", "...", "interface", "{", "}", ")", "{", "entry", ":=", "GridItem", "{", "Type", ":", "row", ",", "Entry", ":", "entries", ",", "IsLeaf", ":", "false", ",", "ratio", ":", "1.0", ",", "}", "\n", "self", ".", "setHelper", "(", "entry", ",", "1.0", ",", "1.0", ")", "\n", "}" ]
// Set is used to add Columns and Rows to the grid. // It recursively searches the GridItems, adding leaves to the grid and calculating the dimensions of the leaves.
[ "Set", "is", "used", "to", "add", "Columns", "and", "Rows", "to", "the", "grid", ".", "It", "recursively", "searches", "the", "GridItems", "adding", "leaves", "to", "the", "grid", "and", "calculating", "the", "dimensions", "of", "the", "leaves", "." ]
213738dbc71cff7412f8dae6d9f27ce4c379dc38
https://github.com/gizak/termui/blob/213738dbc71cff7412f8dae6d9f27ce4c379dc38/grid.go#L72-L80
train
gizak/termui
block.go
Draw
func (self *Block) Draw(buf *Buffer) { if self.Border { self.drawBorder(buf) } buf.SetString( self.Title, self.TitleStyle, image.Pt(self.Min.X+2, self.Min.Y), ) }
go
func (self *Block) Draw(buf *Buffer) { if self.Border { self.drawBorder(buf) } buf.SetString( self.Title, self.TitleStyle, image.Pt(self.Min.X+2, self.Min.Y), ) }
[ "func", "(", "self", "*", "Block", ")", "Draw", "(", "buf", "*", "Buffer", ")", "{", "if", "self", ".", "Border", "{", "self", ".", "drawBorder", "(", "buf", ")", "\n", "}", "\n", "buf", ".", "SetString", "(", "self", ".", "Title", ",", "self", ".", "TitleStyle", ",", "image", ".", "Pt", "(", "self", ".", "Min", ".", "X", "+", "2", ",", "self", ".", "Min", ".", "Y", ")", ",", ")", "\n", "}" ]
// Draw implements the Drawable interface.
[ "Draw", "implements", "the", "Drawable", "interface", "." ]
213738dbc71cff7412f8dae6d9f27ce4c379dc38
https://github.com/gizak/termui/blob/213738dbc71cff7412f8dae6d9f27ce4c379dc38/block.go#L80-L89
train
gizak/termui
block.go
SetRect
func (self *Block) SetRect(x1, y1, x2, y2 int) { self.Rectangle = image.Rect(x1, y1, x2, y2) self.Inner = image.Rect( self.Min.X+1+self.PaddingLeft, self.Min.Y+1+self.PaddingTop, self.Max.X-1-self.PaddingRight, self.Max.Y-1-self.PaddingBottom, ) }
go
func (self *Block) SetRect(x1, y1, x2, y2 int) { self.Rectangle = image.Rect(x1, y1, x2, y2) self.Inner = image.Rect( self.Min.X+1+self.PaddingLeft, self.Min.Y+1+self.PaddingTop, self.Max.X-1-self.PaddingRight, self.Max.Y-1-self.PaddingBottom, ) }
[ "func", "(", "self", "*", "Block", ")", "SetRect", "(", "x1", ",", "y1", ",", "x2", ",", "y2", "int", ")", "{", "self", ".", "Rectangle", "=", "image", ".", "Rect", "(", "x1", ",", "y1", ",", "x2", ",", "y2", ")", "\n", "self", ".", "Inner", "=", "image", ".", "Rect", "(", "self", ".", "Min", ".", "X", "+", "1", "+", "self", ".", "PaddingLeft", ",", "self", ".", "Min", ".", "Y", "+", "1", "+", "self", ".", "PaddingTop", ",", "self", ".", "Max", ".", "X", "-", "1", "-", "self", ".", "PaddingRight", ",", "self", ".", "Max", ".", "Y", "-", "1", "-", "self", ".", "PaddingBottom", ",", ")", "\n", "}" ]
// SetRect implements the Drawable interface.
[ "SetRect", "implements", "the", "Drawable", "interface", "." ]
213738dbc71cff7412f8dae6d9f27ce4c379dc38
https://github.com/gizak/termui/blob/213738dbc71cff7412f8dae6d9f27ce4c379dc38/block.go#L92-L100
train
gizak/termui
events.go
PollEvents
func PollEvents() <-chan Event { ch := make(chan Event) go func() { for { ch <- convertTermboxEvent(tb.PollEvent()) } }() return ch }
go
func PollEvents() <-chan Event { ch := make(chan Event) go func() { for { ch <- convertTermboxEvent(tb.PollEvent()) } }() return ch }
[ "func", "PollEvents", "(", ")", "<-", "chan", "Event", "{", "ch", ":=", "make", "(", "chan", "Event", ")", "\n", "go", "func", "(", ")", "{", "for", "{", "ch", "<-", "convertTermboxEvent", "(", "tb", ".", "PollEvent", "(", ")", ")", "\n", "}", "\n", "}", "(", ")", "\n", "return", "ch", "\n", "}" ]
// PollEvents gets events from termbox, converts them, then sends them to each of its channels.
[ "PollEvents", "gets", "events", "from", "termbox", "converts", "them", "then", "sends", "them", "to", "each", "of", "its", "channels", "." ]
213738dbc71cff7412f8dae6d9f27ce4c379dc38
https://github.com/gizak/termui/blob/213738dbc71cff7412f8dae6d9f27ce4c379dc38/events.go#L70-L78
train
gizak/termui
events.go
convertTermboxKeyboardEvent
func convertTermboxKeyboardEvent(e tb.Event) Event { ID := "%s" if e.Mod == tb.ModAlt { ID = "<M-%s>" } if e.Ch != 0 { ID = fmt.Sprintf(ID, string(e.Ch)) } else { converted, ok := keyboardMap[e.Key] if !ok { converted = "" } ID = fmt.Sprintf(ID, converted) } return Event{ Type: KeyboardEvent, ID: ID, } }
go
func convertTermboxKeyboardEvent(e tb.Event) Event { ID := "%s" if e.Mod == tb.ModAlt { ID = "<M-%s>" } if e.Ch != 0 { ID = fmt.Sprintf(ID, string(e.Ch)) } else { converted, ok := keyboardMap[e.Key] if !ok { converted = "" } ID = fmt.Sprintf(ID, converted) } return Event{ Type: KeyboardEvent, ID: ID, } }
[ "func", "convertTermboxKeyboardEvent", "(", "e", "tb", ".", "Event", ")", "Event", "{", "ID", ":=", "\"", "\"", "\n", "if", "e", ".", "Mod", "==", "tb", ".", "ModAlt", "{", "ID", "=", "\"", "\"", "\n", "}", "\n\n", "if", "e", ".", "Ch", "!=", "0", "{", "ID", "=", "fmt", ".", "Sprintf", "(", "ID", ",", "string", "(", "e", ".", "Ch", ")", ")", "\n", "}", "else", "{", "converted", ",", "ok", ":=", "keyboardMap", "[", "e", ".", "Key", "]", "\n", "if", "!", "ok", "{", "converted", "=", "\"", "\"", "\n", "}", "\n", "ID", "=", "fmt", ".", "Sprintf", "(", "ID", ",", "converted", ")", "\n", "}", "\n\n", "return", "Event", "{", "Type", ":", "KeyboardEvent", ",", "ID", ":", "ID", ",", "}", "\n", "}" ]
// convertTermboxKeyboardEvent converts a termbox keyboard event to a more friendly string format. // Combines modifiers into the string instead of having them as additional fields in an event.
[ "convertTermboxKeyboardEvent", "converts", "a", "termbox", "keyboard", "event", "to", "a", "more", "friendly", "string", "format", ".", "Combines", "modifiers", "into", "the", "string", "instead", "of", "having", "them", "as", "additional", "fields", "in", "an", "event", "." ]
213738dbc71cff7412f8dae6d9f27ce4c379dc38
https://github.com/gizak/termui/blob/213738dbc71cff7412f8dae6d9f27ce4c379dc38/events.go#L142-L162
train
gizak/termui
events.go
convertTermboxEvent
func convertTermboxEvent(e tb.Event) Event { if e.Type == tb.EventError { panic(e.Err) } switch e.Type { case tb.EventKey: return convertTermboxKeyboardEvent(e) case tb.EventMouse: return convertTermboxMouseEvent(e) case tb.EventResize: return Event{ Type: ResizeEvent, ID: "<Resize>", Payload: Resize{ Width: e.Width, Height: e.Height, }, } } return Event{} }
go
func convertTermboxEvent(e tb.Event) Event { if e.Type == tb.EventError { panic(e.Err) } switch e.Type { case tb.EventKey: return convertTermboxKeyboardEvent(e) case tb.EventMouse: return convertTermboxMouseEvent(e) case tb.EventResize: return Event{ Type: ResizeEvent, ID: "<Resize>", Payload: Resize{ Width: e.Width, Height: e.Height, }, } } return Event{} }
[ "func", "convertTermboxEvent", "(", "e", "tb", ".", "Event", ")", "Event", "{", "if", "e", ".", "Type", "==", "tb", ".", "EventError", "{", "panic", "(", "e", ".", "Err", ")", "\n", "}", "\n", "switch", "e", ".", "Type", "{", "case", "tb", ".", "EventKey", ":", "return", "convertTermboxKeyboardEvent", "(", "e", ")", "\n", "case", "tb", ".", "EventMouse", ":", "return", "convertTermboxMouseEvent", "(", "e", ")", "\n", "case", "tb", ".", "EventResize", ":", "return", "Event", "{", "Type", ":", "ResizeEvent", ",", "ID", ":", "\"", "\"", ",", "Payload", ":", "Resize", "{", "Width", ":", "e", ".", "Width", ",", "Height", ":", "e", ".", "Height", ",", "}", ",", "}", "\n", "}", "\n", "return", "Event", "{", "}", "\n", "}" ]
// convertTermboxEvent turns a termbox event into a termui event.
[ "convertTermboxEvent", "turns", "a", "termbox", "event", "into", "a", "termui", "event", "." ]
213738dbc71cff7412f8dae6d9f27ce4c379dc38
https://github.com/gizak/termui/blob/213738dbc71cff7412f8dae6d9f27ce4c379dc38/events.go#L191-L211
train
gizak/termui
style.go
NewStyle
func NewStyle(fg Color, args ...interface{}) Style { bg := ColorClear modifier := ModifierClear if len(args) >= 1 { bg = args[0].(Color) } if len(args) == 2 { modifier = args[1].(Modifier) } return Style{ fg, bg, modifier, } }
go
func NewStyle(fg Color, args ...interface{}) Style { bg := ColorClear modifier := ModifierClear if len(args) >= 1 { bg = args[0].(Color) } if len(args) == 2 { modifier = args[1].(Modifier) } return Style{ fg, bg, modifier, } }
[ "func", "NewStyle", "(", "fg", "Color", ",", "args", "...", "interface", "{", "}", ")", "Style", "{", "bg", ":=", "ColorClear", "\n", "modifier", ":=", "ModifierClear", "\n", "if", "len", "(", "args", ")", ">=", "1", "{", "bg", "=", "args", "[", "0", "]", ".", "(", "Color", ")", "\n", "}", "\n", "if", "len", "(", "args", ")", "==", "2", "{", "modifier", "=", "args", "[", "1", "]", ".", "(", "Modifier", ")", "\n", "}", "\n", "return", "Style", "{", "fg", ",", "bg", ",", "modifier", ",", "}", "\n", "}" ]
// NewStyle takes 1 to 3 arguments // 1st argument = Fg // 2nd argument = optional Bg // 3rd argument = optional Modifier
[ "NewStyle", "takes", "1", "to", "3", "arguments", "1st", "argument", "=", "Fg", "2nd", "argument", "=", "optional", "Bg", "3rd", "argument", "=", "optional", "Modifier" ]
213738dbc71cff7412f8dae6d9f27ce4c379dc38
https://github.com/gizak/termui/blob/213738dbc71cff7412f8dae6d9f27ce4c379dc38/style.go#L51-L65
train
gizak/termui
widgets/piechart.go
NewPieChart
func NewPieChart() *PieChart { return &PieChart{ Block: *NewBlock(), Colors: Theme.PieChart.Slices, AngleOffset: piechartOffsetUp, } }
go
func NewPieChart() *PieChart { return &PieChart{ Block: *NewBlock(), Colors: Theme.PieChart.Slices, AngleOffset: piechartOffsetUp, } }
[ "func", "NewPieChart", "(", ")", "*", "PieChart", "{", "return", "&", "PieChart", "{", "Block", ":", "*", "NewBlock", "(", ")", ",", "Colors", ":", "Theme", ".", "PieChart", ".", "Slices", ",", "AngleOffset", ":", "piechartOffsetUp", ",", "}", "\n", "}" ]
// NewPieChart Creates a new pie chart with reasonable defaults and no labels.
[ "NewPieChart", "Creates", "a", "new", "pie", "chart", "with", "reasonable", "defaults", "and", "no", "labels", "." ]
213738dbc71cff7412f8dae6d9f27ce4c379dc38
https://github.com/gizak/termui/blob/213738dbc71cff7412f8dae6d9f27ce4c379dc38/widgets/piechart.go#L29-L35
train
gizak/termui
widgets/piechart.go
at
func (self circle) at(phi float64) image.Point { x := self.X + int(RoundFloat64(xStretch*self.radius*math.Cos(phi))) y := self.Y + int(RoundFloat64(self.radius*math.Sin(phi))) return image.Point{X: x, Y: y} }
go
func (self circle) at(phi float64) image.Point { x := self.X + int(RoundFloat64(xStretch*self.radius*math.Cos(phi))) y := self.Y + int(RoundFloat64(self.radius*math.Sin(phi))) return image.Point{X: x, Y: y} }
[ "func", "(", "self", "circle", ")", "at", "(", "phi", "float64", ")", "image", ".", "Point", "{", "x", ":=", "self", ".", "X", "+", "int", "(", "RoundFloat64", "(", "xStretch", "*", "self", ".", "radius", "*", "math", ".", "Cos", "(", "phi", ")", ")", ")", "\n", "y", ":=", "self", ".", "Y", "+", "int", "(", "RoundFloat64", "(", "self", ".", "radius", "*", "math", ".", "Sin", "(", "phi", ")", ")", ")", "\n", "return", "image", ".", "Point", "{", "X", ":", "x", ",", "Y", ":", "y", "}", "\n", "}" ]
// computes the point at a given angle phi
[ "computes", "the", "point", "at", "a", "given", "angle", "phi" ]
213738dbc71cff7412f8dae6d9f27ce4c379dc38
https://github.com/gizak/termui/blob/213738dbc71cff7412f8dae6d9f27ce4c379dc38/widgets/piechart.go#L88-L92
train
gizak/termui
widgets/piechart.go
draw
func (self line) draw(cell Cell, buf *Buffer) { isLeftOf := func(p1, p2 image.Point) bool { return p1.X <= p2.X } isTopOf := func(p1, p2 image.Point) bool { return p1.Y <= p2.Y } p1, p2 := self.P1, self.P2 buf.SetCell(NewCell('*', cell.Style), self.P2) width, height := self.size() if width > height { // paint left to right if !isLeftOf(p1, p2) { p1, p2 = p2, p1 } flip := 1.0 if !isTopOf(p1, p2) { flip = -1.0 } for x := p1.X; x <= p2.X; x++ { ratio := float64(height) / float64(width) factor := float64(x - p1.X) y := ratio * factor * flip buf.SetCell(cell, image.Pt(x, int(RoundFloat64(y))+p1.Y)) } } else { // paint top to bottom if !isTopOf(p1, p2) { p1, p2 = p2, p1 } flip := 1.0 if !isLeftOf(p1, p2) { flip = -1.0 } for y := p1.Y; y <= p2.Y; y++ { ratio := float64(width) / float64(height) factor := float64(y - p1.Y) x := ratio * factor * flip buf.SetCell(cell, image.Pt(int(RoundFloat64(x))+p1.X, y)) } } }
go
func (self line) draw(cell Cell, buf *Buffer) { isLeftOf := func(p1, p2 image.Point) bool { return p1.X <= p2.X } isTopOf := func(p1, p2 image.Point) bool { return p1.Y <= p2.Y } p1, p2 := self.P1, self.P2 buf.SetCell(NewCell('*', cell.Style), self.P2) width, height := self.size() if width > height { // paint left to right if !isLeftOf(p1, p2) { p1, p2 = p2, p1 } flip := 1.0 if !isTopOf(p1, p2) { flip = -1.0 } for x := p1.X; x <= p2.X; x++ { ratio := float64(height) / float64(width) factor := float64(x - p1.X) y := ratio * factor * flip buf.SetCell(cell, image.Pt(x, int(RoundFloat64(y))+p1.Y)) } } else { // paint top to bottom if !isTopOf(p1, p2) { p1, p2 = p2, p1 } flip := 1.0 if !isLeftOf(p1, p2) { flip = -1.0 } for y := p1.Y; y <= p2.Y; y++ { ratio := float64(width) / float64(height) factor := float64(y - p1.Y) x := ratio * factor * flip buf.SetCell(cell, image.Pt(int(RoundFloat64(x))+p1.X, y)) } } }
[ "func", "(", "self", "line", ")", "draw", "(", "cell", "Cell", ",", "buf", "*", "Buffer", ")", "{", "isLeftOf", ":=", "func", "(", "p1", ",", "p2", "image", ".", "Point", ")", "bool", "{", "return", "p1", ".", "X", "<=", "p2", ".", "X", "\n", "}", "\n", "isTopOf", ":=", "func", "(", "p1", ",", "p2", "image", ".", "Point", ")", "bool", "{", "return", "p1", ".", "Y", "<=", "p2", ".", "Y", "\n", "}", "\n", "p1", ",", "p2", ":=", "self", ".", "P1", ",", "self", ".", "P2", "\n", "buf", ".", "SetCell", "(", "NewCell", "(", "'*'", ",", "cell", ".", "Style", ")", ",", "self", ".", "P2", ")", "\n", "width", ",", "height", ":=", "self", ".", "size", "(", ")", "\n", "if", "width", ">", "height", "{", "// paint left to right", "if", "!", "isLeftOf", "(", "p1", ",", "p2", ")", "{", "p1", ",", "p2", "=", "p2", ",", "p1", "\n", "}", "\n", "flip", ":=", "1.0", "\n", "if", "!", "isTopOf", "(", "p1", ",", "p2", ")", "{", "flip", "=", "-", "1.0", "\n", "}", "\n", "for", "x", ":=", "p1", ".", "X", ";", "x", "<=", "p2", ".", "X", ";", "x", "++", "{", "ratio", ":=", "float64", "(", "height", ")", "/", "float64", "(", "width", ")", "\n", "factor", ":=", "float64", "(", "x", "-", "p1", ".", "X", ")", "\n", "y", ":=", "ratio", "*", "factor", "*", "flip", "\n", "buf", ".", "SetCell", "(", "cell", ",", "image", ".", "Pt", "(", "x", ",", "int", "(", "RoundFloat64", "(", "y", ")", ")", "+", "p1", ".", "Y", ")", ")", "\n", "}", "\n", "}", "else", "{", "// paint top to bottom", "if", "!", "isTopOf", "(", "p1", ",", "p2", ")", "{", "p1", ",", "p2", "=", "p2", ",", "p1", "\n", "}", "\n", "flip", ":=", "1.0", "\n", "if", "!", "isLeftOf", "(", "p1", ",", "p2", ")", "{", "flip", "=", "-", "1.0", "\n", "}", "\n", "for", "y", ":=", "p1", ".", "Y", ";", "y", "<=", "p2", ".", "Y", ";", "y", "++", "{", "ratio", ":=", "float64", "(", "width", ")", "/", "float64", "(", "height", ")", "\n", "factor", ":=", "float64", "(", "y", "-", "p1", ".", "Y", ")", "\n", "x", ":=", "ratio", "*", "factor", "*", "flip", "\n", "buf", ".", "SetCell", "(", "cell", ",", "image", ".", "Pt", "(", "int", "(", "RoundFloat64", "(", "x", ")", ")", "+", "p1", ".", "X", ",", "y", ")", ")", "\n", "}", "\n", "}", "\n", "}" ]
// draws the line
[ "draws", "the", "line" ]
213738dbc71cff7412f8dae6d9f27ce4c379dc38
https://github.com/gizak/termui/blob/213738dbc71cff7412f8dae6d9f27ce4c379dc38/widgets/piechart.go#L105-L144
train
gizak/termui
widgets/piechart.go
size
func (self line) size() (w, h int) { return AbsInt(self.P2.X - self.P1.X), AbsInt(self.P2.Y - self.P1.Y) }
go
func (self line) size() (w, h int) { return AbsInt(self.P2.X - self.P1.X), AbsInt(self.P2.Y - self.P1.Y) }
[ "func", "(", "self", "line", ")", "size", "(", ")", "(", "w", ",", "h", "int", ")", "{", "return", "AbsInt", "(", "self", ".", "P2", ".", "X", "-", "self", ".", "P1", ".", "X", ")", ",", "AbsInt", "(", "self", ".", "P2", ".", "Y", "-", "self", ".", "P1", ".", "Y", ")", "\n", "}" ]
// width and height of a line
[ "width", "and", "height", "of", "a", "line" ]
213738dbc71cff7412f8dae6d9f27ce4c379dc38
https://github.com/gizak/termui/blob/213738dbc71cff7412f8dae6d9f27ce4c379dc38/widgets/piechart.go#L147-L149
train
gizak/termui
backend.go
Init
func Init() error { if err := tb.Init(); err != nil { return err } tb.SetInputMode(tb.InputEsc | tb.InputMouse) tb.SetOutputMode(tb.Output256) return nil }
go
func Init() error { if err := tb.Init(); err != nil { return err } tb.SetInputMode(tb.InputEsc | tb.InputMouse) tb.SetOutputMode(tb.Output256) return nil }
[ "func", "Init", "(", ")", "error", "{", "if", "err", ":=", "tb", ".", "Init", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "tb", ".", "SetInputMode", "(", "tb", ".", "InputEsc", "|", "tb", ".", "InputMouse", ")", "\n", "tb", ".", "SetOutputMode", "(", "tb", ".", "Output256", ")", "\n", "return", "nil", "\n", "}" ]
// Init initializes termbox-go and is required to render anything. // After initialization, the library must be finalized with `Close`.
[ "Init", "initializes", "termbox", "-", "go", "and", "is", "required", "to", "render", "anything", ".", "After", "initialization", "the", "library", "must", "be", "finalized", "with", "Close", "." ]
213738dbc71cff7412f8dae6d9f27ce4c379dc38
https://github.com/gizak/termui/blob/213738dbc71cff7412f8dae6d9f27ce4c379dc38/backend.go#L13-L20
train
urfave/cli
altsrc/toml_file_loader.go
NewTomlSourceFromFile
func NewTomlSourceFromFile(file string) (InputSourceContext, error) { tsc := &tomlSourceContext{FilePath: file} var results tomlMap = tomlMap{} if err := readCommandToml(tsc.FilePath, &results); err != nil { return nil, fmt.Errorf("Unable to load TOML file '%s': inner error: \n'%v'", tsc.FilePath, err.Error()) } return &MapInputSource{valueMap: results.Map}, nil }
go
func NewTomlSourceFromFile(file string) (InputSourceContext, error) { tsc := &tomlSourceContext{FilePath: file} var results tomlMap = tomlMap{} if err := readCommandToml(tsc.FilePath, &results); err != nil { return nil, fmt.Errorf("Unable to load TOML file '%s': inner error: \n'%v'", tsc.FilePath, err.Error()) } return &MapInputSource{valueMap: results.Map}, nil }
[ "func", "NewTomlSourceFromFile", "(", "file", "string", ")", "(", "InputSourceContext", ",", "error", ")", "{", "tsc", ":=", "&", "tomlSourceContext", "{", "FilePath", ":", "file", "}", "\n", "var", "results", "tomlMap", "=", "tomlMap", "{", "}", "\n", "if", "err", ":=", "readCommandToml", "(", "tsc", ".", "FilePath", ",", "&", "results", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\\n", "\"", ",", "tsc", ".", "FilePath", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "return", "&", "MapInputSource", "{", "valueMap", ":", "results", ".", "Map", "}", ",", "nil", "\n", "}" ]
// NewTomlSourceFromFile creates a new TOML InputSourceContext from a filepath.
[ "NewTomlSourceFromFile", "creates", "a", "new", "TOML", "InputSourceContext", "from", "a", "filepath", "." ]
693af58b4d51b8fcc7f9d89576da170765980581
https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/toml_file_loader.go#L83-L90
train
urfave/cli
altsrc/toml_file_loader.go
NewTomlSourceFromFlagFunc
func NewTomlSourceFromFlagFunc(flagFileName string) func(context *cli.Context) (InputSourceContext, error) { return func(context *cli.Context) (InputSourceContext, error) { filePath := context.String(flagFileName) return NewTomlSourceFromFile(filePath) } }
go
func NewTomlSourceFromFlagFunc(flagFileName string) func(context *cli.Context) (InputSourceContext, error) { return func(context *cli.Context) (InputSourceContext, error) { filePath := context.String(flagFileName) return NewTomlSourceFromFile(filePath) } }
[ "func", "NewTomlSourceFromFlagFunc", "(", "flagFileName", "string", ")", "func", "(", "context", "*", "cli", ".", "Context", ")", "(", "InputSourceContext", ",", "error", ")", "{", "return", "func", "(", "context", "*", "cli", ".", "Context", ")", "(", "InputSourceContext", ",", "error", ")", "{", "filePath", ":=", "context", ".", "String", "(", "flagFileName", ")", "\n", "return", "NewTomlSourceFromFile", "(", "filePath", ")", "\n", "}", "\n", "}" ]
// NewTomlSourceFromFlagFunc creates a new TOML InputSourceContext from a provided flag name and source context.
[ "NewTomlSourceFromFlagFunc", "creates", "a", "new", "TOML", "InputSourceContext", "from", "a", "provided", "flag", "name", "and", "source", "context", "." ]
693af58b4d51b8fcc7f9d89576da170765980581
https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/toml_file_loader.go#L93-L98
train
urfave/cli
altsrc/json_source_context.go
NewJSONSourceFromFlagFunc
func NewJSONSourceFromFlagFunc(flag string) func(c *cli.Context) (InputSourceContext, error) { return func(context *cli.Context) (InputSourceContext, error) { return NewJSONSourceFromFile(context.String(flag)) } }
go
func NewJSONSourceFromFlagFunc(flag string) func(c *cli.Context) (InputSourceContext, error) { return func(context *cli.Context) (InputSourceContext, error) { return NewJSONSourceFromFile(context.String(flag)) } }
[ "func", "NewJSONSourceFromFlagFunc", "(", "flag", "string", ")", "func", "(", "c", "*", "cli", ".", "Context", ")", "(", "InputSourceContext", ",", "error", ")", "{", "return", "func", "(", "context", "*", "cli", ".", "Context", ")", "(", "InputSourceContext", ",", "error", ")", "{", "return", "NewJSONSourceFromFile", "(", "context", ".", "String", "(", "flag", ")", ")", "\n", "}", "\n", "}" ]
// NewJSONSourceFromFlagFunc returns a func that takes a cli.Context // and returns an InputSourceContext suitable for retrieving config // variables from a file containing JSON data with the file name defined // by the given flag.
[ "NewJSONSourceFromFlagFunc", "returns", "a", "func", "that", "takes", "a", "cli", ".", "Context", "and", "returns", "an", "InputSourceContext", "suitable", "for", "retrieving", "config", "variables", "from", "a", "file", "containing", "JSON", "data", "with", "the", "file", "name", "defined", "by", "the", "given", "flag", "." ]
693af58b4d51b8fcc7f9d89576da170765980581
https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/json_source_context.go#L18-L22
train
urfave/cli
altsrc/json_source_context.go
NewJSONSourceFromReader
func NewJSONSourceFromReader(r io.Reader) (InputSourceContext, error) { data, err := ioutil.ReadAll(r) if err != nil { return nil, err } return NewJSONSource(data) }
go
func NewJSONSourceFromReader(r io.Reader) (InputSourceContext, error) { data, err := ioutil.ReadAll(r) if err != nil { return nil, err } return NewJSONSource(data) }
[ "func", "NewJSONSourceFromReader", "(", "r", "io", ".", "Reader", ")", "(", "InputSourceContext", ",", "error", ")", "{", "data", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "r", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "NewJSONSource", "(", "data", ")", "\n", "}" ]
// NewJSONSourceFromReader returns an InputSourceContext suitable for // retrieving config variables from an io.Reader that returns JSON data.
[ "NewJSONSourceFromReader", "returns", "an", "InputSourceContext", "suitable", "for", "retrieving", "config", "variables", "from", "an", "io", ".", "Reader", "that", "returns", "JSON", "data", "." ]
693af58b4d51b8fcc7f9d89576da170765980581
https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/json_source_context.go#L37-L43
train
urfave/cli
altsrc/json_source_context.go
NewJSONSource
func NewJSONSource(data []byte) (InputSourceContext, error) { var deserialized map[string]interface{} if err := json.Unmarshal(data, &deserialized); err != nil { return nil, err } return &jsonSource{deserialized: deserialized}, nil }
go
func NewJSONSource(data []byte) (InputSourceContext, error) { var deserialized map[string]interface{} if err := json.Unmarshal(data, &deserialized); err != nil { return nil, err } return &jsonSource{deserialized: deserialized}, nil }
[ "func", "NewJSONSource", "(", "data", "[", "]", "byte", ")", "(", "InputSourceContext", ",", "error", ")", "{", "var", "deserialized", "map", "[", "string", "]", "interface", "{", "}", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "data", ",", "&", "deserialized", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "jsonSource", "{", "deserialized", ":", "deserialized", "}", ",", "nil", "\n", "}" ]
// NewJSONSource returns an InputSourceContext suitable for retrieving // config variables from raw JSON data.
[ "NewJSONSource", "returns", "an", "InputSourceContext", "suitable", "for", "retrieving", "config", "variables", "from", "raw", "JSON", "data", "." ]
693af58b4d51b8fcc7f9d89576da170765980581
https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/json_source_context.go#L47-L53
train
urfave/cli
altsrc/json_source_context.go
BoolT
func (x *jsonSource) BoolT(name string) (bool, error) { return false, fmt.Errorf("unsupported type BoolT for JSONSource") }
go
func (x *jsonSource) BoolT(name string) (bool, error) { return false, fmt.Errorf("unsupported type BoolT for JSONSource") }
[ "func", "(", "x", "*", "jsonSource", ")", "BoolT", "(", "name", "string", ")", "(", "bool", ",", "error", ")", "{", "return", "false", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}" ]
// since this source appears to require all configuration to be specified, the // concept of a boolean defaulting to true seems inconsistent with no defaults
[ "since", "this", "source", "appears", "to", "require", "all", "configuration", "to", "be", "specified", "the", "concept", "of", "a", "boolean", "defaulting", "to", "true", "seems", "inconsistent", "with", "no", "defaults" ]
693af58b4d51b8fcc7f9d89576da170765980581
https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/json_source_context.go#L180-L182
train
urfave/cli
help.go
ShowAppHelpAndExit
func ShowAppHelpAndExit(c *Context, exitCode int) { ShowAppHelp(c) os.Exit(exitCode) }
go
func ShowAppHelpAndExit(c *Context, exitCode int) { ShowAppHelp(c) os.Exit(exitCode) }
[ "func", "ShowAppHelpAndExit", "(", "c", "*", "Context", ",", "exitCode", "int", ")", "{", "ShowAppHelp", "(", "c", ")", "\n", "os", ".", "Exit", "(", "exitCode", ")", "\n", "}" ]
// ShowAppHelpAndExit - Prints the list of subcommands for the app and exits with exit code.
[ "ShowAppHelpAndExit", "-", "Prints", "the", "list", "of", "subcommands", "for", "the", "app", "and", "exits", "with", "exit", "code", "." ]
693af58b4d51b8fcc7f9d89576da170765980581
https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/help.go#L132-L135
train
urfave/cli
help.go
ShowAppHelp
func ShowAppHelp(c *Context) (err error) { if c.App.CustomAppHelpTemplate == "" { HelpPrinter(c.App.Writer, AppHelpTemplate, c.App) return } customAppData := func() map[string]interface{} { if c.App.ExtraInfo == nil { return nil } return map[string]interface{}{ "ExtraInfo": c.App.ExtraInfo, } } HelpPrinterCustom(c.App.Writer, c.App.CustomAppHelpTemplate, c.App, customAppData()) return nil }
go
func ShowAppHelp(c *Context) (err error) { if c.App.CustomAppHelpTemplate == "" { HelpPrinter(c.App.Writer, AppHelpTemplate, c.App) return } customAppData := func() map[string]interface{} { if c.App.ExtraInfo == nil { return nil } return map[string]interface{}{ "ExtraInfo": c.App.ExtraInfo, } } HelpPrinterCustom(c.App.Writer, c.App.CustomAppHelpTemplate, c.App, customAppData()) return nil }
[ "func", "ShowAppHelp", "(", "c", "*", "Context", ")", "(", "err", "error", ")", "{", "if", "c", ".", "App", ".", "CustomAppHelpTemplate", "==", "\"", "\"", "{", "HelpPrinter", "(", "c", ".", "App", ".", "Writer", ",", "AppHelpTemplate", ",", "c", ".", "App", ")", "\n", "return", "\n", "}", "\n", "customAppData", ":=", "func", "(", ")", "map", "[", "string", "]", "interface", "{", "}", "{", "if", "c", ".", "App", ".", "ExtraInfo", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "map", "[", "string", "]", "interface", "{", "}", "{", "\"", "\"", ":", "c", ".", "App", ".", "ExtraInfo", ",", "}", "\n", "}", "\n", "HelpPrinterCustom", "(", "c", ".", "App", ".", "Writer", ",", "c", ".", "App", ".", "CustomAppHelpTemplate", ",", "c", ".", "App", ",", "customAppData", "(", ")", ")", "\n", "return", "nil", "\n", "}" ]
// ShowAppHelp is an action that displays the help.
[ "ShowAppHelp", "is", "an", "action", "that", "displays", "the", "help", "." ]
693af58b4d51b8fcc7f9d89576da170765980581
https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/help.go#L138-L153
train
urfave/cli
help.go
DefaultAppComplete
func DefaultAppComplete(c *Context) { for _, command := range c.App.Commands { if command.Hidden { continue } if os.Getenv("_CLI_ZSH_AUTOCOMPLETE_HACK") == "1" { for _, name := range command.Names() { fmt.Fprintf(c.App.Writer, "%s:%s\n", name, command.Usage) } } else { for _, name := range command.Names() { fmt.Fprintf(c.App.Writer, "%s\n", name) } } } }
go
func DefaultAppComplete(c *Context) { for _, command := range c.App.Commands { if command.Hidden { continue } if os.Getenv("_CLI_ZSH_AUTOCOMPLETE_HACK") == "1" { for _, name := range command.Names() { fmt.Fprintf(c.App.Writer, "%s:%s\n", name, command.Usage) } } else { for _, name := range command.Names() { fmt.Fprintf(c.App.Writer, "%s\n", name) } } } }
[ "func", "DefaultAppComplete", "(", "c", "*", "Context", ")", "{", "for", "_", ",", "command", ":=", "range", "c", ".", "App", ".", "Commands", "{", "if", "command", ".", "Hidden", "{", "continue", "\n", "}", "\n", "if", "os", ".", "Getenv", "(", "\"", "\"", ")", "==", "\"", "\"", "{", "for", "_", ",", "name", ":=", "range", "command", ".", "Names", "(", ")", "{", "fmt", ".", "Fprintf", "(", "c", ".", "App", ".", "Writer", ",", "\"", "\\n", "\"", ",", "name", ",", "command", ".", "Usage", ")", "\n", "}", "\n", "}", "else", "{", "for", "_", ",", "name", ":=", "range", "command", ".", "Names", "(", ")", "{", "fmt", ".", "Fprintf", "(", "c", ".", "App", ".", "Writer", ",", "\"", "\\n", "\"", ",", "name", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "}" ]
// DefaultAppComplete prints the list of subcommands as the default app completion method
[ "DefaultAppComplete", "prints", "the", "list", "of", "subcommands", "as", "the", "default", "app", "completion", "method" ]
693af58b4d51b8fcc7f9d89576da170765980581
https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/help.go#L156-L171
train
urfave/cli
help.go
ShowCommandHelpAndExit
func ShowCommandHelpAndExit(c *Context, command string, code int) { ShowCommandHelp(c, command) os.Exit(code) }
go
func ShowCommandHelpAndExit(c *Context, command string, code int) { ShowCommandHelp(c, command) os.Exit(code) }
[ "func", "ShowCommandHelpAndExit", "(", "c", "*", "Context", ",", "command", "string", ",", "code", "int", ")", "{", "ShowCommandHelp", "(", "c", ",", "command", ")", "\n", "os", ".", "Exit", "(", "code", ")", "\n", "}" ]
// ShowCommandHelpAndExit - exits with code after showing help
[ "ShowCommandHelpAndExit", "-", "exits", "with", "code", "after", "showing", "help" ]
693af58b4d51b8fcc7f9d89576da170765980581
https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/help.go#L174-L177
train
urfave/cli
help.go
ShowCommandHelp
func ShowCommandHelp(ctx *Context, command string) error { // show the subcommand help for a command with subcommands if command == "" { HelpPrinter(ctx.App.Writer, SubcommandHelpTemplate, ctx.App) return nil } for _, c := range ctx.App.Commands { if c.HasName(command) { if c.CustomHelpTemplate != "" { HelpPrinterCustom(ctx.App.Writer, c.CustomHelpTemplate, c, nil) } else { HelpPrinter(ctx.App.Writer, CommandHelpTemplate, c) } return nil } } if ctx.App.CommandNotFound == nil { return NewExitError(fmt.Sprintf("No help topic for '%v'", command), 3) } ctx.App.CommandNotFound(ctx, command) return nil }
go
func ShowCommandHelp(ctx *Context, command string) error { // show the subcommand help for a command with subcommands if command == "" { HelpPrinter(ctx.App.Writer, SubcommandHelpTemplate, ctx.App) return nil } for _, c := range ctx.App.Commands { if c.HasName(command) { if c.CustomHelpTemplate != "" { HelpPrinterCustom(ctx.App.Writer, c.CustomHelpTemplate, c, nil) } else { HelpPrinter(ctx.App.Writer, CommandHelpTemplate, c) } return nil } } if ctx.App.CommandNotFound == nil { return NewExitError(fmt.Sprintf("No help topic for '%v'", command), 3) } ctx.App.CommandNotFound(ctx, command) return nil }
[ "func", "ShowCommandHelp", "(", "ctx", "*", "Context", ",", "command", "string", ")", "error", "{", "// show the subcommand help for a command with subcommands", "if", "command", "==", "\"", "\"", "{", "HelpPrinter", "(", "ctx", ".", "App", ".", "Writer", ",", "SubcommandHelpTemplate", ",", "ctx", ".", "App", ")", "\n", "return", "nil", "\n", "}", "\n\n", "for", "_", ",", "c", ":=", "range", "ctx", ".", "App", ".", "Commands", "{", "if", "c", ".", "HasName", "(", "command", ")", "{", "if", "c", ".", "CustomHelpTemplate", "!=", "\"", "\"", "{", "HelpPrinterCustom", "(", "ctx", ".", "App", ".", "Writer", ",", "c", ".", "CustomHelpTemplate", ",", "c", ",", "nil", ")", "\n", "}", "else", "{", "HelpPrinter", "(", "ctx", ".", "App", ".", "Writer", ",", "CommandHelpTemplate", ",", "c", ")", "\n", "}", "\n", "return", "nil", "\n", "}", "\n", "}", "\n\n", "if", "ctx", ".", "App", ".", "CommandNotFound", "==", "nil", "{", "return", "NewExitError", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "command", ")", ",", "3", ")", "\n", "}", "\n\n", "ctx", ".", "App", ".", "CommandNotFound", "(", "ctx", ",", "command", ")", "\n", "return", "nil", "\n", "}" ]
// ShowCommandHelp prints help for the given command
[ "ShowCommandHelp", "prints", "help", "for", "the", "given", "command" ]
693af58b4d51b8fcc7f9d89576da170765980581
https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/help.go#L180-L204
train
urfave/cli
help.go
ShowCompletions
func ShowCompletions(c *Context) { a := c.App if a != nil && a.BashComplete != nil { a.BashComplete(c) } }
go
func ShowCompletions(c *Context) { a := c.App if a != nil && a.BashComplete != nil { a.BashComplete(c) } }
[ "func", "ShowCompletions", "(", "c", "*", "Context", ")", "{", "a", ":=", "c", ".", "App", "\n", "if", "a", "!=", "nil", "&&", "a", ".", "BashComplete", "!=", "nil", "{", "a", ".", "BashComplete", "(", "c", ")", "\n", "}", "\n", "}" ]
// ShowCompletions prints the lists of commands within a given context
[ "ShowCompletions", "prints", "the", "lists", "of", "commands", "within", "a", "given", "context" ]
693af58b4d51b8fcc7f9d89576da170765980581
https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/help.go#L221-L226
train