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 |
---|---|---|---|---|---|---|---|---|---|---|---|
urfave/cli | help.go | ShowCommandCompletions | func ShowCommandCompletions(ctx *Context, command string) {
c := ctx.App.Command(command)
if c != nil && c.BashComplete != nil {
c.BashComplete(ctx)
}
} | go | func ShowCommandCompletions(ctx *Context, command string) {
c := ctx.App.Command(command)
if c != nil && c.BashComplete != nil {
c.BashComplete(ctx)
}
} | [
"func",
"ShowCommandCompletions",
"(",
"ctx",
"*",
"Context",
",",
"command",
"string",
")",
"{",
"c",
":=",
"ctx",
".",
"App",
".",
"Command",
"(",
"command",
")",
"\n",
"if",
"c",
"!=",
"nil",
"&&",
"c",
".",
"BashComplete",
"!=",
"nil",
"{",
"c",
".",
"BashComplete",
"(",
"ctx",
")",
"\n",
"}",
"\n",
"}"
] | // ShowCommandCompletions prints the custom completions for a given command | [
"ShowCommandCompletions",
"prints",
"the",
"custom",
"completions",
"for",
"a",
"given",
"command"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/help.go#L229-L234 | train |
urfave/cli | category.go | AddCommand | func (c CommandCategories) AddCommand(category string, command Command) CommandCategories {
for _, commandCategory := range c {
if commandCategory.Name == category {
commandCategory.Commands = append(commandCategory.Commands, command)
return c
}
}
return append(c, &CommandCategory{Name: category, Commands: []Command{command}})
} | go | func (c CommandCategories) AddCommand(category string, command Command) CommandCategories {
for _, commandCategory := range c {
if commandCategory.Name == category {
commandCategory.Commands = append(commandCategory.Commands, command)
return c
}
}
return append(c, &CommandCategory{Name: category, Commands: []Command{command}})
} | [
"func",
"(",
"c",
"CommandCategories",
")",
"AddCommand",
"(",
"category",
"string",
",",
"command",
"Command",
")",
"CommandCategories",
"{",
"for",
"_",
",",
"commandCategory",
":=",
"range",
"c",
"{",
"if",
"commandCategory",
".",
"Name",
"==",
"category",
"{",
"commandCategory",
".",
"Commands",
"=",
"append",
"(",
"commandCategory",
".",
"Commands",
",",
"command",
")",
"\n",
"return",
"c",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"append",
"(",
"c",
",",
"&",
"CommandCategory",
"{",
"Name",
":",
"category",
",",
"Commands",
":",
"[",
"]",
"Command",
"{",
"command",
"}",
"}",
")",
"\n",
"}"
] | // AddCommand adds a command to a category. | [
"AddCommand",
"adds",
"a",
"command",
"to",
"a",
"category",
"."
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/category.go#L25-L33 | train |
urfave/cli | flag_generated.go | Bool | func (c *Context) Bool(name string) bool {
return lookupBool(name, c.flagSet)
} | go | func (c *Context) Bool(name string) bool {
return lookupBool(name, c.flagSet)
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"Bool",
"(",
"name",
"string",
")",
"bool",
"{",
"return",
"lookupBool",
"(",
"name",
",",
"c",
".",
"flagSet",
")",
"\n",
"}"
] | // Bool looks up the value of a local BoolFlag, returns
// false if not found | [
"Bool",
"looks",
"up",
"the",
"value",
"of",
"a",
"local",
"BoolFlag",
"returns",
"false",
"if",
"not",
"found"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/flag_generated.go#L34-L36 | train |
urfave/cli | flag_generated.go | GlobalBool | func (c *Context) GlobalBool(name string) bool {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupBool(name, fs)
}
return false
} | go | func (c *Context) GlobalBool(name string) bool {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupBool(name, fs)
}
return false
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"GlobalBool",
"(",
"name",
"string",
")",
"bool",
"{",
"if",
"fs",
":=",
"lookupGlobalFlagSet",
"(",
"name",
",",
"c",
")",
";",
"fs",
"!=",
"nil",
"{",
"return",
"lookupBool",
"(",
"name",
",",
"fs",
")",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] | // GlobalBool looks up the value of a global BoolFlag, returns
// false if not found | [
"GlobalBool",
"looks",
"up",
"the",
"value",
"of",
"a",
"global",
"BoolFlag",
"returns",
"false",
"if",
"not",
"found"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/flag_generated.go#L40-L45 | train |
urfave/cli | flag_generated.go | BoolT | func (c *Context) BoolT(name string) bool {
return lookupBoolT(name, c.flagSet)
} | go | func (c *Context) BoolT(name string) bool {
return lookupBoolT(name, c.flagSet)
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"BoolT",
"(",
"name",
"string",
")",
"bool",
"{",
"return",
"lookupBoolT",
"(",
"name",
",",
"c",
".",
"flagSet",
")",
"\n",
"}"
] | // BoolT looks up the value of a local BoolTFlag, returns
// false if not found | [
"BoolT",
"looks",
"up",
"the",
"value",
"of",
"a",
"local",
"BoolTFlag",
"returns",
"false",
"if",
"not",
"found"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/flag_generated.go#L82-L84 | train |
urfave/cli | flag_generated.go | GlobalBoolT | func (c *Context) GlobalBoolT(name string) bool {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupBoolT(name, fs)
}
return false
} | go | func (c *Context) GlobalBoolT(name string) bool {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupBoolT(name, fs)
}
return false
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"GlobalBoolT",
"(",
"name",
"string",
")",
"bool",
"{",
"if",
"fs",
":=",
"lookupGlobalFlagSet",
"(",
"name",
",",
"c",
")",
";",
"fs",
"!=",
"nil",
"{",
"return",
"lookupBoolT",
"(",
"name",
",",
"fs",
")",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] | // GlobalBoolT looks up the value of a global BoolTFlag, returns
// false if not found | [
"GlobalBoolT",
"looks",
"up",
"the",
"value",
"of",
"a",
"global",
"BoolTFlag",
"returns",
"false",
"if",
"not",
"found"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/flag_generated.go#L88-L93 | train |
urfave/cli | flag_generated.go | Duration | func (c *Context) Duration(name string) time.Duration {
return lookupDuration(name, c.flagSet)
} | go | func (c *Context) Duration(name string) time.Duration {
return lookupDuration(name, c.flagSet)
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"Duration",
"(",
"name",
"string",
")",
"time",
".",
"Duration",
"{",
"return",
"lookupDuration",
"(",
"name",
",",
"c",
".",
"flagSet",
")",
"\n",
"}"
] | // Duration looks up the value of a local DurationFlag, returns
// 0 if not found | [
"Duration",
"looks",
"up",
"the",
"value",
"of",
"a",
"local",
"DurationFlag",
"returns",
"0",
"if",
"not",
"found"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/flag_generated.go#L131-L133 | train |
urfave/cli | flag_generated.go | GlobalDuration | func (c *Context) GlobalDuration(name string) time.Duration {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupDuration(name, fs)
}
return 0
} | go | func (c *Context) GlobalDuration(name string) time.Duration {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupDuration(name, fs)
}
return 0
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"GlobalDuration",
"(",
"name",
"string",
")",
"time",
".",
"Duration",
"{",
"if",
"fs",
":=",
"lookupGlobalFlagSet",
"(",
"name",
",",
"c",
")",
";",
"fs",
"!=",
"nil",
"{",
"return",
"lookupDuration",
"(",
"name",
",",
"fs",
")",
"\n",
"}",
"\n",
"return",
"0",
"\n",
"}"
] | // GlobalDuration looks up the value of a global DurationFlag, returns
// 0 if not found | [
"GlobalDuration",
"looks",
"up",
"the",
"value",
"of",
"a",
"global",
"DurationFlag",
"returns",
"0",
"if",
"not",
"found"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/flag_generated.go#L137-L142 | train |
urfave/cli | flag_generated.go | Float64 | func (c *Context) Float64(name string) float64 {
return lookupFloat64(name, c.flagSet)
} | go | func (c *Context) Float64(name string) float64 {
return lookupFloat64(name, c.flagSet)
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"Float64",
"(",
"name",
"string",
")",
"float64",
"{",
"return",
"lookupFloat64",
"(",
"name",
",",
"c",
".",
"flagSet",
")",
"\n",
"}"
] | // Float64 looks up the value of a local Float64Flag, returns
// 0 if not found | [
"Float64",
"looks",
"up",
"the",
"value",
"of",
"a",
"local",
"Float64Flag",
"returns",
"0",
"if",
"not",
"found"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/flag_generated.go#L180-L182 | train |
urfave/cli | flag_generated.go | GlobalFloat64 | func (c *Context) GlobalFloat64(name string) float64 {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupFloat64(name, fs)
}
return 0
} | go | func (c *Context) GlobalFloat64(name string) float64 {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupFloat64(name, fs)
}
return 0
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"GlobalFloat64",
"(",
"name",
"string",
")",
"float64",
"{",
"if",
"fs",
":=",
"lookupGlobalFlagSet",
"(",
"name",
",",
"c",
")",
";",
"fs",
"!=",
"nil",
"{",
"return",
"lookupFloat64",
"(",
"name",
",",
"fs",
")",
"\n",
"}",
"\n",
"return",
"0",
"\n",
"}"
] | // GlobalFloat64 looks up the value of a global Float64Flag, returns
// 0 if not found | [
"GlobalFloat64",
"looks",
"up",
"the",
"value",
"of",
"a",
"global",
"Float64Flag",
"returns",
"0",
"if",
"not",
"found"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/flag_generated.go#L186-L191 | train |
urfave/cli | flag_generated.go | GlobalGeneric | func (c *Context) GlobalGeneric(name string) interface{} {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupGeneric(name, fs)
}
return nil
} | go | func (c *Context) GlobalGeneric(name string) interface{} {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupGeneric(name, fs)
}
return nil
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"GlobalGeneric",
"(",
"name",
"string",
")",
"interface",
"{",
"}",
"{",
"if",
"fs",
":=",
"lookupGlobalFlagSet",
"(",
"name",
",",
"c",
")",
";",
"fs",
"!=",
"nil",
"{",
"return",
"lookupGeneric",
"(",
"name",
",",
"fs",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // GlobalGeneric looks up the value of a global GenericFlag, returns
// nil if not found | [
"GlobalGeneric",
"looks",
"up",
"the",
"value",
"of",
"a",
"global",
"GenericFlag",
"returns",
"nil",
"if",
"not",
"found"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/flag_generated.go#L234-L239 | train |
urfave/cli | flag_generated.go | Int64 | func (c *Context) Int64(name string) int64 {
return lookupInt64(name, c.flagSet)
} | go | func (c *Context) Int64(name string) int64 {
return lookupInt64(name, c.flagSet)
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"Int64",
"(",
"name",
"string",
")",
"int64",
"{",
"return",
"lookupInt64",
"(",
"name",
",",
"c",
".",
"flagSet",
")",
"\n",
"}"
] | // Int64 looks up the value of a local Int64Flag, returns
// 0 if not found | [
"Int64",
"looks",
"up",
"the",
"value",
"of",
"a",
"local",
"Int64Flag",
"returns",
"0",
"if",
"not",
"found"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/flag_generated.go#L277-L279 | train |
urfave/cli | flag_generated.go | GlobalInt64 | func (c *Context) GlobalInt64(name string) int64 {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupInt64(name, fs)
}
return 0
} | go | func (c *Context) GlobalInt64(name string) int64 {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupInt64(name, fs)
}
return 0
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"GlobalInt64",
"(",
"name",
"string",
")",
"int64",
"{",
"if",
"fs",
":=",
"lookupGlobalFlagSet",
"(",
"name",
",",
"c",
")",
";",
"fs",
"!=",
"nil",
"{",
"return",
"lookupInt64",
"(",
"name",
",",
"fs",
")",
"\n",
"}",
"\n",
"return",
"0",
"\n",
"}"
] | // GlobalInt64 looks up the value of a global Int64Flag, returns
// 0 if not found | [
"GlobalInt64",
"looks",
"up",
"the",
"value",
"of",
"a",
"global",
"Int64Flag",
"returns",
"0",
"if",
"not",
"found"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/flag_generated.go#L283-L288 | train |
urfave/cli | flag_generated.go | Int | func (c *Context) Int(name string) int {
return lookupInt(name, c.flagSet)
} | go | func (c *Context) Int(name string) int {
return lookupInt(name, c.flagSet)
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"Int",
"(",
"name",
"string",
")",
"int",
"{",
"return",
"lookupInt",
"(",
"name",
",",
"c",
".",
"flagSet",
")",
"\n",
"}"
] | // Int looks up the value of a local IntFlag, returns
// 0 if not found | [
"Int",
"looks",
"up",
"the",
"value",
"of",
"a",
"local",
"IntFlag",
"returns",
"0",
"if",
"not",
"found"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/flag_generated.go#L326-L328 | train |
urfave/cli | flag_generated.go | GlobalInt | func (c *Context) GlobalInt(name string) int {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupInt(name, fs)
}
return 0
} | go | func (c *Context) GlobalInt(name string) int {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupInt(name, fs)
}
return 0
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"GlobalInt",
"(",
"name",
"string",
")",
"int",
"{",
"if",
"fs",
":=",
"lookupGlobalFlagSet",
"(",
"name",
",",
"c",
")",
";",
"fs",
"!=",
"nil",
"{",
"return",
"lookupInt",
"(",
"name",
",",
"fs",
")",
"\n",
"}",
"\n",
"return",
"0",
"\n",
"}"
] | // GlobalInt looks up the value of a global IntFlag, returns
// 0 if not found | [
"GlobalInt",
"looks",
"up",
"the",
"value",
"of",
"a",
"global",
"IntFlag",
"returns",
"0",
"if",
"not",
"found"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/flag_generated.go#L332-L337 | train |
urfave/cli | flag_generated.go | IntSlice | func (c *Context) IntSlice(name string) []int {
return lookupIntSlice(name, c.flagSet)
} | go | func (c *Context) IntSlice(name string) []int {
return lookupIntSlice(name, c.flagSet)
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"IntSlice",
"(",
"name",
"string",
")",
"[",
"]",
"int",
"{",
"return",
"lookupIntSlice",
"(",
"name",
",",
"c",
".",
"flagSet",
")",
"\n",
"}"
] | // IntSlice looks up the value of a local IntSliceFlag, returns
// nil if not found | [
"IntSlice",
"looks",
"up",
"the",
"value",
"of",
"a",
"local",
"IntSliceFlag",
"returns",
"nil",
"if",
"not",
"found"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/flag_generated.go#L374-L376 | train |
urfave/cli | flag_generated.go | GlobalIntSlice | func (c *Context) GlobalIntSlice(name string) []int {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupIntSlice(name, fs)
}
return nil
} | go | func (c *Context) GlobalIntSlice(name string) []int {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupIntSlice(name, fs)
}
return nil
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"GlobalIntSlice",
"(",
"name",
"string",
")",
"[",
"]",
"int",
"{",
"if",
"fs",
":=",
"lookupGlobalFlagSet",
"(",
"name",
",",
"c",
")",
";",
"fs",
"!=",
"nil",
"{",
"return",
"lookupIntSlice",
"(",
"name",
",",
"fs",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // GlobalIntSlice looks up the value of a global IntSliceFlag, returns
// nil if not found | [
"GlobalIntSlice",
"looks",
"up",
"the",
"value",
"of",
"a",
"global",
"IntSliceFlag",
"returns",
"nil",
"if",
"not",
"found"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/flag_generated.go#L380-L385 | train |
urfave/cli | flag_generated.go | Int64Slice | func (c *Context) Int64Slice(name string) []int64 {
return lookupInt64Slice(name, c.flagSet)
} | go | func (c *Context) Int64Slice(name string) []int64 {
return lookupInt64Slice(name, c.flagSet)
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"Int64Slice",
"(",
"name",
"string",
")",
"[",
"]",
"int64",
"{",
"return",
"lookupInt64Slice",
"(",
"name",
",",
"c",
".",
"flagSet",
")",
"\n",
"}"
] | // Int64Slice looks up the value of a local Int64SliceFlag, returns
// nil if not found | [
"Int64Slice",
"looks",
"up",
"the",
"value",
"of",
"a",
"local",
"Int64SliceFlag",
"returns",
"nil",
"if",
"not",
"found"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/flag_generated.go#L422-L424 | train |
urfave/cli | flag_generated.go | GlobalInt64Slice | func (c *Context) GlobalInt64Slice(name string) []int64 {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupInt64Slice(name, fs)
}
return nil
} | go | func (c *Context) GlobalInt64Slice(name string) []int64 {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupInt64Slice(name, fs)
}
return nil
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"GlobalInt64Slice",
"(",
"name",
"string",
")",
"[",
"]",
"int64",
"{",
"if",
"fs",
":=",
"lookupGlobalFlagSet",
"(",
"name",
",",
"c",
")",
";",
"fs",
"!=",
"nil",
"{",
"return",
"lookupInt64Slice",
"(",
"name",
",",
"fs",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // GlobalInt64Slice looks up the value of a global Int64SliceFlag, returns
// nil if not found | [
"GlobalInt64Slice",
"looks",
"up",
"the",
"value",
"of",
"a",
"global",
"Int64SliceFlag",
"returns",
"nil",
"if",
"not",
"found"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/flag_generated.go#L428-L433 | train |
urfave/cli | flag_generated.go | String | func (c *Context) String(name string) string {
return lookupString(name, c.flagSet)
} | go | func (c *Context) String(name string) string {
return lookupString(name, c.flagSet)
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"String",
"(",
"name",
"string",
")",
"string",
"{",
"return",
"lookupString",
"(",
"name",
",",
"c",
".",
"flagSet",
")",
"\n",
"}"
] | // String looks up the value of a local StringFlag, returns
// "" if not found | [
"String",
"looks",
"up",
"the",
"value",
"of",
"a",
"local",
"StringFlag",
"returns",
"if",
"not",
"found"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/flag_generated.go#L471-L473 | train |
urfave/cli | flag_generated.go | GlobalString | func (c *Context) GlobalString(name string) string {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupString(name, fs)
}
return ""
} | go | func (c *Context) GlobalString(name string) string {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupString(name, fs)
}
return ""
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"GlobalString",
"(",
"name",
"string",
")",
"string",
"{",
"if",
"fs",
":=",
"lookupGlobalFlagSet",
"(",
"name",
",",
"c",
")",
";",
"fs",
"!=",
"nil",
"{",
"return",
"lookupString",
"(",
"name",
",",
"fs",
")",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
] | // GlobalString looks up the value of a global StringFlag, returns
// "" if not found | [
"GlobalString",
"looks",
"up",
"the",
"value",
"of",
"a",
"global",
"StringFlag",
"returns",
"if",
"not",
"found"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/flag_generated.go#L477-L482 | train |
urfave/cli | flag_generated.go | StringSlice | func (c *Context) StringSlice(name string) []string {
return lookupStringSlice(name, c.flagSet)
} | go | func (c *Context) StringSlice(name string) []string {
return lookupStringSlice(name, c.flagSet)
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"StringSlice",
"(",
"name",
"string",
")",
"[",
"]",
"string",
"{",
"return",
"lookupStringSlice",
"(",
"name",
",",
"c",
".",
"flagSet",
")",
"\n",
"}"
] | // StringSlice looks up the value of a local StringSliceFlag, returns
// nil if not found | [
"StringSlice",
"looks",
"up",
"the",
"value",
"of",
"a",
"local",
"StringSliceFlag",
"returns",
"nil",
"if",
"not",
"found"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/flag_generated.go#L519-L521 | train |
urfave/cli | flag_generated.go | GlobalStringSlice | func (c *Context) GlobalStringSlice(name string) []string {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupStringSlice(name, fs)
}
return nil
} | go | func (c *Context) GlobalStringSlice(name string) []string {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupStringSlice(name, fs)
}
return nil
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"GlobalStringSlice",
"(",
"name",
"string",
")",
"[",
"]",
"string",
"{",
"if",
"fs",
":=",
"lookupGlobalFlagSet",
"(",
"name",
",",
"c",
")",
";",
"fs",
"!=",
"nil",
"{",
"return",
"lookupStringSlice",
"(",
"name",
",",
"fs",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // GlobalStringSlice looks up the value of a global StringSliceFlag, returns
// nil if not found | [
"GlobalStringSlice",
"looks",
"up",
"the",
"value",
"of",
"a",
"global",
"StringSliceFlag",
"returns",
"nil",
"if",
"not",
"found"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/flag_generated.go#L525-L530 | train |
urfave/cli | flag_generated.go | Uint64 | func (c *Context) Uint64(name string) uint64 {
return lookupUint64(name, c.flagSet)
} | go | func (c *Context) Uint64(name string) uint64 {
return lookupUint64(name, c.flagSet)
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"Uint64",
"(",
"name",
"string",
")",
"uint64",
"{",
"return",
"lookupUint64",
"(",
"name",
",",
"c",
".",
"flagSet",
")",
"\n",
"}"
] | // Uint64 looks up the value of a local Uint64Flag, returns
// 0 if not found | [
"Uint64",
"looks",
"up",
"the",
"value",
"of",
"a",
"local",
"Uint64Flag",
"returns",
"0",
"if",
"not",
"found"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/flag_generated.go#L568-L570 | train |
urfave/cli | flag_generated.go | GlobalUint64 | func (c *Context) GlobalUint64(name string) uint64 {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupUint64(name, fs)
}
return 0
} | go | func (c *Context) GlobalUint64(name string) uint64 {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupUint64(name, fs)
}
return 0
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"GlobalUint64",
"(",
"name",
"string",
")",
"uint64",
"{",
"if",
"fs",
":=",
"lookupGlobalFlagSet",
"(",
"name",
",",
"c",
")",
";",
"fs",
"!=",
"nil",
"{",
"return",
"lookupUint64",
"(",
"name",
",",
"fs",
")",
"\n",
"}",
"\n",
"return",
"0",
"\n",
"}"
] | // GlobalUint64 looks up the value of a global Uint64Flag, returns
// 0 if not found | [
"GlobalUint64",
"looks",
"up",
"the",
"value",
"of",
"a",
"global",
"Uint64Flag",
"returns",
"0",
"if",
"not",
"found"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/flag_generated.go#L574-L579 | train |
urfave/cli | flag_generated.go | Uint | func (c *Context) Uint(name string) uint {
return lookupUint(name, c.flagSet)
} | go | func (c *Context) Uint(name string) uint {
return lookupUint(name, c.flagSet)
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"Uint",
"(",
"name",
"string",
")",
"uint",
"{",
"return",
"lookupUint",
"(",
"name",
",",
"c",
".",
"flagSet",
")",
"\n",
"}"
] | // Uint looks up the value of a local UintFlag, returns
// 0 if not found | [
"Uint",
"looks",
"up",
"the",
"value",
"of",
"a",
"local",
"UintFlag",
"returns",
"0",
"if",
"not",
"found"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/flag_generated.go#L617-L619 | train |
urfave/cli | flag_generated.go | GlobalUint | func (c *Context) GlobalUint(name string) uint {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupUint(name, fs)
}
return 0
} | go | func (c *Context) GlobalUint(name string) uint {
if fs := lookupGlobalFlagSet(name, c); fs != nil {
return lookupUint(name, fs)
}
return 0
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"GlobalUint",
"(",
"name",
"string",
")",
"uint",
"{",
"if",
"fs",
":=",
"lookupGlobalFlagSet",
"(",
"name",
",",
"c",
")",
";",
"fs",
"!=",
"nil",
"{",
"return",
"lookupUint",
"(",
"name",
",",
"fs",
")",
"\n",
"}",
"\n",
"return",
"0",
"\n",
"}"
] | // GlobalUint looks up the value of a global UintFlag, returns
// 0 if not found | [
"GlobalUint",
"looks",
"up",
"the",
"value",
"of",
"a",
"global",
"UintFlag",
"returns",
"0",
"if",
"not",
"found"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/flag_generated.go#L623-L628 | train |
urfave/cli | altsrc/map_input_source.go | nestedVal | func nestedVal(name string, tree map[interface{}]interface{}) (interface{}, bool) {
if sections := strings.Split(name, "."); len(sections) > 1 {
node := tree
for _, section := range sections[:len(sections)-1] {
child, ok := node[section]
if !ok {
return nil, false
}
ctype, ok := child.(map[interface{}]interface{})
if !ok {
return nil, false
}
node = ctype
}
if val, ok := node[sections[len(sections)-1]]; ok {
return val, true
}
}
return nil, false
} | go | func nestedVal(name string, tree map[interface{}]interface{}) (interface{}, bool) {
if sections := strings.Split(name, "."); len(sections) > 1 {
node := tree
for _, section := range sections[:len(sections)-1] {
child, ok := node[section]
if !ok {
return nil, false
}
ctype, ok := child.(map[interface{}]interface{})
if !ok {
return nil, false
}
node = ctype
}
if val, ok := node[sections[len(sections)-1]]; ok {
return val, true
}
}
return nil, false
} | [
"func",
"nestedVal",
"(",
"name",
"string",
",",
"tree",
"map",
"[",
"interface",
"{",
"}",
"]",
"interface",
"{",
"}",
")",
"(",
"interface",
"{",
"}",
",",
"bool",
")",
"{",
"if",
"sections",
":=",
"strings",
".",
"Split",
"(",
"name",
",",
"\"",
"\"",
")",
";",
"len",
"(",
"sections",
")",
">",
"1",
"{",
"node",
":=",
"tree",
"\n",
"for",
"_",
",",
"section",
":=",
"range",
"sections",
"[",
":",
"len",
"(",
"sections",
")",
"-",
"1",
"]",
"{",
"child",
",",
"ok",
":=",
"node",
"[",
"section",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"false",
"\n",
"}",
"\n",
"ctype",
",",
"ok",
":=",
"child",
".",
"(",
"map",
"[",
"interface",
"{",
"}",
"]",
"interface",
"{",
"}",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"false",
"\n",
"}",
"\n",
"node",
"=",
"ctype",
"\n",
"}",
"\n",
"if",
"val",
",",
"ok",
":=",
"node",
"[",
"sections",
"[",
"len",
"(",
"sections",
")",
"-",
"1",
"]",
"]",
";",
"ok",
"{",
"return",
"val",
",",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
",",
"false",
"\n",
"}"
] | // nestedVal checks if the name has '.' delimiters.
// If so, it tries to traverse the tree by the '.' delimited sections to find
// a nested value for the key. | [
"nestedVal",
"checks",
"if",
"the",
"name",
"has",
".",
"delimiters",
".",
"If",
"so",
"it",
"tries",
"to",
"traverse",
"the",
"tree",
"by",
"the",
".",
"delimited",
"sections",
"to",
"find",
"a",
"nested",
"value",
"for",
"the",
"key",
"."
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/map_input_source.go#L21-L40 | train |
urfave/cli | altsrc/map_input_source.go | Int | func (fsm *MapInputSource) Int(name string) (int, error) {
otherGenericValue, exists := fsm.valueMap[name]
if exists {
otherValue, isType := otherGenericValue.(int)
if !isType {
return 0, incorrectTypeForFlagError(name, "int", otherGenericValue)
}
return otherValue, nil
}
nestedGenericValue, exists := nestedVal(name, fsm.valueMap)
if exists {
otherValue, isType := nestedGenericValue.(int)
if !isType {
return 0, incorrectTypeForFlagError(name, "int", nestedGenericValue)
}
return otherValue, nil
}
return 0, nil
} | go | func (fsm *MapInputSource) Int(name string) (int, error) {
otherGenericValue, exists := fsm.valueMap[name]
if exists {
otherValue, isType := otherGenericValue.(int)
if !isType {
return 0, incorrectTypeForFlagError(name, "int", otherGenericValue)
}
return otherValue, nil
}
nestedGenericValue, exists := nestedVal(name, fsm.valueMap)
if exists {
otherValue, isType := nestedGenericValue.(int)
if !isType {
return 0, incorrectTypeForFlagError(name, "int", nestedGenericValue)
}
return otherValue, nil
}
return 0, nil
} | [
"func",
"(",
"fsm",
"*",
"MapInputSource",
")",
"Int",
"(",
"name",
"string",
")",
"(",
"int",
",",
"error",
")",
"{",
"otherGenericValue",
",",
"exists",
":=",
"fsm",
".",
"valueMap",
"[",
"name",
"]",
"\n",
"if",
"exists",
"{",
"otherValue",
",",
"isType",
":=",
"otherGenericValue",
".",
"(",
"int",
")",
"\n",
"if",
"!",
"isType",
"{",
"return",
"0",
",",
"incorrectTypeForFlagError",
"(",
"name",
",",
"\"",
"\"",
",",
"otherGenericValue",
")",
"\n",
"}",
"\n",
"return",
"otherValue",
",",
"nil",
"\n",
"}",
"\n",
"nestedGenericValue",
",",
"exists",
":=",
"nestedVal",
"(",
"name",
",",
"fsm",
".",
"valueMap",
")",
"\n",
"if",
"exists",
"{",
"otherValue",
",",
"isType",
":=",
"nestedGenericValue",
".",
"(",
"int",
")",
"\n",
"if",
"!",
"isType",
"{",
"return",
"0",
",",
"incorrectTypeForFlagError",
"(",
"name",
",",
"\"",
"\"",
",",
"nestedGenericValue",
")",
"\n",
"}",
"\n",
"return",
"otherValue",
",",
"nil",
"\n",
"}",
"\n\n",
"return",
"0",
",",
"nil",
"\n",
"}"
] | // Int returns an int from the map if it exists otherwise returns 0 | [
"Int",
"returns",
"an",
"int",
"from",
"the",
"map",
"if",
"it",
"exists",
"otherwise",
"returns",
"0"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/map_input_source.go#L43-L62 | train |
urfave/cli | altsrc/map_input_source.go | Bool | func (fsm *MapInputSource) Bool(name string) (bool, error) {
otherGenericValue, exists := fsm.valueMap[name]
if exists {
otherValue, isType := otherGenericValue.(bool)
if !isType {
return false, incorrectTypeForFlagError(name, "bool", otherGenericValue)
}
return otherValue, nil
}
nestedGenericValue, exists := nestedVal(name, fsm.valueMap)
if exists {
otherValue, isType := nestedGenericValue.(bool)
if !isType {
return false, incorrectTypeForFlagError(name, "bool", nestedGenericValue)
}
return otherValue, nil
}
return false, nil
} | go | func (fsm *MapInputSource) Bool(name string) (bool, error) {
otherGenericValue, exists := fsm.valueMap[name]
if exists {
otherValue, isType := otherGenericValue.(bool)
if !isType {
return false, incorrectTypeForFlagError(name, "bool", otherGenericValue)
}
return otherValue, nil
}
nestedGenericValue, exists := nestedVal(name, fsm.valueMap)
if exists {
otherValue, isType := nestedGenericValue.(bool)
if !isType {
return false, incorrectTypeForFlagError(name, "bool", nestedGenericValue)
}
return otherValue, nil
}
return false, nil
} | [
"func",
"(",
"fsm",
"*",
"MapInputSource",
")",
"Bool",
"(",
"name",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"otherGenericValue",
",",
"exists",
":=",
"fsm",
".",
"valueMap",
"[",
"name",
"]",
"\n",
"if",
"exists",
"{",
"otherValue",
",",
"isType",
":=",
"otherGenericValue",
".",
"(",
"bool",
")",
"\n",
"if",
"!",
"isType",
"{",
"return",
"false",
",",
"incorrectTypeForFlagError",
"(",
"name",
",",
"\"",
"\"",
",",
"otherGenericValue",
")",
"\n",
"}",
"\n",
"return",
"otherValue",
",",
"nil",
"\n",
"}",
"\n",
"nestedGenericValue",
",",
"exists",
":=",
"nestedVal",
"(",
"name",
",",
"fsm",
".",
"valueMap",
")",
"\n",
"if",
"exists",
"{",
"otherValue",
",",
"isType",
":=",
"nestedGenericValue",
".",
"(",
"bool",
")",
"\n",
"if",
"!",
"isType",
"{",
"return",
"false",
",",
"incorrectTypeForFlagError",
"(",
"name",
",",
"\"",
"\"",
",",
"nestedGenericValue",
")",
"\n",
"}",
"\n",
"return",
"otherValue",
",",
"nil",
"\n",
"}",
"\n\n",
"return",
"false",
",",
"nil",
"\n",
"}"
] | // Bool returns an bool from the map otherwise returns false | [
"Bool",
"returns",
"an",
"bool",
"from",
"the",
"map",
"otherwise",
"returns",
"false"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/map_input_source.go#L211-L230 | train |
urfave/cli | altsrc/map_input_source.go | BoolT | func (fsm *MapInputSource) BoolT(name string) (bool, error) {
otherGenericValue, exists := fsm.valueMap[name]
if exists {
otherValue, isType := otherGenericValue.(bool)
if !isType {
return true, incorrectTypeForFlagError(name, "bool", otherGenericValue)
}
return otherValue, nil
}
nestedGenericValue, exists := nestedVal(name, fsm.valueMap)
if exists {
otherValue, isType := nestedGenericValue.(bool)
if !isType {
return true, incorrectTypeForFlagError(name, "bool", nestedGenericValue)
}
return otherValue, nil
}
return true, nil
} | go | func (fsm *MapInputSource) BoolT(name string) (bool, error) {
otherGenericValue, exists := fsm.valueMap[name]
if exists {
otherValue, isType := otherGenericValue.(bool)
if !isType {
return true, incorrectTypeForFlagError(name, "bool", otherGenericValue)
}
return otherValue, nil
}
nestedGenericValue, exists := nestedVal(name, fsm.valueMap)
if exists {
otherValue, isType := nestedGenericValue.(bool)
if !isType {
return true, incorrectTypeForFlagError(name, "bool", nestedGenericValue)
}
return otherValue, nil
}
return true, nil
} | [
"func",
"(",
"fsm",
"*",
"MapInputSource",
")",
"BoolT",
"(",
"name",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"otherGenericValue",
",",
"exists",
":=",
"fsm",
".",
"valueMap",
"[",
"name",
"]",
"\n",
"if",
"exists",
"{",
"otherValue",
",",
"isType",
":=",
"otherGenericValue",
".",
"(",
"bool",
")",
"\n",
"if",
"!",
"isType",
"{",
"return",
"true",
",",
"incorrectTypeForFlagError",
"(",
"name",
",",
"\"",
"\"",
",",
"otherGenericValue",
")",
"\n",
"}",
"\n",
"return",
"otherValue",
",",
"nil",
"\n",
"}",
"\n",
"nestedGenericValue",
",",
"exists",
":=",
"nestedVal",
"(",
"name",
",",
"fsm",
".",
"valueMap",
")",
"\n",
"if",
"exists",
"{",
"otherValue",
",",
"isType",
":=",
"nestedGenericValue",
".",
"(",
"bool",
")",
"\n",
"if",
"!",
"isType",
"{",
"return",
"true",
",",
"incorrectTypeForFlagError",
"(",
"name",
",",
"\"",
"\"",
",",
"nestedGenericValue",
")",
"\n",
"}",
"\n",
"return",
"otherValue",
",",
"nil",
"\n",
"}",
"\n\n",
"return",
"true",
",",
"nil",
"\n",
"}"
] | // BoolT returns an bool from the map otherwise returns true | [
"BoolT",
"returns",
"an",
"bool",
"from",
"the",
"map",
"otherwise",
"returns",
"true"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/map_input_source.go#L233-L252 | train |
urfave/cli | altsrc/yaml_file_loader.go | NewYamlSourceFromFile | func NewYamlSourceFromFile(file string) (InputSourceContext, error) {
ysc := &yamlSourceContext{FilePath: file}
var results map[interface{}]interface{}
err := readCommandYaml(ysc.FilePath, &results)
if err != nil {
return nil, fmt.Errorf("Unable to load Yaml file '%s': inner error: \n'%v'", ysc.FilePath, err.Error())
}
return &MapInputSource{valueMap: results}, nil
} | go | func NewYamlSourceFromFile(file string) (InputSourceContext, error) {
ysc := &yamlSourceContext{FilePath: file}
var results map[interface{}]interface{}
err := readCommandYaml(ysc.FilePath, &results)
if err != nil {
return nil, fmt.Errorf("Unable to load Yaml file '%s': inner error: \n'%v'", ysc.FilePath, err.Error())
}
return &MapInputSource{valueMap: results}, nil
} | [
"func",
"NewYamlSourceFromFile",
"(",
"file",
"string",
")",
"(",
"InputSourceContext",
",",
"error",
")",
"{",
"ysc",
":=",
"&",
"yamlSourceContext",
"{",
"FilePath",
":",
"file",
"}",
"\n",
"var",
"results",
"map",
"[",
"interface",
"{",
"}",
"]",
"interface",
"{",
"}",
"\n",
"err",
":=",
"readCommandYaml",
"(",
"ysc",
".",
"FilePath",
",",
"&",
"results",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\n",
"\"",
",",
"ysc",
".",
"FilePath",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"MapInputSource",
"{",
"valueMap",
":",
"results",
"}",
",",
"nil",
"\n",
"}"
] | // NewYamlSourceFromFile creates a new Yaml InputSourceContext from a filepath. | [
"NewYamlSourceFromFile",
"creates",
"a",
"new",
"Yaml",
"InputSourceContext",
"from",
"a",
"filepath",
"."
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/yaml_file_loader.go#L27-L36 | train |
urfave/cli | altsrc/yaml_file_loader.go | NewYamlSourceFromFlagFunc | func NewYamlSourceFromFlagFunc(flagFileName string) func(context *cli.Context) (InputSourceContext, error) {
return func(context *cli.Context) (InputSourceContext, error) {
filePath := context.String(flagFileName)
return NewYamlSourceFromFile(filePath)
}
} | go | func NewYamlSourceFromFlagFunc(flagFileName string) func(context *cli.Context) (InputSourceContext, error) {
return func(context *cli.Context) (InputSourceContext, error) {
filePath := context.String(flagFileName)
return NewYamlSourceFromFile(filePath)
}
} | [
"func",
"NewYamlSourceFromFlagFunc",
"(",
"flagFileName",
"string",
")",
"func",
"(",
"context",
"*",
"cli",
".",
"Context",
")",
"(",
"InputSourceContext",
",",
"error",
")",
"{",
"return",
"func",
"(",
"context",
"*",
"cli",
".",
"Context",
")",
"(",
"InputSourceContext",
",",
"error",
")",
"{",
"filePath",
":=",
"context",
".",
"String",
"(",
"flagFileName",
")",
"\n",
"return",
"NewYamlSourceFromFile",
"(",
"filePath",
")",
"\n",
"}",
"\n",
"}"
] | // NewYamlSourceFromFlagFunc creates a new Yaml InputSourceContext from a provided flag name and source context. | [
"NewYamlSourceFromFlagFunc",
"creates",
"a",
"new",
"Yaml",
"InputSourceContext",
"from",
"a",
"provided",
"flag",
"name",
"and",
"source",
"context",
"."
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/yaml_file_loader.go#L39-L44 | train |
urfave/cli | sort.go | lexicographicLess | func lexicographicLess(i, j string) bool {
iRunes := []rune(i)
jRunes := []rune(j)
lenShared := len(iRunes)
if lenShared > len(jRunes) {
lenShared = len(jRunes)
}
for index := 0; index < lenShared; index++ {
ir := iRunes[index]
jr := jRunes[index]
if lir, ljr := unicode.ToLower(ir), unicode.ToLower(jr); lir != ljr {
return lir < ljr
}
if ir != jr {
return ir < jr
}
}
return i < j
} | go | func lexicographicLess(i, j string) bool {
iRunes := []rune(i)
jRunes := []rune(j)
lenShared := len(iRunes)
if lenShared > len(jRunes) {
lenShared = len(jRunes)
}
for index := 0; index < lenShared; index++ {
ir := iRunes[index]
jr := jRunes[index]
if lir, ljr := unicode.ToLower(ir), unicode.ToLower(jr); lir != ljr {
return lir < ljr
}
if ir != jr {
return ir < jr
}
}
return i < j
} | [
"func",
"lexicographicLess",
"(",
"i",
",",
"j",
"string",
")",
"bool",
"{",
"iRunes",
":=",
"[",
"]",
"rune",
"(",
"i",
")",
"\n",
"jRunes",
":=",
"[",
"]",
"rune",
"(",
"j",
")",
"\n\n",
"lenShared",
":=",
"len",
"(",
"iRunes",
")",
"\n",
"if",
"lenShared",
">",
"len",
"(",
"jRunes",
")",
"{",
"lenShared",
"=",
"len",
"(",
"jRunes",
")",
"\n",
"}",
"\n\n",
"for",
"index",
":=",
"0",
";",
"index",
"<",
"lenShared",
";",
"index",
"++",
"{",
"ir",
":=",
"iRunes",
"[",
"index",
"]",
"\n",
"jr",
":=",
"jRunes",
"[",
"index",
"]",
"\n\n",
"if",
"lir",
",",
"ljr",
":=",
"unicode",
".",
"ToLower",
"(",
"ir",
")",
",",
"unicode",
".",
"ToLower",
"(",
"jr",
")",
";",
"lir",
"!=",
"ljr",
"{",
"return",
"lir",
"<",
"ljr",
"\n",
"}",
"\n\n",
"if",
"ir",
"!=",
"jr",
"{",
"return",
"ir",
"<",
"jr",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"i",
"<",
"j",
"\n",
"}"
] | // lexicographicLess compares strings alphabetically considering case. | [
"lexicographicLess",
"compares",
"strings",
"alphabetically",
"considering",
"case",
"."
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/sort.go#L6-L29 | train |
urfave/cli | app.go | compileTime | func compileTime() time.Time {
info, err := os.Stat(os.Args[0])
if err != nil {
return time.Now()
}
return info.ModTime()
} | go | func compileTime() time.Time {
info, err := os.Stat(os.Args[0])
if err != nil {
return time.Now()
}
return info.ModTime()
} | [
"func",
"compileTime",
"(",
")",
"time",
".",
"Time",
"{",
"info",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"os",
".",
"Args",
"[",
"0",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"time",
".",
"Now",
"(",
")",
"\n",
"}",
"\n",
"return",
"info",
".",
"ModTime",
"(",
")",
"\n",
"}"
] | // Tries to find out when this binary was compiled.
// Returns the current time if it fails to find it. | [
"Tries",
"to",
"find",
"out",
"when",
"this",
"binary",
"was",
"compiled",
".",
"Returns",
"the",
"current",
"time",
"if",
"it",
"fails",
"to",
"find",
"it",
"."
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/app.go#L103-L109 | train |
urfave/cli | app.go | NewApp | func NewApp() *App {
return &App{
Name: filepath.Base(os.Args[0]),
HelpName: filepath.Base(os.Args[0]),
Usage: "A new cli application",
UsageText: "",
Version: "0.0.0",
BashComplete: DefaultAppComplete,
Action: helpCommand.Action,
Compiled: compileTime(),
Writer: os.Stdout,
}
} | go | func NewApp() *App {
return &App{
Name: filepath.Base(os.Args[0]),
HelpName: filepath.Base(os.Args[0]),
Usage: "A new cli application",
UsageText: "",
Version: "0.0.0",
BashComplete: DefaultAppComplete,
Action: helpCommand.Action,
Compiled: compileTime(),
Writer: os.Stdout,
}
} | [
"func",
"NewApp",
"(",
")",
"*",
"App",
"{",
"return",
"&",
"App",
"{",
"Name",
":",
"filepath",
".",
"Base",
"(",
"os",
".",
"Args",
"[",
"0",
"]",
")",
",",
"HelpName",
":",
"filepath",
".",
"Base",
"(",
"os",
".",
"Args",
"[",
"0",
"]",
")",
",",
"Usage",
":",
"\"",
"\"",
",",
"UsageText",
":",
"\"",
"\"",
",",
"Version",
":",
"\"",
"\"",
",",
"BashComplete",
":",
"DefaultAppComplete",
",",
"Action",
":",
"helpCommand",
".",
"Action",
",",
"Compiled",
":",
"compileTime",
"(",
")",
",",
"Writer",
":",
"os",
".",
"Stdout",
",",
"}",
"\n",
"}"
] | // NewApp creates a new cli Application with some reasonable defaults for Name,
// Usage, Version and Action. | [
"NewApp",
"creates",
"a",
"new",
"cli",
"Application",
"with",
"some",
"reasonable",
"defaults",
"for",
"Name",
"Usage",
"Version",
"and",
"Action",
"."
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/app.go#L113-L125 | train |
urfave/cli | app.go | Setup | func (a *App) Setup() {
if a.didSetup {
return
}
a.didSetup = true
if a.Author != "" || a.Email != "" {
a.Authors = append(a.Authors, Author{Name: a.Author, Email: a.Email})
}
newCmds := []Command{}
for _, c := range a.Commands {
if c.HelpName == "" {
c.HelpName = fmt.Sprintf("%s %s", a.HelpName, c.Name)
}
newCmds = append(newCmds, c)
}
a.Commands = newCmds
if a.Command(helpCommand.Name) == nil && !a.HideHelp {
a.Commands = append(a.Commands, helpCommand)
if (HelpFlag != BoolFlag{}) {
a.appendFlag(HelpFlag)
}
}
if !a.HideVersion {
a.appendFlag(VersionFlag)
}
a.categories = CommandCategories{}
for _, command := range a.Commands {
a.categories = a.categories.AddCommand(command.Category, command)
}
sort.Sort(a.categories)
if a.Metadata == nil {
a.Metadata = make(map[string]interface{})
}
if a.Writer == nil {
a.Writer = os.Stdout
}
} | go | func (a *App) Setup() {
if a.didSetup {
return
}
a.didSetup = true
if a.Author != "" || a.Email != "" {
a.Authors = append(a.Authors, Author{Name: a.Author, Email: a.Email})
}
newCmds := []Command{}
for _, c := range a.Commands {
if c.HelpName == "" {
c.HelpName = fmt.Sprintf("%s %s", a.HelpName, c.Name)
}
newCmds = append(newCmds, c)
}
a.Commands = newCmds
if a.Command(helpCommand.Name) == nil && !a.HideHelp {
a.Commands = append(a.Commands, helpCommand)
if (HelpFlag != BoolFlag{}) {
a.appendFlag(HelpFlag)
}
}
if !a.HideVersion {
a.appendFlag(VersionFlag)
}
a.categories = CommandCategories{}
for _, command := range a.Commands {
a.categories = a.categories.AddCommand(command.Category, command)
}
sort.Sort(a.categories)
if a.Metadata == nil {
a.Metadata = make(map[string]interface{})
}
if a.Writer == nil {
a.Writer = os.Stdout
}
} | [
"func",
"(",
"a",
"*",
"App",
")",
"Setup",
"(",
")",
"{",
"if",
"a",
".",
"didSetup",
"{",
"return",
"\n",
"}",
"\n\n",
"a",
".",
"didSetup",
"=",
"true",
"\n\n",
"if",
"a",
".",
"Author",
"!=",
"\"",
"\"",
"||",
"a",
".",
"Email",
"!=",
"\"",
"\"",
"{",
"a",
".",
"Authors",
"=",
"append",
"(",
"a",
".",
"Authors",
",",
"Author",
"{",
"Name",
":",
"a",
".",
"Author",
",",
"Email",
":",
"a",
".",
"Email",
"}",
")",
"\n",
"}",
"\n\n",
"newCmds",
":=",
"[",
"]",
"Command",
"{",
"}",
"\n",
"for",
"_",
",",
"c",
":=",
"range",
"a",
".",
"Commands",
"{",
"if",
"c",
".",
"HelpName",
"==",
"\"",
"\"",
"{",
"c",
".",
"HelpName",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"a",
".",
"HelpName",
",",
"c",
".",
"Name",
")",
"\n",
"}",
"\n",
"newCmds",
"=",
"append",
"(",
"newCmds",
",",
"c",
")",
"\n",
"}",
"\n",
"a",
".",
"Commands",
"=",
"newCmds",
"\n\n",
"if",
"a",
".",
"Command",
"(",
"helpCommand",
".",
"Name",
")",
"==",
"nil",
"&&",
"!",
"a",
".",
"HideHelp",
"{",
"a",
".",
"Commands",
"=",
"append",
"(",
"a",
".",
"Commands",
",",
"helpCommand",
")",
"\n",
"if",
"(",
"HelpFlag",
"!=",
"BoolFlag",
"{",
"}",
")",
"{",
"a",
".",
"appendFlag",
"(",
"HelpFlag",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"!",
"a",
".",
"HideVersion",
"{",
"a",
".",
"appendFlag",
"(",
"VersionFlag",
")",
"\n",
"}",
"\n\n",
"a",
".",
"categories",
"=",
"CommandCategories",
"{",
"}",
"\n",
"for",
"_",
",",
"command",
":=",
"range",
"a",
".",
"Commands",
"{",
"a",
".",
"categories",
"=",
"a",
".",
"categories",
".",
"AddCommand",
"(",
"command",
".",
"Category",
",",
"command",
")",
"\n",
"}",
"\n",
"sort",
".",
"Sort",
"(",
"a",
".",
"categories",
")",
"\n\n",
"if",
"a",
".",
"Metadata",
"==",
"nil",
"{",
"a",
".",
"Metadata",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"}",
"\n\n",
"if",
"a",
".",
"Writer",
"==",
"nil",
"{",
"a",
".",
"Writer",
"=",
"os",
".",
"Stdout",
"\n",
"}",
"\n",
"}"
] | // Setup runs initialization code to ensure all data structures are ready for
// `Run` or inspection prior to `Run`. It is internally called by `Run`, but
// will return early if setup has already happened. | [
"Setup",
"runs",
"initialization",
"code",
"to",
"ensure",
"all",
"data",
"structures",
"are",
"ready",
"for",
"Run",
"or",
"inspection",
"prior",
"to",
"Run",
".",
"It",
"is",
"internally",
"called",
"by",
"Run",
"but",
"will",
"return",
"early",
"if",
"setup",
"has",
"already",
"happened",
"."
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/app.go#L130-L174 | train |
urfave/cli | app.go | Command | func (a *App) Command(name string) *Command {
for _, c := range a.Commands {
if c.HasName(name) {
return &c
}
}
return nil
} | go | func (a *App) Command(name string) *Command {
for _, c := range a.Commands {
if c.HasName(name) {
return &c
}
}
return nil
} | [
"func",
"(",
"a",
"*",
"App",
")",
"Command",
"(",
"name",
"string",
")",
"*",
"Command",
"{",
"for",
"_",
",",
"c",
":=",
"range",
"a",
".",
"Commands",
"{",
"if",
"c",
".",
"HasName",
"(",
"name",
")",
"{",
"return",
"&",
"c",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] | // Command returns the named command on App. Returns nil if the command does not exist | [
"Command",
"returns",
"the",
"named",
"command",
"on",
"App",
".",
"Returns",
"nil",
"if",
"the",
"command",
"does",
"not",
"exist"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/app.go#L395-L403 | train |
urfave/cli | app.go | VisibleCategories | func (a *App) VisibleCategories() []*CommandCategory {
ret := []*CommandCategory{}
for _, category := range a.categories {
if visible := func() *CommandCategory {
for _, command := range category.Commands {
if !command.Hidden {
return category
}
}
return nil
}(); visible != nil {
ret = append(ret, visible)
}
}
return ret
} | go | func (a *App) VisibleCategories() []*CommandCategory {
ret := []*CommandCategory{}
for _, category := range a.categories {
if visible := func() *CommandCategory {
for _, command := range category.Commands {
if !command.Hidden {
return category
}
}
return nil
}(); visible != nil {
ret = append(ret, visible)
}
}
return ret
} | [
"func",
"(",
"a",
"*",
"App",
")",
"VisibleCategories",
"(",
")",
"[",
"]",
"*",
"CommandCategory",
"{",
"ret",
":=",
"[",
"]",
"*",
"CommandCategory",
"{",
"}",
"\n",
"for",
"_",
",",
"category",
":=",
"range",
"a",
".",
"categories",
"{",
"if",
"visible",
":=",
"func",
"(",
")",
"*",
"CommandCategory",
"{",
"for",
"_",
",",
"command",
":=",
"range",
"category",
".",
"Commands",
"{",
"if",
"!",
"command",
".",
"Hidden",
"{",
"return",
"category",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
"(",
")",
";",
"visible",
"!=",
"nil",
"{",
"ret",
"=",
"append",
"(",
"ret",
",",
"visible",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"ret",
"\n",
"}"
] | // VisibleCategories returns a slice of categories and commands that are
// Hidden=false | [
"VisibleCategories",
"returns",
"a",
"slice",
"of",
"categories",
"and",
"commands",
"that",
"are",
"Hidden",
"=",
"false"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/app.go#L412-L427 | train |
urfave/cli | app.go | String | func (a Author) String() string {
e := ""
if a.Email != "" {
e = " <" + a.Email + ">"
}
return fmt.Sprintf("%v%v", a.Name, e)
} | go | func (a Author) String() string {
e := ""
if a.Email != "" {
e = " <" + a.Email + ">"
}
return fmt.Sprintf("%v%v", a.Name, e)
} | [
"func",
"(",
"a",
"Author",
")",
"String",
"(",
")",
"string",
"{",
"e",
":=",
"\"",
"\"",
"\n",
"if",
"a",
".",
"Email",
"!=",
"\"",
"\"",
"{",
"e",
"=",
"\"",
"\"",
"+",
"a",
".",
"Email",
"+",
"\"",
"\"",
"\n",
"}",
"\n\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"a",
".",
"Name",
",",
"e",
")",
"\n",
"}"
] | // String makes Author comply to the Stringer interface, to allow an easy print in the templating process | [
"String",
"makes",
"Author",
"comply",
"to",
"the",
"Stringer",
"interface",
"to",
"allow",
"an",
"easy",
"print",
"in",
"the",
"templating",
"process"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/app.go#L485-L492 | train |
urfave/cli | app.go | HandleAction | func HandleAction(action interface{}, context *Context) (err error) {
switch a := action.(type) {
case ActionFunc:
return a(context)
case func(*Context) error:
return a(context)
case func(*Context): // deprecated function signature
a(context)
return nil
}
return errInvalidActionType
} | go | func HandleAction(action interface{}, context *Context) (err error) {
switch a := action.(type) {
case ActionFunc:
return a(context)
case func(*Context) error:
return a(context)
case func(*Context): // deprecated function signature
a(context)
return nil
}
return errInvalidActionType
} | [
"func",
"HandleAction",
"(",
"action",
"interface",
"{",
"}",
",",
"context",
"*",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"switch",
"a",
":=",
"action",
".",
"(",
"type",
")",
"{",
"case",
"ActionFunc",
":",
"return",
"a",
"(",
"context",
")",
"\n",
"case",
"func",
"(",
"*",
"Context",
")",
"error",
":",
"return",
"a",
"(",
"context",
")",
"\n",
"case",
"func",
"(",
"*",
"Context",
")",
":",
"// deprecated function signature",
"a",
"(",
"context",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"errInvalidActionType",
"\n",
"}"
] | // HandleAction attempts to figure out which Action signature was used. If
// it's an ActionFunc or a func with the legacy signature for Action, the func
// is run! | [
"HandleAction",
"attempts",
"to",
"figure",
"out",
"which",
"Action",
"signature",
"was",
"used",
".",
"If",
"it",
"s",
"an",
"ActionFunc",
"or",
"a",
"func",
"with",
"the",
"legacy",
"signature",
"for",
"Action",
"the",
"func",
"is",
"run!"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/app.go#L497-L509 | train |
urfave/cli | altsrc/flag.go | ApplyInputSourceValues | func ApplyInputSourceValues(context *cli.Context, inputSourceContext InputSourceContext, flags []cli.Flag) error {
for _, f := range flags {
inputSourceExtendedFlag, isType := f.(FlagInputSourceExtension)
if isType {
err := inputSourceExtendedFlag.ApplyInputSourceValue(context, inputSourceContext)
if err != nil {
return err
}
}
}
return nil
} | go | func ApplyInputSourceValues(context *cli.Context, inputSourceContext InputSourceContext, flags []cli.Flag) error {
for _, f := range flags {
inputSourceExtendedFlag, isType := f.(FlagInputSourceExtension)
if isType {
err := inputSourceExtendedFlag.ApplyInputSourceValue(context, inputSourceContext)
if err != nil {
return err
}
}
}
return nil
} | [
"func",
"ApplyInputSourceValues",
"(",
"context",
"*",
"cli",
".",
"Context",
",",
"inputSourceContext",
"InputSourceContext",
",",
"flags",
"[",
"]",
"cli",
".",
"Flag",
")",
"error",
"{",
"for",
"_",
",",
"f",
":=",
"range",
"flags",
"{",
"inputSourceExtendedFlag",
",",
"isType",
":=",
"f",
".",
"(",
"FlagInputSourceExtension",
")",
"\n",
"if",
"isType",
"{",
"err",
":=",
"inputSourceExtendedFlag",
".",
"ApplyInputSourceValue",
"(",
"context",
",",
"inputSourceContext",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] | // ApplyInputSourceValues iterates over all provided flags and
// executes ApplyInputSourceValue on flags implementing the
// FlagInputSourceExtension interface to initialize these flags
// to an alternate input source. | [
"ApplyInputSourceValues",
"iterates",
"over",
"all",
"provided",
"flags",
"and",
"executes",
"ApplyInputSourceValue",
"on",
"flags",
"implementing",
"the",
"FlagInputSourceExtension",
"interface",
"to",
"initialize",
"these",
"flags",
"to",
"an",
"alternate",
"input",
"source",
"."
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag.go#L23-L35 | train |
urfave/cli | altsrc/flag.go | InitInputSource | func InitInputSource(flags []cli.Flag, createInputSource func() (InputSourceContext, error)) cli.BeforeFunc {
return func(context *cli.Context) error {
inputSource, err := createInputSource()
if err != nil {
return fmt.Errorf("Unable to create input source: inner error: \n'%v'", err.Error())
}
return ApplyInputSourceValues(context, inputSource, flags)
}
} | go | func InitInputSource(flags []cli.Flag, createInputSource func() (InputSourceContext, error)) cli.BeforeFunc {
return func(context *cli.Context) error {
inputSource, err := createInputSource()
if err != nil {
return fmt.Errorf("Unable to create input source: inner error: \n'%v'", err.Error())
}
return ApplyInputSourceValues(context, inputSource, flags)
}
} | [
"func",
"InitInputSource",
"(",
"flags",
"[",
"]",
"cli",
".",
"Flag",
",",
"createInputSource",
"func",
"(",
")",
"(",
"InputSourceContext",
",",
"error",
")",
")",
"cli",
".",
"BeforeFunc",
"{",
"return",
"func",
"(",
"context",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"inputSource",
",",
"err",
":=",
"createInputSource",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\n",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n\n",
"return",
"ApplyInputSourceValues",
"(",
"context",
",",
"inputSource",
",",
"flags",
")",
"\n",
"}",
"\n",
"}"
] | // InitInputSource is used to to setup an InputSourceContext on a cli.Command Before method. It will create a new
// input source based on the func provided. If there is no error it will then apply the new input source to any flags
// that are supported by the input source | [
"InitInputSource",
"is",
"used",
"to",
"to",
"setup",
"an",
"InputSourceContext",
"on",
"a",
"cli",
".",
"Command",
"Before",
"method",
".",
"It",
"will",
"create",
"a",
"new",
"input",
"source",
"based",
"on",
"the",
"func",
"provided",
".",
"If",
"there",
"is",
"no",
"error",
"it",
"will",
"then",
"apply",
"the",
"new",
"input",
"source",
"to",
"any",
"flags",
"that",
"are",
"supported",
"by",
"the",
"input",
"source"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag.go#L40-L49 | train |
urfave/cli | altsrc/flag.go | ApplyInputSourceValue | func (f *GenericFlag) ApplyInputSourceValue(context *cli.Context, isc InputSourceContext) error {
if f.set != nil {
if !context.IsSet(f.Name) && !isEnvVarSet(f.EnvVar) {
value, err := isc.Generic(f.GenericFlag.Name)
if err != nil {
return err
}
if value != nil {
eachName(f.Name, func(name string) {
f.set.Set(f.Name, value.String())
})
}
}
}
return nil
} | go | func (f *GenericFlag) ApplyInputSourceValue(context *cli.Context, isc InputSourceContext) error {
if f.set != nil {
if !context.IsSet(f.Name) && !isEnvVarSet(f.EnvVar) {
value, err := isc.Generic(f.GenericFlag.Name)
if err != nil {
return err
}
if value != nil {
eachName(f.Name, func(name string) {
f.set.Set(f.Name, value.String())
})
}
}
}
return nil
} | [
"func",
"(",
"f",
"*",
"GenericFlag",
")",
"ApplyInputSourceValue",
"(",
"context",
"*",
"cli",
".",
"Context",
",",
"isc",
"InputSourceContext",
")",
"error",
"{",
"if",
"f",
".",
"set",
"!=",
"nil",
"{",
"if",
"!",
"context",
".",
"IsSet",
"(",
"f",
".",
"Name",
")",
"&&",
"!",
"isEnvVarSet",
"(",
"f",
".",
"EnvVar",
")",
"{",
"value",
",",
"err",
":=",
"isc",
".",
"Generic",
"(",
"f",
".",
"GenericFlag",
".",
"Name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"value",
"!=",
"nil",
"{",
"eachName",
"(",
"f",
".",
"Name",
",",
"func",
"(",
"name",
"string",
")",
"{",
"f",
".",
"set",
".",
"Set",
"(",
"f",
".",
"Name",
",",
"value",
".",
"String",
"(",
")",
")",
"\n",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] | // ApplyInputSourceValue applies a generic value to the flagSet if required | [
"ApplyInputSourceValue",
"applies",
"a",
"generic",
"value",
"to",
"the",
"flagSet",
"if",
"required"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag.go#L66-L82 | train |
urfave/cli | altsrc/flag.go | ApplyInputSourceValue | func (f *StringSliceFlag) ApplyInputSourceValue(context *cli.Context, isc InputSourceContext) error {
if f.set != nil {
if !context.IsSet(f.Name) && !isEnvVarSet(f.EnvVar) {
value, err := isc.StringSlice(f.StringSliceFlag.Name)
if err != nil {
return err
}
if value != nil {
var sliceValue cli.StringSlice = value
eachName(f.Name, func(name string) {
underlyingFlag := f.set.Lookup(f.Name)
if underlyingFlag != nil {
underlyingFlag.Value = &sliceValue
}
})
}
}
}
return nil
} | go | func (f *StringSliceFlag) ApplyInputSourceValue(context *cli.Context, isc InputSourceContext) error {
if f.set != nil {
if !context.IsSet(f.Name) && !isEnvVarSet(f.EnvVar) {
value, err := isc.StringSlice(f.StringSliceFlag.Name)
if err != nil {
return err
}
if value != nil {
var sliceValue cli.StringSlice = value
eachName(f.Name, func(name string) {
underlyingFlag := f.set.Lookup(f.Name)
if underlyingFlag != nil {
underlyingFlag.Value = &sliceValue
}
})
}
}
}
return nil
} | [
"func",
"(",
"f",
"*",
"StringSliceFlag",
")",
"ApplyInputSourceValue",
"(",
"context",
"*",
"cli",
".",
"Context",
",",
"isc",
"InputSourceContext",
")",
"error",
"{",
"if",
"f",
".",
"set",
"!=",
"nil",
"{",
"if",
"!",
"context",
".",
"IsSet",
"(",
"f",
".",
"Name",
")",
"&&",
"!",
"isEnvVarSet",
"(",
"f",
".",
"EnvVar",
")",
"{",
"value",
",",
"err",
":=",
"isc",
".",
"StringSlice",
"(",
"f",
".",
"StringSliceFlag",
".",
"Name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"value",
"!=",
"nil",
"{",
"var",
"sliceValue",
"cli",
".",
"StringSlice",
"=",
"value",
"\n",
"eachName",
"(",
"f",
".",
"Name",
",",
"func",
"(",
"name",
"string",
")",
"{",
"underlyingFlag",
":=",
"f",
".",
"set",
".",
"Lookup",
"(",
"f",
".",
"Name",
")",
"\n",
"if",
"underlyingFlag",
"!=",
"nil",
"{",
"underlyingFlag",
".",
"Value",
"=",
"&",
"sliceValue",
"\n",
"}",
"\n",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // ApplyInputSourceValue applies a StringSlice value to the flagSet if required | [
"ApplyInputSourceValue",
"applies",
"a",
"StringSlice",
"value",
"to",
"the",
"flagSet",
"if",
"required"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag.go#L85-L104 | train |
urfave/cli | altsrc/flag.go | ApplyInputSourceValue | func (f *BoolFlag) ApplyInputSourceValue(context *cli.Context, isc InputSourceContext) error {
if f.set != nil {
if !context.IsSet(f.Name) && !isEnvVarSet(f.EnvVar) {
value, err := isc.Bool(f.BoolFlag.Name)
if err != nil {
return err
}
if value {
eachName(f.Name, func(name string) {
f.set.Set(f.Name, strconv.FormatBool(value))
})
}
}
}
return nil
} | go | func (f *BoolFlag) ApplyInputSourceValue(context *cli.Context, isc InputSourceContext) error {
if f.set != nil {
if !context.IsSet(f.Name) && !isEnvVarSet(f.EnvVar) {
value, err := isc.Bool(f.BoolFlag.Name)
if err != nil {
return err
}
if value {
eachName(f.Name, func(name string) {
f.set.Set(f.Name, strconv.FormatBool(value))
})
}
}
}
return nil
} | [
"func",
"(",
"f",
"*",
"BoolFlag",
")",
"ApplyInputSourceValue",
"(",
"context",
"*",
"cli",
".",
"Context",
",",
"isc",
"InputSourceContext",
")",
"error",
"{",
"if",
"f",
".",
"set",
"!=",
"nil",
"{",
"if",
"!",
"context",
".",
"IsSet",
"(",
"f",
".",
"Name",
")",
"&&",
"!",
"isEnvVarSet",
"(",
"f",
".",
"EnvVar",
")",
"{",
"value",
",",
"err",
":=",
"isc",
".",
"Bool",
"(",
"f",
".",
"BoolFlag",
".",
"Name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"value",
"{",
"eachName",
"(",
"f",
".",
"Name",
",",
"func",
"(",
"name",
"string",
")",
"{",
"f",
".",
"set",
".",
"Set",
"(",
"f",
".",
"Name",
",",
"strconv",
".",
"FormatBool",
"(",
"value",
")",
")",
"\n",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // ApplyInputSourceValue applies a Bool value to the flagSet if required | [
"ApplyInputSourceValue",
"applies",
"a",
"Bool",
"value",
"to",
"the",
"flagSet",
"if",
"required"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag.go#L129-L144 | train |
urfave/cli | altsrc/flag.go | ApplyInputSourceValue | func (f *IntFlag) ApplyInputSourceValue(context *cli.Context, isc InputSourceContext) error {
if f.set != nil {
if !(context.IsSet(f.Name) || isEnvVarSet(f.EnvVar)) {
value, err := isc.Int(f.IntFlag.Name)
if err != nil {
return err
}
if value > 0 {
eachName(f.Name, func(name string) {
f.set.Set(f.Name, strconv.FormatInt(int64(value), 10))
})
}
}
}
return nil
} | go | func (f *IntFlag) ApplyInputSourceValue(context *cli.Context, isc InputSourceContext) error {
if f.set != nil {
if !(context.IsSet(f.Name) || isEnvVarSet(f.EnvVar)) {
value, err := isc.Int(f.IntFlag.Name)
if err != nil {
return err
}
if value > 0 {
eachName(f.Name, func(name string) {
f.set.Set(f.Name, strconv.FormatInt(int64(value), 10))
})
}
}
}
return nil
} | [
"func",
"(",
"f",
"*",
"IntFlag",
")",
"ApplyInputSourceValue",
"(",
"context",
"*",
"cli",
".",
"Context",
",",
"isc",
"InputSourceContext",
")",
"error",
"{",
"if",
"f",
".",
"set",
"!=",
"nil",
"{",
"if",
"!",
"(",
"context",
".",
"IsSet",
"(",
"f",
".",
"Name",
")",
"||",
"isEnvVarSet",
"(",
"f",
".",
"EnvVar",
")",
")",
"{",
"value",
",",
"err",
":=",
"isc",
".",
"Int",
"(",
"f",
".",
"IntFlag",
".",
"Name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"value",
">",
"0",
"{",
"eachName",
"(",
"f",
".",
"Name",
",",
"func",
"(",
"name",
"string",
")",
"{",
"f",
".",
"set",
".",
"Set",
"(",
"f",
".",
"Name",
",",
"strconv",
".",
"FormatInt",
"(",
"int64",
"(",
"value",
")",
",",
"10",
")",
")",
"\n",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // ApplyInputSourceValue applies a int value to the flagSet if required | [
"ApplyInputSourceValue",
"applies",
"a",
"int",
"value",
"to",
"the",
"flagSet",
"if",
"required"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag.go#L183-L198 | train |
urfave/cli | altsrc/flag.go | ApplyInputSourceValue | func (f *Float64Flag) ApplyInputSourceValue(context *cli.Context, isc InputSourceContext) error {
if f.set != nil {
if !(context.IsSet(f.Name) || isEnvVarSet(f.EnvVar)) {
value, err := isc.Float64(f.Float64Flag.Name)
if err != nil {
return err
}
if value > 0 {
floatStr := float64ToString(value)
eachName(f.Name, func(name string) {
f.set.Set(f.Name, floatStr)
})
}
}
}
return nil
} | go | func (f *Float64Flag) ApplyInputSourceValue(context *cli.Context, isc InputSourceContext) error {
if f.set != nil {
if !(context.IsSet(f.Name) || isEnvVarSet(f.EnvVar)) {
value, err := isc.Float64(f.Float64Flag.Name)
if err != nil {
return err
}
if value > 0 {
floatStr := float64ToString(value)
eachName(f.Name, func(name string) {
f.set.Set(f.Name, floatStr)
})
}
}
}
return nil
} | [
"func",
"(",
"f",
"*",
"Float64Flag",
")",
"ApplyInputSourceValue",
"(",
"context",
"*",
"cli",
".",
"Context",
",",
"isc",
"InputSourceContext",
")",
"error",
"{",
"if",
"f",
".",
"set",
"!=",
"nil",
"{",
"if",
"!",
"(",
"context",
".",
"IsSet",
"(",
"f",
".",
"Name",
")",
"||",
"isEnvVarSet",
"(",
"f",
".",
"EnvVar",
")",
")",
"{",
"value",
",",
"err",
":=",
"isc",
".",
"Float64",
"(",
"f",
".",
"Float64Flag",
".",
"Name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"value",
">",
"0",
"{",
"floatStr",
":=",
"float64ToString",
"(",
"value",
")",
"\n",
"eachName",
"(",
"f",
".",
"Name",
",",
"func",
"(",
"name",
"string",
")",
"{",
"f",
".",
"set",
".",
"Set",
"(",
"f",
".",
"Name",
",",
"floatStr",
")",
"\n",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // ApplyInputSourceValue applies a Float64 value to the flagSet if required | [
"ApplyInputSourceValue",
"applies",
"a",
"Float64",
"value",
"to",
"the",
"flagSet",
"if",
"required"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag.go#L219-L235 | train |
urfave/cli | context.go | NewContext | func NewContext(app *App, set *flag.FlagSet, parentCtx *Context) *Context {
c := &Context{App: app, flagSet: set, parentContext: parentCtx}
if parentCtx != nil {
c.shellComplete = parentCtx.shellComplete
}
return c
} | go | func NewContext(app *App, set *flag.FlagSet, parentCtx *Context) *Context {
c := &Context{App: app, flagSet: set, parentContext: parentCtx}
if parentCtx != nil {
c.shellComplete = parentCtx.shellComplete
}
return c
} | [
"func",
"NewContext",
"(",
"app",
"*",
"App",
",",
"set",
"*",
"flag",
".",
"FlagSet",
",",
"parentCtx",
"*",
"Context",
")",
"*",
"Context",
"{",
"c",
":=",
"&",
"Context",
"{",
"App",
":",
"app",
",",
"flagSet",
":",
"set",
",",
"parentContext",
":",
"parentCtx",
"}",
"\n\n",
"if",
"parentCtx",
"!=",
"nil",
"{",
"c",
".",
"shellComplete",
"=",
"parentCtx",
".",
"shellComplete",
"\n",
"}",
"\n\n",
"return",
"c",
"\n",
"}"
] | // NewContext creates a new context. For use in when invoking an App or Command action. | [
"NewContext",
"creates",
"a",
"new",
"context",
".",
"For",
"use",
"in",
"when",
"invoking",
"an",
"App",
"or",
"Command",
"action",
"."
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/context.go#L26-L34 | train |
urfave/cli | context.go | Set | func (c *Context) Set(name, value string) error {
c.setFlags = nil
return c.flagSet.Set(name, value)
} | go | func (c *Context) Set(name, value string) error {
c.setFlags = nil
return c.flagSet.Set(name, value)
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"Set",
"(",
"name",
",",
"value",
"string",
")",
"error",
"{",
"c",
".",
"setFlags",
"=",
"nil",
"\n",
"return",
"c",
".",
"flagSet",
".",
"Set",
"(",
"name",
",",
"value",
")",
"\n",
"}"
] | // Set sets a context flag to a value. | [
"Set",
"sets",
"a",
"context",
"flag",
"to",
"a",
"value",
"."
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/context.go#L42-L45 | train |
urfave/cli | context.go | IsSet | func (c *Context) IsSet(name string) bool {
if c.setFlags == nil {
c.setFlags = make(map[string]bool)
c.flagSet.Visit(func(f *flag.Flag) {
c.setFlags[f.Name] = true
})
c.flagSet.VisitAll(func(f *flag.Flag) {
if _, ok := c.setFlags[f.Name]; ok {
return
}
c.setFlags[f.Name] = false
})
// XXX hack to support IsSet for flags with EnvVar
//
// There isn't an easy way to do this with the current implementation since
// whether a flag was set via an environment variable is very difficult to
// determine here. Instead, we intend to introduce a backwards incompatible
// change in version 2 to add `IsSet` to the Flag interface to push the
// responsibility closer to where the information required to determine
// whether a flag is set by non-standard means such as environment
// variables is available.
//
// See https://github.com/urfave/cli/issues/294 for additional discussion
flags := c.Command.Flags
if c.Command.Name == "" { // cannot == Command{} since it contains slice types
if c.App != nil {
flags = c.App.Flags
}
}
for _, f := range flags {
eachName(f.GetName(), func(name string) {
if isSet, ok := c.setFlags[name]; isSet || !ok {
return
}
val := reflect.ValueOf(f)
if val.Kind() == reflect.Ptr {
val = val.Elem()
}
filePathValue := val.FieldByName("FilePath")
if filePathValue.IsValid() {
eachName(filePathValue.String(), func(filePath string) {
if _, err := os.Stat(filePath); err == nil {
c.setFlags[name] = true
return
}
})
}
envVarValue := val.FieldByName("EnvVar")
if envVarValue.IsValid() {
eachName(envVarValue.String(), func(envVar string) {
envVar = strings.TrimSpace(envVar)
if _, ok := syscall.Getenv(envVar); ok {
c.setFlags[name] = true
return
}
})
}
})
}
}
return c.setFlags[name]
} | go | func (c *Context) IsSet(name string) bool {
if c.setFlags == nil {
c.setFlags = make(map[string]bool)
c.flagSet.Visit(func(f *flag.Flag) {
c.setFlags[f.Name] = true
})
c.flagSet.VisitAll(func(f *flag.Flag) {
if _, ok := c.setFlags[f.Name]; ok {
return
}
c.setFlags[f.Name] = false
})
// XXX hack to support IsSet for flags with EnvVar
//
// There isn't an easy way to do this with the current implementation since
// whether a flag was set via an environment variable is very difficult to
// determine here. Instead, we intend to introduce a backwards incompatible
// change in version 2 to add `IsSet` to the Flag interface to push the
// responsibility closer to where the information required to determine
// whether a flag is set by non-standard means such as environment
// variables is available.
//
// See https://github.com/urfave/cli/issues/294 for additional discussion
flags := c.Command.Flags
if c.Command.Name == "" { // cannot == Command{} since it contains slice types
if c.App != nil {
flags = c.App.Flags
}
}
for _, f := range flags {
eachName(f.GetName(), func(name string) {
if isSet, ok := c.setFlags[name]; isSet || !ok {
return
}
val := reflect.ValueOf(f)
if val.Kind() == reflect.Ptr {
val = val.Elem()
}
filePathValue := val.FieldByName("FilePath")
if filePathValue.IsValid() {
eachName(filePathValue.String(), func(filePath string) {
if _, err := os.Stat(filePath); err == nil {
c.setFlags[name] = true
return
}
})
}
envVarValue := val.FieldByName("EnvVar")
if envVarValue.IsValid() {
eachName(envVarValue.String(), func(envVar string) {
envVar = strings.TrimSpace(envVar)
if _, ok := syscall.Getenv(envVar); ok {
c.setFlags[name] = true
return
}
})
}
})
}
}
return c.setFlags[name]
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"IsSet",
"(",
"name",
"string",
")",
"bool",
"{",
"if",
"c",
".",
"setFlags",
"==",
"nil",
"{",
"c",
".",
"setFlags",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"bool",
")",
"\n\n",
"c",
".",
"flagSet",
".",
"Visit",
"(",
"func",
"(",
"f",
"*",
"flag",
".",
"Flag",
")",
"{",
"c",
".",
"setFlags",
"[",
"f",
".",
"Name",
"]",
"=",
"true",
"\n",
"}",
")",
"\n\n",
"c",
".",
"flagSet",
".",
"VisitAll",
"(",
"func",
"(",
"f",
"*",
"flag",
".",
"Flag",
")",
"{",
"if",
"_",
",",
"ok",
":=",
"c",
".",
"setFlags",
"[",
"f",
".",
"Name",
"]",
";",
"ok",
"{",
"return",
"\n",
"}",
"\n",
"c",
".",
"setFlags",
"[",
"f",
".",
"Name",
"]",
"=",
"false",
"\n",
"}",
")",
"\n\n",
"// XXX hack to support IsSet for flags with EnvVar",
"//",
"// There isn't an easy way to do this with the current implementation since",
"// whether a flag was set via an environment variable is very difficult to",
"// determine here. Instead, we intend to introduce a backwards incompatible",
"// change in version 2 to add `IsSet` to the Flag interface to push the",
"// responsibility closer to where the information required to determine",
"// whether a flag is set by non-standard means such as environment",
"// variables is available.",
"//",
"// See https://github.com/urfave/cli/issues/294 for additional discussion",
"flags",
":=",
"c",
".",
"Command",
".",
"Flags",
"\n",
"if",
"c",
".",
"Command",
".",
"Name",
"==",
"\"",
"\"",
"{",
"// cannot == Command{} since it contains slice types",
"if",
"c",
".",
"App",
"!=",
"nil",
"{",
"flags",
"=",
"c",
".",
"App",
".",
"Flags",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"f",
":=",
"range",
"flags",
"{",
"eachName",
"(",
"f",
".",
"GetName",
"(",
")",
",",
"func",
"(",
"name",
"string",
")",
"{",
"if",
"isSet",
",",
"ok",
":=",
"c",
".",
"setFlags",
"[",
"name",
"]",
";",
"isSet",
"||",
"!",
"ok",
"{",
"return",
"\n",
"}",
"\n\n",
"val",
":=",
"reflect",
".",
"ValueOf",
"(",
"f",
")",
"\n",
"if",
"val",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Ptr",
"{",
"val",
"=",
"val",
".",
"Elem",
"(",
")",
"\n",
"}",
"\n\n",
"filePathValue",
":=",
"val",
".",
"FieldByName",
"(",
"\"",
"\"",
")",
"\n",
"if",
"filePathValue",
".",
"IsValid",
"(",
")",
"{",
"eachName",
"(",
"filePathValue",
".",
"String",
"(",
")",
",",
"func",
"(",
"filePath",
"string",
")",
"{",
"if",
"_",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"filePath",
")",
";",
"err",
"==",
"nil",
"{",
"c",
".",
"setFlags",
"[",
"name",
"]",
"=",
"true",
"\n",
"return",
"\n",
"}",
"\n",
"}",
")",
"\n",
"}",
"\n\n",
"envVarValue",
":=",
"val",
".",
"FieldByName",
"(",
"\"",
"\"",
")",
"\n",
"if",
"envVarValue",
".",
"IsValid",
"(",
")",
"{",
"eachName",
"(",
"envVarValue",
".",
"String",
"(",
")",
",",
"func",
"(",
"envVar",
"string",
")",
"{",
"envVar",
"=",
"strings",
".",
"TrimSpace",
"(",
"envVar",
")",
"\n",
"if",
"_",
",",
"ok",
":=",
"syscall",
".",
"Getenv",
"(",
"envVar",
")",
";",
"ok",
"{",
"c",
".",
"setFlags",
"[",
"name",
"]",
"=",
"true",
"\n",
"return",
"\n",
"}",
"\n",
"}",
")",
"\n",
"}",
"\n",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"c",
".",
"setFlags",
"[",
"name",
"]",
"\n",
"}"
] | // IsSet determines if the flag was actually set | [
"IsSet",
"determines",
"if",
"the",
"flag",
"was",
"actually",
"set"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/context.go#L54-L122 | train |
urfave/cli | context.go | GlobalIsSet | func (c *Context) GlobalIsSet(name string) bool {
ctx := c
if ctx.parentContext != nil {
ctx = ctx.parentContext
}
for ; ctx != nil; ctx = ctx.parentContext {
if ctx.IsSet(name) {
return true
}
}
return false
} | go | func (c *Context) GlobalIsSet(name string) bool {
ctx := c
if ctx.parentContext != nil {
ctx = ctx.parentContext
}
for ; ctx != nil; ctx = ctx.parentContext {
if ctx.IsSet(name) {
return true
}
}
return false
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"GlobalIsSet",
"(",
"name",
"string",
")",
"bool",
"{",
"ctx",
":=",
"c",
"\n",
"if",
"ctx",
".",
"parentContext",
"!=",
"nil",
"{",
"ctx",
"=",
"ctx",
".",
"parentContext",
"\n",
"}",
"\n\n",
"for",
";",
"ctx",
"!=",
"nil",
";",
"ctx",
"=",
"ctx",
".",
"parentContext",
"{",
"if",
"ctx",
".",
"IsSet",
"(",
"name",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] | // GlobalIsSet determines if the global flag was actually set | [
"GlobalIsSet",
"determines",
"if",
"the",
"global",
"flag",
"was",
"actually",
"set"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/context.go#L125-L137 | train |
urfave/cli | context.go | FlagNames | func (c *Context) FlagNames() (names []string) {
for _, flag := range c.Command.Flags {
name := strings.Split(flag.GetName(), ",")[0]
if name == "help" {
continue
}
names = append(names, name)
}
return
} | go | func (c *Context) FlagNames() (names []string) {
for _, flag := range c.Command.Flags {
name := strings.Split(flag.GetName(), ",")[0]
if name == "help" {
continue
}
names = append(names, name)
}
return
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"FlagNames",
"(",
")",
"(",
"names",
"[",
"]",
"string",
")",
"{",
"for",
"_",
",",
"flag",
":=",
"range",
"c",
".",
"Command",
".",
"Flags",
"{",
"name",
":=",
"strings",
".",
"Split",
"(",
"flag",
".",
"GetName",
"(",
")",
",",
"\"",
"\"",
")",
"[",
"0",
"]",
"\n",
"if",
"name",
"==",
"\"",
"\"",
"{",
"continue",
"\n",
"}",
"\n",
"names",
"=",
"append",
"(",
"names",
",",
"name",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] | // FlagNames returns a slice of flag names used in this context. | [
"FlagNames",
"returns",
"a",
"slice",
"of",
"flag",
"names",
"used",
"in",
"this",
"context",
"."
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/context.go#L140-L149 | train |
urfave/cli | context.go | GlobalFlagNames | func (c *Context) GlobalFlagNames() (names []string) {
for _, flag := range c.App.Flags {
name := strings.Split(flag.GetName(), ",")[0]
if name == "help" || name == "version" {
continue
}
names = append(names, name)
}
return
} | go | func (c *Context) GlobalFlagNames() (names []string) {
for _, flag := range c.App.Flags {
name := strings.Split(flag.GetName(), ",")[0]
if name == "help" || name == "version" {
continue
}
names = append(names, name)
}
return
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"GlobalFlagNames",
"(",
")",
"(",
"names",
"[",
"]",
"string",
")",
"{",
"for",
"_",
",",
"flag",
":=",
"range",
"c",
".",
"App",
".",
"Flags",
"{",
"name",
":=",
"strings",
".",
"Split",
"(",
"flag",
".",
"GetName",
"(",
")",
",",
"\"",
"\"",
")",
"[",
"0",
"]",
"\n",
"if",
"name",
"==",
"\"",
"\"",
"||",
"name",
"==",
"\"",
"\"",
"{",
"continue",
"\n",
"}",
"\n",
"names",
"=",
"append",
"(",
"names",
",",
"name",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] | // GlobalFlagNames returns a slice of global flag names used by the app. | [
"GlobalFlagNames",
"returns",
"a",
"slice",
"of",
"global",
"flag",
"names",
"used",
"by",
"the",
"app",
"."
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/context.go#L152-L161 | train |
urfave/cli | context.go | value | func (c *Context) value(name string) interface{} {
return c.flagSet.Lookup(name).Value.(flag.Getter).Get()
} | go | func (c *Context) value(name string) interface{} {
return c.flagSet.Lookup(name).Value.(flag.Getter).Get()
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"value",
"(",
"name",
"string",
")",
"interface",
"{",
"}",
"{",
"return",
"c",
".",
"flagSet",
".",
"Lookup",
"(",
"name",
")",
".",
"Value",
".",
"(",
"flag",
".",
"Getter",
")",
".",
"Get",
"(",
")",
"\n",
"}"
] | // value returns the value of the flag coressponding to `name` | [
"value",
"returns",
"the",
"value",
"of",
"the",
"flag",
"coressponding",
"to",
"name"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/context.go#L169-L171 | train |
urfave/cli | context.go | Args | func (c *Context) Args() Args {
args := Args(c.flagSet.Args())
return args
} | go | func (c *Context) Args() Args {
args := Args(c.flagSet.Args())
return args
} | [
"func",
"(",
"c",
"*",
"Context",
")",
"Args",
"(",
")",
"Args",
"{",
"args",
":=",
"Args",
"(",
"c",
".",
"flagSet",
".",
"Args",
"(",
")",
")",
"\n",
"return",
"args",
"\n",
"}"
] | // Args returns the command line arguments associated with the context. | [
"Args",
"returns",
"the",
"command",
"line",
"arguments",
"associated",
"with",
"the",
"context",
"."
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/context.go#L177-L180 | train |
urfave/cli | context.go | Get | func (a Args) Get(n int) string {
if len(a) > n {
return a[n]
}
return ""
} | go | func (a Args) Get(n int) string {
if len(a) > n {
return a[n]
}
return ""
} | [
"func",
"(",
"a",
"Args",
")",
"Get",
"(",
"n",
"int",
")",
"string",
"{",
"if",
"len",
"(",
"a",
")",
">",
"n",
"{",
"return",
"a",
"[",
"n",
"]",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
] | // Get returns the nth argument, or else a blank string | [
"Get",
"returns",
"the",
"nth",
"argument",
"or",
"else",
"a",
"blank",
"string"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/context.go#L188-L193 | train |
urfave/cli | context.go | Swap | func (a Args) Swap(from, to int) error {
if from >= len(a) || to >= len(a) {
return errors.New("index out of range")
}
a[from], a[to] = a[to], a[from]
return nil
} | go | func (a Args) Swap(from, to int) error {
if from >= len(a) || to >= len(a) {
return errors.New("index out of range")
}
a[from], a[to] = a[to], a[from]
return nil
} | [
"func",
"(",
"a",
"Args",
")",
"Swap",
"(",
"from",
",",
"to",
"int",
")",
"error",
"{",
"if",
"from",
">=",
"len",
"(",
"a",
")",
"||",
"to",
">=",
"len",
"(",
"a",
")",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"a",
"[",
"from",
"]",
",",
"a",
"[",
"to",
"]",
"=",
"a",
"[",
"to",
"]",
",",
"a",
"[",
"from",
"]",
"\n",
"return",
"nil",
"\n",
"}"
] | // Swap swaps arguments at the given indexes | [
"Swap",
"swaps",
"arguments",
"at",
"the",
"given",
"indexes"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/context.go#L215-L221 | train |
urfave/cli | altsrc/flag_generated.go | NewBoolFlag | func NewBoolFlag(fl cli.BoolFlag) *BoolFlag {
return &BoolFlag{BoolFlag: fl, set: nil}
} | go | func NewBoolFlag(fl cli.BoolFlag) *BoolFlag {
return &BoolFlag{BoolFlag: fl, set: nil}
} | [
"func",
"NewBoolFlag",
"(",
"fl",
"cli",
".",
"BoolFlag",
")",
"*",
"BoolFlag",
"{",
"return",
"&",
"BoolFlag",
"{",
"BoolFlag",
":",
"fl",
",",
"set",
":",
"nil",
"}",
"\n",
"}"
] | // NewBoolFlag creates a new BoolFlag | [
"NewBoolFlag",
"creates",
"a",
"new",
"BoolFlag"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L19-L21 | train |
urfave/cli | altsrc/flag_generated.go | Apply | func (f *BoolFlag) Apply(set *flag.FlagSet) {
f.set = set
f.BoolFlag.Apply(set)
} | go | func (f *BoolFlag) Apply(set *flag.FlagSet) {
f.set = set
f.BoolFlag.Apply(set)
} | [
"func",
"(",
"f",
"*",
"BoolFlag",
")",
"Apply",
"(",
"set",
"*",
"flag",
".",
"FlagSet",
")",
"{",
"f",
".",
"set",
"=",
"set",
"\n",
"f",
".",
"BoolFlag",
".",
"Apply",
"(",
"set",
")",
"\n",
"}"
] | // Apply saves the flagSet for later usage calls, then calls the
// wrapped BoolFlag.Apply | [
"Apply",
"saves",
"the",
"flagSet",
"for",
"later",
"usage",
"calls",
"then",
"calls",
"the",
"wrapped",
"BoolFlag",
".",
"Apply"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L25-L28 | train |
urfave/cli | altsrc/flag_generated.go | ApplyWithError | func (f *BoolFlag) ApplyWithError(set *flag.FlagSet) error {
f.set = set
return f.BoolFlag.ApplyWithError(set)
} | go | func (f *BoolFlag) ApplyWithError(set *flag.FlagSet) error {
f.set = set
return f.BoolFlag.ApplyWithError(set)
} | [
"func",
"(",
"f",
"*",
"BoolFlag",
")",
"ApplyWithError",
"(",
"set",
"*",
"flag",
".",
"FlagSet",
")",
"error",
"{",
"f",
".",
"set",
"=",
"set",
"\n",
"return",
"f",
".",
"BoolFlag",
".",
"ApplyWithError",
"(",
"set",
")",
"\n",
"}"
] | // ApplyWithError saves the flagSet for later usage calls, then calls the
// wrapped BoolFlag.ApplyWithError | [
"ApplyWithError",
"saves",
"the",
"flagSet",
"for",
"later",
"usage",
"calls",
"then",
"calls",
"the",
"wrapped",
"BoolFlag",
".",
"ApplyWithError"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L32-L35 | train |
urfave/cli | altsrc/flag_generated.go | NewBoolTFlag | func NewBoolTFlag(fl cli.BoolTFlag) *BoolTFlag {
return &BoolTFlag{BoolTFlag: fl, set: nil}
} | go | func NewBoolTFlag(fl cli.BoolTFlag) *BoolTFlag {
return &BoolTFlag{BoolTFlag: fl, set: nil}
} | [
"func",
"NewBoolTFlag",
"(",
"fl",
"cli",
".",
"BoolTFlag",
")",
"*",
"BoolTFlag",
"{",
"return",
"&",
"BoolTFlag",
"{",
"BoolTFlag",
":",
"fl",
",",
"set",
":",
"nil",
"}",
"\n",
"}"
] | // NewBoolTFlag creates a new BoolTFlag | [
"NewBoolTFlag",
"creates",
"a",
"new",
"BoolTFlag"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L45-L47 | train |
urfave/cli | altsrc/flag_generated.go | Apply | func (f *BoolTFlag) Apply(set *flag.FlagSet) {
f.set = set
f.BoolTFlag.Apply(set)
} | go | func (f *BoolTFlag) Apply(set *flag.FlagSet) {
f.set = set
f.BoolTFlag.Apply(set)
} | [
"func",
"(",
"f",
"*",
"BoolTFlag",
")",
"Apply",
"(",
"set",
"*",
"flag",
".",
"FlagSet",
")",
"{",
"f",
".",
"set",
"=",
"set",
"\n",
"f",
".",
"BoolTFlag",
".",
"Apply",
"(",
"set",
")",
"\n",
"}"
] | // Apply saves the flagSet for later usage calls, then calls the
// wrapped BoolTFlag.Apply | [
"Apply",
"saves",
"the",
"flagSet",
"for",
"later",
"usage",
"calls",
"then",
"calls",
"the",
"wrapped",
"BoolTFlag",
".",
"Apply"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L51-L54 | train |
urfave/cli | altsrc/flag_generated.go | ApplyWithError | func (f *BoolTFlag) ApplyWithError(set *flag.FlagSet) error {
f.set = set
return f.BoolTFlag.ApplyWithError(set)
} | go | func (f *BoolTFlag) ApplyWithError(set *flag.FlagSet) error {
f.set = set
return f.BoolTFlag.ApplyWithError(set)
} | [
"func",
"(",
"f",
"*",
"BoolTFlag",
")",
"ApplyWithError",
"(",
"set",
"*",
"flag",
".",
"FlagSet",
")",
"error",
"{",
"f",
".",
"set",
"=",
"set",
"\n",
"return",
"f",
".",
"BoolTFlag",
".",
"ApplyWithError",
"(",
"set",
")",
"\n",
"}"
] | // ApplyWithError saves the flagSet for later usage calls, then calls the
// wrapped BoolTFlag.ApplyWithError | [
"ApplyWithError",
"saves",
"the",
"flagSet",
"for",
"later",
"usage",
"calls",
"then",
"calls",
"the",
"wrapped",
"BoolTFlag",
".",
"ApplyWithError"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L58-L61 | train |
urfave/cli | altsrc/flag_generated.go | NewDurationFlag | func NewDurationFlag(fl cli.DurationFlag) *DurationFlag {
return &DurationFlag{DurationFlag: fl, set: nil}
} | go | func NewDurationFlag(fl cli.DurationFlag) *DurationFlag {
return &DurationFlag{DurationFlag: fl, set: nil}
} | [
"func",
"NewDurationFlag",
"(",
"fl",
"cli",
".",
"DurationFlag",
")",
"*",
"DurationFlag",
"{",
"return",
"&",
"DurationFlag",
"{",
"DurationFlag",
":",
"fl",
",",
"set",
":",
"nil",
"}",
"\n",
"}"
] | // NewDurationFlag creates a new DurationFlag | [
"NewDurationFlag",
"creates",
"a",
"new",
"DurationFlag"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L71-L73 | train |
urfave/cli | altsrc/flag_generated.go | Apply | func (f *DurationFlag) Apply(set *flag.FlagSet) {
f.set = set
f.DurationFlag.Apply(set)
} | go | func (f *DurationFlag) Apply(set *flag.FlagSet) {
f.set = set
f.DurationFlag.Apply(set)
} | [
"func",
"(",
"f",
"*",
"DurationFlag",
")",
"Apply",
"(",
"set",
"*",
"flag",
".",
"FlagSet",
")",
"{",
"f",
".",
"set",
"=",
"set",
"\n",
"f",
".",
"DurationFlag",
".",
"Apply",
"(",
"set",
")",
"\n",
"}"
] | // Apply saves the flagSet for later usage calls, then calls the
// wrapped DurationFlag.Apply | [
"Apply",
"saves",
"the",
"flagSet",
"for",
"later",
"usage",
"calls",
"then",
"calls",
"the",
"wrapped",
"DurationFlag",
".",
"Apply"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L77-L80 | train |
urfave/cli | altsrc/flag_generated.go | ApplyWithError | func (f *DurationFlag) ApplyWithError(set *flag.FlagSet) error {
f.set = set
return f.DurationFlag.ApplyWithError(set)
} | go | func (f *DurationFlag) ApplyWithError(set *flag.FlagSet) error {
f.set = set
return f.DurationFlag.ApplyWithError(set)
} | [
"func",
"(",
"f",
"*",
"DurationFlag",
")",
"ApplyWithError",
"(",
"set",
"*",
"flag",
".",
"FlagSet",
")",
"error",
"{",
"f",
".",
"set",
"=",
"set",
"\n",
"return",
"f",
".",
"DurationFlag",
".",
"ApplyWithError",
"(",
"set",
")",
"\n",
"}"
] | // ApplyWithError saves the flagSet for later usage calls, then calls the
// wrapped DurationFlag.ApplyWithError | [
"ApplyWithError",
"saves",
"the",
"flagSet",
"for",
"later",
"usage",
"calls",
"then",
"calls",
"the",
"wrapped",
"DurationFlag",
".",
"ApplyWithError"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L84-L87 | train |
urfave/cli | altsrc/flag_generated.go | NewFloat64Flag | func NewFloat64Flag(fl cli.Float64Flag) *Float64Flag {
return &Float64Flag{Float64Flag: fl, set: nil}
} | go | func NewFloat64Flag(fl cli.Float64Flag) *Float64Flag {
return &Float64Flag{Float64Flag: fl, set: nil}
} | [
"func",
"NewFloat64Flag",
"(",
"fl",
"cli",
".",
"Float64Flag",
")",
"*",
"Float64Flag",
"{",
"return",
"&",
"Float64Flag",
"{",
"Float64Flag",
":",
"fl",
",",
"set",
":",
"nil",
"}",
"\n",
"}"
] | // NewFloat64Flag creates a new Float64Flag | [
"NewFloat64Flag",
"creates",
"a",
"new",
"Float64Flag"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L97-L99 | train |
urfave/cli | altsrc/flag_generated.go | Apply | func (f *Float64Flag) Apply(set *flag.FlagSet) {
f.set = set
f.Float64Flag.Apply(set)
} | go | func (f *Float64Flag) Apply(set *flag.FlagSet) {
f.set = set
f.Float64Flag.Apply(set)
} | [
"func",
"(",
"f",
"*",
"Float64Flag",
")",
"Apply",
"(",
"set",
"*",
"flag",
".",
"FlagSet",
")",
"{",
"f",
".",
"set",
"=",
"set",
"\n",
"f",
".",
"Float64Flag",
".",
"Apply",
"(",
"set",
")",
"\n",
"}"
] | // Apply saves the flagSet for later usage calls, then calls the
// wrapped Float64Flag.Apply | [
"Apply",
"saves",
"the",
"flagSet",
"for",
"later",
"usage",
"calls",
"then",
"calls",
"the",
"wrapped",
"Float64Flag",
".",
"Apply"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L103-L106 | train |
urfave/cli | altsrc/flag_generated.go | ApplyWithError | func (f *Float64Flag) ApplyWithError(set *flag.FlagSet) error {
f.set = set
return f.Float64Flag.ApplyWithError(set)
} | go | func (f *Float64Flag) ApplyWithError(set *flag.FlagSet) error {
f.set = set
return f.Float64Flag.ApplyWithError(set)
} | [
"func",
"(",
"f",
"*",
"Float64Flag",
")",
"ApplyWithError",
"(",
"set",
"*",
"flag",
".",
"FlagSet",
")",
"error",
"{",
"f",
".",
"set",
"=",
"set",
"\n",
"return",
"f",
".",
"Float64Flag",
".",
"ApplyWithError",
"(",
"set",
")",
"\n",
"}"
] | // ApplyWithError saves the flagSet for later usage calls, then calls the
// wrapped Float64Flag.ApplyWithError | [
"ApplyWithError",
"saves",
"the",
"flagSet",
"for",
"later",
"usage",
"calls",
"then",
"calls",
"the",
"wrapped",
"Float64Flag",
".",
"ApplyWithError"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L110-L113 | train |
urfave/cli | altsrc/flag_generated.go | NewGenericFlag | func NewGenericFlag(fl cli.GenericFlag) *GenericFlag {
return &GenericFlag{GenericFlag: fl, set: nil}
} | go | func NewGenericFlag(fl cli.GenericFlag) *GenericFlag {
return &GenericFlag{GenericFlag: fl, set: nil}
} | [
"func",
"NewGenericFlag",
"(",
"fl",
"cli",
".",
"GenericFlag",
")",
"*",
"GenericFlag",
"{",
"return",
"&",
"GenericFlag",
"{",
"GenericFlag",
":",
"fl",
",",
"set",
":",
"nil",
"}",
"\n",
"}"
] | // NewGenericFlag creates a new GenericFlag | [
"NewGenericFlag",
"creates",
"a",
"new",
"GenericFlag"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L123-L125 | train |
urfave/cli | altsrc/flag_generated.go | Apply | func (f *GenericFlag) Apply(set *flag.FlagSet) {
f.set = set
f.GenericFlag.Apply(set)
} | go | func (f *GenericFlag) Apply(set *flag.FlagSet) {
f.set = set
f.GenericFlag.Apply(set)
} | [
"func",
"(",
"f",
"*",
"GenericFlag",
")",
"Apply",
"(",
"set",
"*",
"flag",
".",
"FlagSet",
")",
"{",
"f",
".",
"set",
"=",
"set",
"\n",
"f",
".",
"GenericFlag",
".",
"Apply",
"(",
"set",
")",
"\n",
"}"
] | // Apply saves the flagSet for later usage calls, then calls the
// wrapped GenericFlag.Apply | [
"Apply",
"saves",
"the",
"flagSet",
"for",
"later",
"usage",
"calls",
"then",
"calls",
"the",
"wrapped",
"GenericFlag",
".",
"Apply"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L129-L132 | train |
urfave/cli | altsrc/flag_generated.go | ApplyWithError | func (f *GenericFlag) ApplyWithError(set *flag.FlagSet) error {
f.set = set
return f.GenericFlag.ApplyWithError(set)
} | go | func (f *GenericFlag) ApplyWithError(set *flag.FlagSet) error {
f.set = set
return f.GenericFlag.ApplyWithError(set)
} | [
"func",
"(",
"f",
"*",
"GenericFlag",
")",
"ApplyWithError",
"(",
"set",
"*",
"flag",
".",
"FlagSet",
")",
"error",
"{",
"f",
".",
"set",
"=",
"set",
"\n",
"return",
"f",
".",
"GenericFlag",
".",
"ApplyWithError",
"(",
"set",
")",
"\n",
"}"
] | // ApplyWithError saves the flagSet for later usage calls, then calls the
// wrapped GenericFlag.ApplyWithError | [
"ApplyWithError",
"saves",
"the",
"flagSet",
"for",
"later",
"usage",
"calls",
"then",
"calls",
"the",
"wrapped",
"GenericFlag",
".",
"ApplyWithError"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L136-L139 | train |
urfave/cli | altsrc/flag_generated.go | NewInt64Flag | func NewInt64Flag(fl cli.Int64Flag) *Int64Flag {
return &Int64Flag{Int64Flag: fl, set: nil}
} | go | func NewInt64Flag(fl cli.Int64Flag) *Int64Flag {
return &Int64Flag{Int64Flag: fl, set: nil}
} | [
"func",
"NewInt64Flag",
"(",
"fl",
"cli",
".",
"Int64Flag",
")",
"*",
"Int64Flag",
"{",
"return",
"&",
"Int64Flag",
"{",
"Int64Flag",
":",
"fl",
",",
"set",
":",
"nil",
"}",
"\n",
"}"
] | // NewInt64Flag creates a new Int64Flag | [
"NewInt64Flag",
"creates",
"a",
"new",
"Int64Flag"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L149-L151 | train |
urfave/cli | altsrc/flag_generated.go | Apply | func (f *Int64Flag) Apply(set *flag.FlagSet) {
f.set = set
f.Int64Flag.Apply(set)
} | go | func (f *Int64Flag) Apply(set *flag.FlagSet) {
f.set = set
f.Int64Flag.Apply(set)
} | [
"func",
"(",
"f",
"*",
"Int64Flag",
")",
"Apply",
"(",
"set",
"*",
"flag",
".",
"FlagSet",
")",
"{",
"f",
".",
"set",
"=",
"set",
"\n",
"f",
".",
"Int64Flag",
".",
"Apply",
"(",
"set",
")",
"\n",
"}"
] | // Apply saves the flagSet for later usage calls, then calls the
// wrapped Int64Flag.Apply | [
"Apply",
"saves",
"the",
"flagSet",
"for",
"later",
"usage",
"calls",
"then",
"calls",
"the",
"wrapped",
"Int64Flag",
".",
"Apply"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L155-L158 | train |
urfave/cli | altsrc/flag_generated.go | ApplyWithError | func (f *Int64Flag) ApplyWithError(set *flag.FlagSet) error {
f.set = set
return f.Int64Flag.ApplyWithError(set)
} | go | func (f *Int64Flag) ApplyWithError(set *flag.FlagSet) error {
f.set = set
return f.Int64Flag.ApplyWithError(set)
} | [
"func",
"(",
"f",
"*",
"Int64Flag",
")",
"ApplyWithError",
"(",
"set",
"*",
"flag",
".",
"FlagSet",
")",
"error",
"{",
"f",
".",
"set",
"=",
"set",
"\n",
"return",
"f",
".",
"Int64Flag",
".",
"ApplyWithError",
"(",
"set",
")",
"\n",
"}"
] | // ApplyWithError saves the flagSet for later usage calls, then calls the
// wrapped Int64Flag.ApplyWithError | [
"ApplyWithError",
"saves",
"the",
"flagSet",
"for",
"later",
"usage",
"calls",
"then",
"calls",
"the",
"wrapped",
"Int64Flag",
".",
"ApplyWithError"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L162-L165 | train |
urfave/cli | altsrc/flag_generated.go | NewIntFlag | func NewIntFlag(fl cli.IntFlag) *IntFlag {
return &IntFlag{IntFlag: fl, set: nil}
} | go | func NewIntFlag(fl cli.IntFlag) *IntFlag {
return &IntFlag{IntFlag: fl, set: nil}
} | [
"func",
"NewIntFlag",
"(",
"fl",
"cli",
".",
"IntFlag",
")",
"*",
"IntFlag",
"{",
"return",
"&",
"IntFlag",
"{",
"IntFlag",
":",
"fl",
",",
"set",
":",
"nil",
"}",
"\n",
"}"
] | // NewIntFlag creates a new IntFlag | [
"NewIntFlag",
"creates",
"a",
"new",
"IntFlag"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L175-L177 | train |
urfave/cli | altsrc/flag_generated.go | Apply | func (f *IntFlag) Apply(set *flag.FlagSet) {
f.set = set
f.IntFlag.Apply(set)
} | go | func (f *IntFlag) Apply(set *flag.FlagSet) {
f.set = set
f.IntFlag.Apply(set)
} | [
"func",
"(",
"f",
"*",
"IntFlag",
")",
"Apply",
"(",
"set",
"*",
"flag",
".",
"FlagSet",
")",
"{",
"f",
".",
"set",
"=",
"set",
"\n",
"f",
".",
"IntFlag",
".",
"Apply",
"(",
"set",
")",
"\n",
"}"
] | // Apply saves the flagSet for later usage calls, then calls the
// wrapped IntFlag.Apply | [
"Apply",
"saves",
"the",
"flagSet",
"for",
"later",
"usage",
"calls",
"then",
"calls",
"the",
"wrapped",
"IntFlag",
".",
"Apply"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L181-L184 | train |
urfave/cli | altsrc/flag_generated.go | ApplyWithError | func (f *IntFlag) ApplyWithError(set *flag.FlagSet) error {
f.set = set
return f.IntFlag.ApplyWithError(set)
} | go | func (f *IntFlag) ApplyWithError(set *flag.FlagSet) error {
f.set = set
return f.IntFlag.ApplyWithError(set)
} | [
"func",
"(",
"f",
"*",
"IntFlag",
")",
"ApplyWithError",
"(",
"set",
"*",
"flag",
".",
"FlagSet",
")",
"error",
"{",
"f",
".",
"set",
"=",
"set",
"\n",
"return",
"f",
".",
"IntFlag",
".",
"ApplyWithError",
"(",
"set",
")",
"\n",
"}"
] | // ApplyWithError saves the flagSet for later usage calls, then calls the
// wrapped IntFlag.ApplyWithError | [
"ApplyWithError",
"saves",
"the",
"flagSet",
"for",
"later",
"usage",
"calls",
"then",
"calls",
"the",
"wrapped",
"IntFlag",
".",
"ApplyWithError"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L188-L191 | train |
urfave/cli | altsrc/flag_generated.go | NewIntSliceFlag | func NewIntSliceFlag(fl cli.IntSliceFlag) *IntSliceFlag {
return &IntSliceFlag{IntSliceFlag: fl, set: nil}
} | go | func NewIntSliceFlag(fl cli.IntSliceFlag) *IntSliceFlag {
return &IntSliceFlag{IntSliceFlag: fl, set: nil}
} | [
"func",
"NewIntSliceFlag",
"(",
"fl",
"cli",
".",
"IntSliceFlag",
")",
"*",
"IntSliceFlag",
"{",
"return",
"&",
"IntSliceFlag",
"{",
"IntSliceFlag",
":",
"fl",
",",
"set",
":",
"nil",
"}",
"\n",
"}"
] | // NewIntSliceFlag creates a new IntSliceFlag | [
"NewIntSliceFlag",
"creates",
"a",
"new",
"IntSliceFlag"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L201-L203 | train |
urfave/cli | altsrc/flag_generated.go | Apply | func (f *IntSliceFlag) Apply(set *flag.FlagSet) {
f.set = set
f.IntSliceFlag.Apply(set)
} | go | func (f *IntSliceFlag) Apply(set *flag.FlagSet) {
f.set = set
f.IntSliceFlag.Apply(set)
} | [
"func",
"(",
"f",
"*",
"IntSliceFlag",
")",
"Apply",
"(",
"set",
"*",
"flag",
".",
"FlagSet",
")",
"{",
"f",
".",
"set",
"=",
"set",
"\n",
"f",
".",
"IntSliceFlag",
".",
"Apply",
"(",
"set",
")",
"\n",
"}"
] | // Apply saves the flagSet for later usage calls, then calls the
// wrapped IntSliceFlag.Apply | [
"Apply",
"saves",
"the",
"flagSet",
"for",
"later",
"usage",
"calls",
"then",
"calls",
"the",
"wrapped",
"IntSliceFlag",
".",
"Apply"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L207-L210 | train |
urfave/cli | altsrc/flag_generated.go | ApplyWithError | func (f *IntSliceFlag) ApplyWithError(set *flag.FlagSet) error {
f.set = set
return f.IntSliceFlag.ApplyWithError(set)
} | go | func (f *IntSliceFlag) ApplyWithError(set *flag.FlagSet) error {
f.set = set
return f.IntSliceFlag.ApplyWithError(set)
} | [
"func",
"(",
"f",
"*",
"IntSliceFlag",
")",
"ApplyWithError",
"(",
"set",
"*",
"flag",
".",
"FlagSet",
")",
"error",
"{",
"f",
".",
"set",
"=",
"set",
"\n",
"return",
"f",
".",
"IntSliceFlag",
".",
"ApplyWithError",
"(",
"set",
")",
"\n",
"}"
] | // ApplyWithError saves the flagSet for later usage calls, then calls the
// wrapped IntSliceFlag.ApplyWithError | [
"ApplyWithError",
"saves",
"the",
"flagSet",
"for",
"later",
"usage",
"calls",
"then",
"calls",
"the",
"wrapped",
"IntSliceFlag",
".",
"ApplyWithError"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L214-L217 | train |
urfave/cli | altsrc/flag_generated.go | NewInt64SliceFlag | func NewInt64SliceFlag(fl cli.Int64SliceFlag) *Int64SliceFlag {
return &Int64SliceFlag{Int64SliceFlag: fl, set: nil}
} | go | func NewInt64SliceFlag(fl cli.Int64SliceFlag) *Int64SliceFlag {
return &Int64SliceFlag{Int64SliceFlag: fl, set: nil}
} | [
"func",
"NewInt64SliceFlag",
"(",
"fl",
"cli",
".",
"Int64SliceFlag",
")",
"*",
"Int64SliceFlag",
"{",
"return",
"&",
"Int64SliceFlag",
"{",
"Int64SliceFlag",
":",
"fl",
",",
"set",
":",
"nil",
"}",
"\n",
"}"
] | // NewInt64SliceFlag creates a new Int64SliceFlag | [
"NewInt64SliceFlag",
"creates",
"a",
"new",
"Int64SliceFlag"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L227-L229 | train |
urfave/cli | altsrc/flag_generated.go | Apply | func (f *Int64SliceFlag) Apply(set *flag.FlagSet) {
f.set = set
f.Int64SliceFlag.Apply(set)
} | go | func (f *Int64SliceFlag) Apply(set *flag.FlagSet) {
f.set = set
f.Int64SliceFlag.Apply(set)
} | [
"func",
"(",
"f",
"*",
"Int64SliceFlag",
")",
"Apply",
"(",
"set",
"*",
"flag",
".",
"FlagSet",
")",
"{",
"f",
".",
"set",
"=",
"set",
"\n",
"f",
".",
"Int64SliceFlag",
".",
"Apply",
"(",
"set",
")",
"\n",
"}"
] | // Apply saves the flagSet for later usage calls, then calls the
// wrapped Int64SliceFlag.Apply | [
"Apply",
"saves",
"the",
"flagSet",
"for",
"later",
"usage",
"calls",
"then",
"calls",
"the",
"wrapped",
"Int64SliceFlag",
".",
"Apply"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L233-L236 | train |
urfave/cli | altsrc/flag_generated.go | ApplyWithError | func (f *Int64SliceFlag) ApplyWithError(set *flag.FlagSet) error {
f.set = set
return f.Int64SliceFlag.ApplyWithError(set)
} | go | func (f *Int64SliceFlag) ApplyWithError(set *flag.FlagSet) error {
f.set = set
return f.Int64SliceFlag.ApplyWithError(set)
} | [
"func",
"(",
"f",
"*",
"Int64SliceFlag",
")",
"ApplyWithError",
"(",
"set",
"*",
"flag",
".",
"FlagSet",
")",
"error",
"{",
"f",
".",
"set",
"=",
"set",
"\n",
"return",
"f",
".",
"Int64SliceFlag",
".",
"ApplyWithError",
"(",
"set",
")",
"\n",
"}"
] | // ApplyWithError saves the flagSet for later usage calls, then calls the
// wrapped Int64SliceFlag.ApplyWithError | [
"ApplyWithError",
"saves",
"the",
"flagSet",
"for",
"later",
"usage",
"calls",
"then",
"calls",
"the",
"wrapped",
"Int64SliceFlag",
".",
"ApplyWithError"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L240-L243 | train |
urfave/cli | altsrc/flag_generated.go | NewStringFlag | func NewStringFlag(fl cli.StringFlag) *StringFlag {
return &StringFlag{StringFlag: fl, set: nil}
} | go | func NewStringFlag(fl cli.StringFlag) *StringFlag {
return &StringFlag{StringFlag: fl, set: nil}
} | [
"func",
"NewStringFlag",
"(",
"fl",
"cli",
".",
"StringFlag",
")",
"*",
"StringFlag",
"{",
"return",
"&",
"StringFlag",
"{",
"StringFlag",
":",
"fl",
",",
"set",
":",
"nil",
"}",
"\n",
"}"
] | // NewStringFlag creates a new StringFlag | [
"NewStringFlag",
"creates",
"a",
"new",
"StringFlag"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L253-L255 | train |
urfave/cli | altsrc/flag_generated.go | Apply | func (f *StringFlag) Apply(set *flag.FlagSet) {
f.set = set
f.StringFlag.Apply(set)
} | go | func (f *StringFlag) Apply(set *flag.FlagSet) {
f.set = set
f.StringFlag.Apply(set)
} | [
"func",
"(",
"f",
"*",
"StringFlag",
")",
"Apply",
"(",
"set",
"*",
"flag",
".",
"FlagSet",
")",
"{",
"f",
".",
"set",
"=",
"set",
"\n",
"f",
".",
"StringFlag",
".",
"Apply",
"(",
"set",
")",
"\n",
"}"
] | // Apply saves the flagSet for later usage calls, then calls the
// wrapped StringFlag.Apply | [
"Apply",
"saves",
"the",
"flagSet",
"for",
"later",
"usage",
"calls",
"then",
"calls",
"the",
"wrapped",
"StringFlag",
".",
"Apply"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L259-L262 | train |
urfave/cli | altsrc/flag_generated.go | ApplyWithError | func (f *StringFlag) ApplyWithError(set *flag.FlagSet) error {
f.set = set
return f.StringFlag.ApplyWithError(set)
} | go | func (f *StringFlag) ApplyWithError(set *flag.FlagSet) error {
f.set = set
return f.StringFlag.ApplyWithError(set)
} | [
"func",
"(",
"f",
"*",
"StringFlag",
")",
"ApplyWithError",
"(",
"set",
"*",
"flag",
".",
"FlagSet",
")",
"error",
"{",
"f",
".",
"set",
"=",
"set",
"\n",
"return",
"f",
".",
"StringFlag",
".",
"ApplyWithError",
"(",
"set",
")",
"\n",
"}"
] | // ApplyWithError saves the flagSet for later usage calls, then calls the
// wrapped StringFlag.ApplyWithError | [
"ApplyWithError",
"saves",
"the",
"flagSet",
"for",
"later",
"usage",
"calls",
"then",
"calls",
"the",
"wrapped",
"StringFlag",
".",
"ApplyWithError"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L266-L269 | train |
urfave/cli | altsrc/flag_generated.go | NewStringSliceFlag | func NewStringSliceFlag(fl cli.StringSliceFlag) *StringSliceFlag {
return &StringSliceFlag{StringSliceFlag: fl, set: nil}
} | go | func NewStringSliceFlag(fl cli.StringSliceFlag) *StringSliceFlag {
return &StringSliceFlag{StringSliceFlag: fl, set: nil}
} | [
"func",
"NewStringSliceFlag",
"(",
"fl",
"cli",
".",
"StringSliceFlag",
")",
"*",
"StringSliceFlag",
"{",
"return",
"&",
"StringSliceFlag",
"{",
"StringSliceFlag",
":",
"fl",
",",
"set",
":",
"nil",
"}",
"\n",
"}"
] | // NewStringSliceFlag creates a new StringSliceFlag | [
"NewStringSliceFlag",
"creates",
"a",
"new",
"StringSliceFlag"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L279-L281 | train |
urfave/cli | altsrc/flag_generated.go | Apply | func (f *StringSliceFlag) Apply(set *flag.FlagSet) {
f.set = set
f.StringSliceFlag.Apply(set)
} | go | func (f *StringSliceFlag) Apply(set *flag.FlagSet) {
f.set = set
f.StringSliceFlag.Apply(set)
} | [
"func",
"(",
"f",
"*",
"StringSliceFlag",
")",
"Apply",
"(",
"set",
"*",
"flag",
".",
"FlagSet",
")",
"{",
"f",
".",
"set",
"=",
"set",
"\n",
"f",
".",
"StringSliceFlag",
".",
"Apply",
"(",
"set",
")",
"\n",
"}"
] | // Apply saves the flagSet for later usage calls, then calls the
// wrapped StringSliceFlag.Apply | [
"Apply",
"saves",
"the",
"flagSet",
"for",
"later",
"usage",
"calls",
"then",
"calls",
"the",
"wrapped",
"StringSliceFlag",
".",
"Apply"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L285-L288 | train |
urfave/cli | altsrc/flag_generated.go | ApplyWithError | func (f *StringSliceFlag) ApplyWithError(set *flag.FlagSet) error {
f.set = set
return f.StringSliceFlag.ApplyWithError(set)
} | go | func (f *StringSliceFlag) ApplyWithError(set *flag.FlagSet) error {
f.set = set
return f.StringSliceFlag.ApplyWithError(set)
} | [
"func",
"(",
"f",
"*",
"StringSliceFlag",
")",
"ApplyWithError",
"(",
"set",
"*",
"flag",
".",
"FlagSet",
")",
"error",
"{",
"f",
".",
"set",
"=",
"set",
"\n",
"return",
"f",
".",
"StringSliceFlag",
".",
"ApplyWithError",
"(",
"set",
")",
"\n",
"}"
] | // ApplyWithError saves the flagSet for later usage calls, then calls the
// wrapped StringSliceFlag.ApplyWithError | [
"ApplyWithError",
"saves",
"the",
"flagSet",
"for",
"later",
"usage",
"calls",
"then",
"calls",
"the",
"wrapped",
"StringSliceFlag",
".",
"ApplyWithError"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L292-L295 | train |
urfave/cli | altsrc/flag_generated.go | NewUint64Flag | func NewUint64Flag(fl cli.Uint64Flag) *Uint64Flag {
return &Uint64Flag{Uint64Flag: fl, set: nil}
} | go | func NewUint64Flag(fl cli.Uint64Flag) *Uint64Flag {
return &Uint64Flag{Uint64Flag: fl, set: nil}
} | [
"func",
"NewUint64Flag",
"(",
"fl",
"cli",
".",
"Uint64Flag",
")",
"*",
"Uint64Flag",
"{",
"return",
"&",
"Uint64Flag",
"{",
"Uint64Flag",
":",
"fl",
",",
"set",
":",
"nil",
"}",
"\n",
"}"
] | // NewUint64Flag creates a new Uint64Flag | [
"NewUint64Flag",
"creates",
"a",
"new",
"Uint64Flag"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L305-L307 | train |
urfave/cli | altsrc/flag_generated.go | Apply | func (f *Uint64Flag) Apply(set *flag.FlagSet) {
f.set = set
f.Uint64Flag.Apply(set)
} | go | func (f *Uint64Flag) Apply(set *flag.FlagSet) {
f.set = set
f.Uint64Flag.Apply(set)
} | [
"func",
"(",
"f",
"*",
"Uint64Flag",
")",
"Apply",
"(",
"set",
"*",
"flag",
".",
"FlagSet",
")",
"{",
"f",
".",
"set",
"=",
"set",
"\n",
"f",
".",
"Uint64Flag",
".",
"Apply",
"(",
"set",
")",
"\n",
"}"
] | // Apply saves the flagSet for later usage calls, then calls the
// wrapped Uint64Flag.Apply | [
"Apply",
"saves",
"the",
"flagSet",
"for",
"later",
"usage",
"calls",
"then",
"calls",
"the",
"wrapped",
"Uint64Flag",
".",
"Apply"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L311-L314 | train |
urfave/cli | altsrc/flag_generated.go | ApplyWithError | func (f *Uint64Flag) ApplyWithError(set *flag.FlagSet) error {
f.set = set
return f.Uint64Flag.ApplyWithError(set)
} | go | func (f *Uint64Flag) ApplyWithError(set *flag.FlagSet) error {
f.set = set
return f.Uint64Flag.ApplyWithError(set)
} | [
"func",
"(",
"f",
"*",
"Uint64Flag",
")",
"ApplyWithError",
"(",
"set",
"*",
"flag",
".",
"FlagSet",
")",
"error",
"{",
"f",
".",
"set",
"=",
"set",
"\n",
"return",
"f",
".",
"Uint64Flag",
".",
"ApplyWithError",
"(",
"set",
")",
"\n",
"}"
] | // ApplyWithError saves the flagSet for later usage calls, then calls the
// wrapped Uint64Flag.ApplyWithError | [
"ApplyWithError",
"saves",
"the",
"flagSet",
"for",
"later",
"usage",
"calls",
"then",
"calls",
"the",
"wrapped",
"Uint64Flag",
".",
"ApplyWithError"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L318-L321 | train |
urfave/cli | altsrc/flag_generated.go | NewUintFlag | func NewUintFlag(fl cli.UintFlag) *UintFlag {
return &UintFlag{UintFlag: fl, set: nil}
} | go | func NewUintFlag(fl cli.UintFlag) *UintFlag {
return &UintFlag{UintFlag: fl, set: nil}
} | [
"func",
"NewUintFlag",
"(",
"fl",
"cli",
".",
"UintFlag",
")",
"*",
"UintFlag",
"{",
"return",
"&",
"UintFlag",
"{",
"UintFlag",
":",
"fl",
",",
"set",
":",
"nil",
"}",
"\n",
"}"
] | // NewUintFlag creates a new UintFlag | [
"NewUintFlag",
"creates",
"a",
"new",
"UintFlag"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L331-L333 | train |
urfave/cli | altsrc/flag_generated.go | Apply | func (f *UintFlag) Apply(set *flag.FlagSet) {
f.set = set
f.UintFlag.Apply(set)
} | go | func (f *UintFlag) Apply(set *flag.FlagSet) {
f.set = set
f.UintFlag.Apply(set)
} | [
"func",
"(",
"f",
"*",
"UintFlag",
")",
"Apply",
"(",
"set",
"*",
"flag",
".",
"FlagSet",
")",
"{",
"f",
".",
"set",
"=",
"set",
"\n",
"f",
".",
"UintFlag",
".",
"Apply",
"(",
"set",
")",
"\n",
"}"
] | // Apply saves the flagSet for later usage calls, then calls the
// wrapped UintFlag.Apply | [
"Apply",
"saves",
"the",
"flagSet",
"for",
"later",
"usage",
"calls",
"then",
"calls",
"the",
"wrapped",
"UintFlag",
".",
"Apply"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L337-L340 | train |
urfave/cli | altsrc/flag_generated.go | ApplyWithError | func (f *UintFlag) ApplyWithError(set *flag.FlagSet) error {
f.set = set
return f.UintFlag.ApplyWithError(set)
} | go | func (f *UintFlag) ApplyWithError(set *flag.FlagSet) error {
f.set = set
return f.UintFlag.ApplyWithError(set)
} | [
"func",
"(",
"f",
"*",
"UintFlag",
")",
"ApplyWithError",
"(",
"set",
"*",
"flag",
".",
"FlagSet",
")",
"error",
"{",
"f",
".",
"set",
"=",
"set",
"\n",
"return",
"f",
".",
"UintFlag",
".",
"ApplyWithError",
"(",
"set",
")",
"\n",
"}"
] | // ApplyWithError saves the flagSet for later usage calls, then calls the
// wrapped UintFlag.ApplyWithError | [
"ApplyWithError",
"saves",
"the",
"flagSet",
"for",
"later",
"usage",
"calls",
"then",
"calls",
"the",
"wrapped",
"UintFlag",
".",
"ApplyWithError"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/altsrc/flag_generated.go#L344-L347 | train |
urfave/cli | command.go | FullName | func (c Command) FullName() string {
if c.commandNamePath == nil {
return c.Name
}
return strings.Join(c.commandNamePath, " ")
} | go | func (c Command) FullName() string {
if c.commandNamePath == nil {
return c.Name
}
return strings.Join(c.commandNamePath, " ")
} | [
"func",
"(",
"c",
"Command",
")",
"FullName",
"(",
")",
"string",
"{",
"if",
"c",
".",
"commandNamePath",
"==",
"nil",
"{",
"return",
"c",
".",
"Name",
"\n",
"}",
"\n",
"return",
"strings",
".",
"Join",
"(",
"c",
".",
"commandNamePath",
",",
"\"",
"\"",
")",
"\n",
"}"
] | // FullName returns the full name of the command.
// For subcommands this ensures that parent commands are part of the command path | [
"FullName",
"returns",
"the",
"full",
"name",
"of",
"the",
"command",
".",
"For",
"subcommands",
"this",
"ensures",
"that",
"parent",
"commands",
"are",
"part",
"of",
"the",
"command",
"path"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/command.go#L90-L95 | train |
urfave/cli | command.go | reorderArgs | func reorderArgs(args []string) []string {
var nonflags, flags []string
readFlagValue := false
for i, arg := range args {
if arg == "--" {
nonflags = append(nonflags, args[i:]...)
break
}
if readFlagValue && !strings.HasPrefix(arg, "-") && !strings.HasPrefix(arg, "--") {
readFlagValue = false
flags = append(flags, arg)
continue
}
readFlagValue = false
if arg != "-" && strings.HasPrefix(arg, "-") {
flags = append(flags, arg)
readFlagValue = !strings.Contains(arg, "=")
} else {
nonflags = append(nonflags, arg)
}
}
return append(flags, nonflags...)
} | go | func reorderArgs(args []string) []string {
var nonflags, flags []string
readFlagValue := false
for i, arg := range args {
if arg == "--" {
nonflags = append(nonflags, args[i:]...)
break
}
if readFlagValue && !strings.HasPrefix(arg, "-") && !strings.HasPrefix(arg, "--") {
readFlagValue = false
flags = append(flags, arg)
continue
}
readFlagValue = false
if arg != "-" && strings.HasPrefix(arg, "-") {
flags = append(flags, arg)
readFlagValue = !strings.Contains(arg, "=")
} else {
nonflags = append(nonflags, arg)
}
}
return append(flags, nonflags...)
} | [
"func",
"reorderArgs",
"(",
"args",
"[",
"]",
"string",
")",
"[",
"]",
"string",
"{",
"var",
"nonflags",
",",
"flags",
"[",
"]",
"string",
"\n\n",
"readFlagValue",
":=",
"false",
"\n",
"for",
"i",
",",
"arg",
":=",
"range",
"args",
"{",
"if",
"arg",
"==",
"\"",
"\"",
"{",
"nonflags",
"=",
"append",
"(",
"nonflags",
",",
"args",
"[",
"i",
":",
"]",
"...",
")",
"\n",
"break",
"\n",
"}",
"\n\n",
"if",
"readFlagValue",
"&&",
"!",
"strings",
".",
"HasPrefix",
"(",
"arg",
",",
"\"",
"\"",
")",
"&&",
"!",
"strings",
".",
"HasPrefix",
"(",
"arg",
",",
"\"",
"\"",
")",
"{",
"readFlagValue",
"=",
"false",
"\n",
"flags",
"=",
"append",
"(",
"flags",
",",
"arg",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"readFlagValue",
"=",
"false",
"\n\n",
"if",
"arg",
"!=",
"\"",
"\"",
"&&",
"strings",
".",
"HasPrefix",
"(",
"arg",
",",
"\"",
"\"",
")",
"{",
"flags",
"=",
"append",
"(",
"flags",
",",
"arg",
")",
"\n\n",
"readFlagValue",
"=",
"!",
"strings",
".",
"Contains",
"(",
"arg",
",",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"nonflags",
"=",
"append",
"(",
"nonflags",
",",
"arg",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"append",
"(",
"flags",
",",
"nonflags",
"...",
")",
"\n",
"}"
] | // reorderArgs moves all flags before arguments as this is what flag expects | [
"reorderArgs",
"moves",
"all",
"flags",
"before",
"arguments",
"as",
"this",
"is",
"what",
"flag",
"expects"
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/command.go#L239-L266 | train |
urfave/cli | command.go | Names | func (c Command) Names() []string {
names := []string{c.Name}
if c.ShortName != "" {
names = append(names, c.ShortName)
}
return append(names, c.Aliases...)
} | go | func (c Command) Names() []string {
names := []string{c.Name}
if c.ShortName != "" {
names = append(names, c.ShortName)
}
return append(names, c.Aliases...)
} | [
"func",
"(",
"c",
"Command",
")",
"Names",
"(",
")",
"[",
"]",
"string",
"{",
"names",
":=",
"[",
"]",
"string",
"{",
"c",
".",
"Name",
"}",
"\n\n",
"if",
"c",
".",
"ShortName",
"!=",
"\"",
"\"",
"{",
"names",
"=",
"append",
"(",
"names",
",",
"c",
".",
"ShortName",
")",
"\n",
"}",
"\n\n",
"return",
"append",
"(",
"names",
",",
"c",
".",
"Aliases",
"...",
")",
"\n",
"}"
] | // Names returns the names including short names and aliases. | [
"Names",
"returns",
"the",
"names",
"including",
"short",
"names",
"and",
"aliases",
"."
] | 693af58b4d51b8fcc7f9d89576da170765980581 | https://github.com/urfave/cli/blob/693af58b4d51b8fcc7f9d89576da170765980581/command.go#L298-L306 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.