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
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
partition
stringclasses
1 value
minio/mc
cmd/client-admin.go
newAdminClient
func newAdminClient(aliasedURL string) (*madmin.AdminClient, *probe.Error) { alias, urlStrFull, hostCfg, err := expandAlias(aliasedURL) if err != nil { return nil, err.Trace(aliasedURL) } // Verify if the aliasedURL is a real URL, fail in those cases // indicating the user to add alias. if hostCfg == nil && url...
go
func newAdminClient(aliasedURL string) (*madmin.AdminClient, *probe.Error) { alias, urlStrFull, hostCfg, err := expandAlias(aliasedURL) if err != nil { return nil, err.Trace(aliasedURL) } // Verify if the aliasedURL is a real URL, fail in those cases // indicating the user to add alias. if hostCfg == nil && url...
[ "func", "newAdminClient", "(", "aliasedURL", "string", ")", "(", "*", "madmin", ".", "AdminClient", ",", "*", "probe", ".", "Error", ")", "{", "alias", ",", "urlStrFull", ",", "hostCfg", ",", "err", ":=", "expandAlias", "(", "aliasedURL", ")", "\n", "if"...
// newAdminClient gives a new client interface
[ "newAdminClient", "gives", "a", "new", "client", "interface" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-admin.go#L112-L134
train
minio/mc
cmd/ls.go
JSON
func (c contentMessage) JSON() string { c.Status = "success" jsonMessageBytes, e := json.MarshalIndent(c, "", " ") fatalIf(probe.NewError(e), "Unable to marshal into JSON.") return string(jsonMessageBytes) }
go
func (c contentMessage) JSON() string { c.Status = "success" jsonMessageBytes, e := json.MarshalIndent(c, "", " ") fatalIf(probe.NewError(e), "Unable to marshal into JSON.") return string(jsonMessageBytes) }
[ "func", "(", "c", "contentMessage", ")", "JSON", "(", ")", "string", "{", "c", ".", "Status", "=", "\"", "\"", "\n", "jsonMessageBytes", ",", "e", ":=", "json", ".", "MarshalIndent", "(", "c", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "fatalIf",...
// JSON jsonified content message.
[ "JSON", "jsonified", "content", "message", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/ls.go#L61-L67
train
minio/mc
cmd/ls.go
parseContent
func parseContent(c *clientContent) contentMessage { content := contentMessage{} content.Time = c.Time.Local() // guess file type. content.Filetype = func() string { if c.Type.IsDir() { return "folder" } return "file" }() content.Size = c.Size md5sum := strings.TrimPrefix(c.ETag, "\"") md5sum = strin...
go
func parseContent(c *clientContent) contentMessage { content := contentMessage{} content.Time = c.Time.Local() // guess file type. content.Filetype = func() string { if c.Type.IsDir() { return "folder" } return "file" }() content.Size = c.Size md5sum := strings.TrimPrefix(c.ETag, "\"") md5sum = strin...
[ "func", "parseContent", "(", "c", "*", "clientContent", ")", "contentMessage", "{", "content", ":=", "contentMessage", "{", "}", "\n", "content", ".", "Time", "=", "c", ".", "Time", ".", "Local", "(", ")", "\n\n", "// guess file type.", "content", ".", "Fi...
// parseContent parse client Content container into printer struct.
[ "parseContent", "parse", "client", "Content", "container", "into", "printer", "struct", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/ls.go#L70-L89
train
minio/mc
cmd/ls.go
getKey
func getKey(c *clientContent) string { sep := "/" // for windows make sure to print in 'windows' specific style. if runtime.GOOS == "windows" { c.URL.Path = strings.Replace(c.URL.Path, "/", "\\", -1) sep = "\\" } if c.Type.IsDir() && !strings.HasSuffix(c.URL.Path, sep) { return fmt.Sprintf("%s%s", c.URL.Pa...
go
func getKey(c *clientContent) string { sep := "/" // for windows make sure to print in 'windows' specific style. if runtime.GOOS == "windows" { c.URL.Path = strings.Replace(c.URL.Path, "/", "\\", -1) sep = "\\" } if c.Type.IsDir() && !strings.HasSuffix(c.URL.Path, sep) { return fmt.Sprintf("%s%s", c.URL.Pa...
[ "func", "getKey", "(", "c", "*", "clientContent", ")", "string", "{", "sep", ":=", "\"", "\"", "\n\n", "// for windows make sure to print in 'windows' specific style.", "if", "runtime", ".", "GOOS", "==", "\"", "\"", "{", "c", ".", "URL", ".", "Path", "=", "...
// get content key
[ "get", "content", "key" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/ls.go#L92-L105
train
minio/mc
cmd/ls.go
doList
func doList(clnt Client, isRecursive, isIncomplete bool) error { prefixPath := clnt.GetURL().Path separator := string(clnt.GetURL().Separator) if !strings.HasSuffix(prefixPath, separator) { prefixPath = prefixPath[:strings.LastIndex(prefixPath, separator)+1] } var cErr error for content := range clnt.List(isRec...
go
func doList(clnt Client, isRecursive, isIncomplete bool) error { prefixPath := clnt.GetURL().Path separator := string(clnt.GetURL().Separator) if !strings.HasSuffix(prefixPath, separator) { prefixPath = prefixPath[:strings.LastIndex(prefixPath, separator)+1] } var cErr error for content := range clnt.List(isRec...
[ "func", "doList", "(", "clnt", "Client", ",", "isRecursive", ",", "isIncomplete", "bool", ")", "error", "{", "prefixPath", ":=", "clnt", ".", "GetURL", "(", ")", ".", "Path", "\n", "separator", ":=", "string", "(", "clnt", ".", "GetURL", "(", ")", ".",...
// doList - list all entities inside a folder.
[ "doList", "-", "list", "all", "entities", "inside", "a", "folder", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/ls.go#L108-L153
train
minio/mc
cmd/head-main.go
headURL
func headURL(sourceURL string, encKeyDB map[string][]prefixSSEPair, nlines int64) *probe.Error { var reader io.ReadCloser switch sourceURL { case "-": reader = os.Stdin default: var err *probe.Error var metadata map[string]string if reader, metadata, err = getSourceStreamMetadataFromURL(sourceURL, encKeyDB)...
go
func headURL(sourceURL string, encKeyDB map[string][]prefixSSEPair, nlines int64) *probe.Error { var reader io.ReadCloser switch sourceURL { case "-": reader = os.Stdin default: var err *probe.Error var metadata map[string]string if reader, metadata, err = getSourceStreamMetadataFromURL(sourceURL, encKeyDB)...
[ "func", "headURL", "(", "sourceURL", "string", ",", "encKeyDB", "map", "[", "string", "]", "[", "]", "prefixSSEPair", ",", "nlines", "int64", ")", "*", "probe", ".", "Error", "{", "var", "reader", "io", ".", "ReadCloser", "\n", "switch", "sourceURL", "{"...
// headURL displays contents of a URL to stdout.
[ "headURL", "displays", "contents", "of", "a", "URL", "to", "stdout", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/head-main.go#L77-L104
train
minio/mc
cmd/head-main.go
mainHead
func mainHead(ctx *cli.Context) error { // Parse encryption keys per command. encKeyDB, err := getEncKeys(ctx) fatalIf(err, "Unable to parse encryption keys.") // Set command flags from context. stdinMode := false if !ctx.Args().Present() { stdinMode = true } // handle std input data. if stdinMode { fata...
go
func mainHead(ctx *cli.Context) error { // Parse encryption keys per command. encKeyDB, err := getEncKeys(ctx) fatalIf(err, "Unable to parse encryption keys.") // Set command flags from context. stdinMode := false if !ctx.Args().Present() { stdinMode = true } // handle std input data. if stdinMode { fata...
[ "func", "mainHead", "(", "ctx", "*", "cli", ".", "Context", ")", "error", "{", "// Parse encryption keys per command.", "encKeyDB", ",", "err", ":=", "getEncKeys", "(", "ctx", ")", "\n", "fatalIf", "(", "err", ",", "\"", "\"", ")", "\n\n", "// Set command fl...
// mainHead is the main entry point for head command.
[ "mainHead", "is", "the", "main", "entry", "point", "for", "head", "command", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/head-main.go#L151-L174
train
minio/mc
cmd/parallel-manager.go
addWorker
func (p *ParallelManager) addWorker() { if atomic.LoadUint32(&p.workersNum) >= maxParallelWorkers { // Number of maximum workers is reached, no need to // to create a new one. return } // Update number of threads atomic.AddUint32(&p.workersNum, 1) // Start a new worker p.wg.Add(1) go func() { for { ...
go
func (p *ParallelManager) addWorker() { if atomic.LoadUint32(&p.workersNum) >= maxParallelWorkers { // Number of maximum workers is reached, no need to // to create a new one. return } // Update number of threads atomic.AddUint32(&p.workersNum, 1) // Start a new worker p.wg.Add(1) go func() { for { ...
[ "func", "(", "p", "*", "ParallelManager", ")", "addWorker", "(", ")", "{", "if", "atomic", ".", "LoadUint32", "(", "&", "p", ".", "workersNum", ")", ">=", "maxParallelWorkers", "{", "// Number of maximum workers is reached, no need to", "// to create a new one.", "r...
// addWorker creates a new worker to process tasks
[ "addWorker", "creates", "a", "new", "worker", "to", "process", "tasks" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/parallel-manager.go#L57-L83
train
minio/mc
cmd/parallel-manager.go
monitorProgress
func (p *ParallelManager) monitorProgress() { go func() { ticker := time.NewTicker(monitorPeriod) defer ticker.Stop() var prevSentBytes, maxBandwidth int64 var retry int for { select { case <-p.stopMonitorCh: // Ordered to quit immediately return case <-ticker.C: // Compute new bandwid...
go
func (p *ParallelManager) monitorProgress() { go func() { ticker := time.NewTicker(monitorPeriod) defer ticker.Stop() var prevSentBytes, maxBandwidth int64 var retry int for { select { case <-p.stopMonitorCh: // Ordered to quit immediately return case <-ticker.C: // Compute new bandwid...
[ "func", "(", "p", "*", "ParallelManager", ")", "monitorProgress", "(", ")", "{", "go", "func", "(", ")", "{", "ticker", ":=", "time", ".", "NewTicker", "(", "monitorPeriod", ")", "\n", "defer", "ticker", ".", "Stop", "(", ")", "\n\n", "var", "prevSentB...
// monitorProgress monitors realtime transfer speed of data // and increases threads until it reaches a maximum number of // threads or notice there is no apparent enhancement of // transfer speed.
[ "monitorProgress", "monitors", "realtime", "transfer", "speed", "of", "data", "and", "increases", "threads", "until", "it", "reaches", "a", "maximum", "number", "of", "threads", "or", "notice", "there", "is", "no", "apparent", "enhancement", "of", "transfer", "s...
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/parallel-manager.go#L94-L132
train
minio/mc
cmd/parallel-manager.go
newParallelManager
func newParallelManager(resultCh chan URLs) (*ParallelManager, chan func() URLs) { p := &ParallelManager{ wg: &sync.WaitGroup{}, workersNum: 0, stopMonitorCh: make(chan struct{}), queueCh: make(chan func() URLs), resultCh: resultCh, } // Start with runtime.NumCPU(). for i := 0; i...
go
func newParallelManager(resultCh chan URLs) (*ParallelManager, chan func() URLs) { p := &ParallelManager{ wg: &sync.WaitGroup{}, workersNum: 0, stopMonitorCh: make(chan struct{}), queueCh: make(chan func() URLs), resultCh: resultCh, } // Start with runtime.NumCPU(). for i := 0; i...
[ "func", "newParallelManager", "(", "resultCh", "chan", "URLs", ")", "(", "*", "ParallelManager", ",", "chan", "func", "(", ")", "URLs", ")", "{", "p", ":=", "&", "ParallelManager", "{", "wg", ":", "&", "sync", ".", "WaitGroup", "{", "}", ",", "workersN...
// newParallelManager starts new workers waiting for executing tasks
[ "newParallelManager", "starts", "new", "workers", "waiting", "for", "executing", "tasks" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/parallel-manager.go#L141-L159
train
minio/mc
cmd/config-v9.go
newConfigV9
func newConfigV9() *configV9 { cfg := new(configV9) cfg.Version = globalMCConfigVersion cfg.Hosts = make(map[string]hostConfigV9) return cfg }
go
func newConfigV9() *configV9 { cfg := new(configV9) cfg.Version = globalMCConfigVersion cfg.Hosts = make(map[string]hostConfigV9) return cfg }
[ "func", "newConfigV9", "(", ")", "*", "configV9", "{", "cfg", ":=", "new", "(", "configV9", ")", "\n", "cfg", ".", "Version", "=", "globalMCConfigVersion", "\n", "cfg", ".", "Hosts", "=", "make", "(", "map", "[", "string", "]", "hostConfigV9", ")", "\n...
// newConfigV9 - new config version.
[ "newConfigV9", "-", "new", "config", "version", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/config-v9.go#L54-L59
train
minio/mc
cmd/config-v9.go
loadConfigV9
func loadConfigV9() (*configV9, *probe.Error) { cfgMutex.RLock() defer cfgMutex.RUnlock() // If already cached, return the cached value. if cacheCfgV9 != nil { return cacheCfgV9, nil } if !isMcConfigExists() { return nil, errInvalidArgument().Trace() } // Initialize a new config loader. qc, e := quick.N...
go
func loadConfigV9() (*configV9, *probe.Error) { cfgMutex.RLock() defer cfgMutex.RUnlock() // If already cached, return the cached value. if cacheCfgV9 != nil { return cacheCfgV9, nil } if !isMcConfigExists() { return nil, errInvalidArgument().Trace() } // Initialize a new config loader. qc, e := quick.N...
[ "func", "loadConfigV9", "(", ")", "(", "*", "configV9", ",", "*", "probe", ".", "Error", ")", "{", "cfgMutex", ".", "RLock", "(", ")", "\n", "defer", "cfgMutex", ".", "RUnlock", "(", ")", "\n\n", "// If already cached, return the cached value.", "if", "cache...
// loadConfigV9 - loads a new config.
[ "loadConfigV9", "-", "loads", "a", "new", "config", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/config-v9.go#L108-L140
train
minio/mc
cmd/config-v9.go
saveConfigV9
func saveConfigV9(cfgV9 *configV9) *probe.Error { cfgMutex.Lock() defer cfgMutex.Unlock() qs, e := quick.NewConfig(cfgV9, nil) if e != nil { return probe.NewError(e) } // update the cache. cacheCfgV9 = cfgV9 e = qs.Save(mustGetMcConfigPath()) if e != nil { return probe.NewError(e).Trace(mustGetMcConfigP...
go
func saveConfigV9(cfgV9 *configV9) *probe.Error { cfgMutex.Lock() defer cfgMutex.Unlock() qs, e := quick.NewConfig(cfgV9, nil) if e != nil { return probe.NewError(e) } // update the cache. cacheCfgV9 = cfgV9 e = qs.Save(mustGetMcConfigPath()) if e != nil { return probe.NewError(e).Trace(mustGetMcConfigP...
[ "func", "saveConfigV9", "(", "cfgV9", "*", "configV9", ")", "*", "probe", ".", "Error", "{", "cfgMutex", ".", "Lock", "(", ")", "\n", "defer", "cfgMutex", ".", "Unlock", "(", ")", "\n\n", "qs", ",", "e", ":=", "quick", ".", "NewConfig", "(", "cfgV9",...
// saveConfigV8 - saves an updated config.
[ "saveConfigV8", "-", "saves", "an", "updated", "config", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/config-v9.go#L143-L160
train
minio/mc
cmd/access-perms.go
isValidAccessPERM
func (b accessPerms) isValidAccessPERM() bool { switch b { case accessNone, accessDownload, accessUpload, accessPublic: return true } return false }
go
func (b accessPerms) isValidAccessPERM() bool { switch b { case accessNone, accessDownload, accessUpload, accessPublic: return true } return false }
[ "func", "(", "b", "accessPerms", ")", "isValidAccessPERM", "(", ")", "bool", "{", "switch", "b", "{", "case", "accessNone", ",", "accessDownload", ",", "accessUpload", ",", "accessPublic", ":", "return", "true", "\n", "}", "\n", "return", "false", "\n", "}...
// isValidAccessPERM - is provided access perm string supported.
[ "isValidAccessPERM", "-", "is", "provided", "access", "perm", "string", "supported", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/access-perms.go#L22-L28
train
minio/mc
cmd/ls-main.go
checkListSyntax
func checkListSyntax(ctx *cli.Context) { args := ctx.Args() if !ctx.Args().Present() { args = []string{"."} } for _, arg := range args { if strings.TrimSpace(arg) == "" { fatalIf(errInvalidArgument().Trace(args...), "Unable to validate empty argument.") } } // extract URLs. URLs := ctx.Args() isIncompl...
go
func checkListSyntax(ctx *cli.Context) { args := ctx.Args() if !ctx.Args().Present() { args = []string{"."} } for _, arg := range args { if strings.TrimSpace(arg) == "" { fatalIf(errInvalidArgument().Trace(args...), "Unable to validate empty argument.") } } // extract URLs. URLs := ctx.Args() isIncompl...
[ "func", "checkListSyntax", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "args", ":=", "ctx", ".", "Args", "(", ")", "\n", "if", "!", "ctx", ".", "Args", "(", ")", ".", "Present", "(", ")", "{", "args", "=", "[", "]", "string", "{", "\"", ...
// checkListSyntax - validate all the passed arguments
[ "checkListSyntax", "-", "validate", "all", "the", "passed", "arguments" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/ls-main.go#L80-L105
train
minio/mc
cmd/ls-main.go
mainList
func mainList(ctx *cli.Context) error { // Additional command specific theme customization. console.SetColor("File", color.New(color.Bold)) console.SetColor("Dir", color.New(color.FgCyan, color.Bold)) console.SetColor("Size", color.New(color.FgYellow)) console.SetColor("Time", color.New(color.FgGreen)) // check ...
go
func mainList(ctx *cli.Context) error { // Additional command specific theme customization. console.SetColor("File", color.New(color.Bold)) console.SetColor("Dir", color.New(color.FgCyan, color.Bold)) console.SetColor("Size", color.New(color.FgYellow)) console.SetColor("Time", color.New(color.FgGreen)) // check ...
[ "func", "mainList", "(", "ctx", "*", "cli", ".", "Context", ")", "error", "{", "// Additional command specific theme customization.", "console", ".", "SetColor", "(", "\"", "\"", ",", "color", ".", "New", "(", "color", ".", "Bold", ")", ")", "\n", "console",...
// mainList - is a handler for mc ls command
[ "mainList", "-", "is", "a", "handler", "for", "mc", "ls", "command" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/ls-main.go#L108-L148
train
minio/mc
cmd/complete.go
mainComplete
func mainComplete() error { // Recursively register all commands and subcommands // along with global and local flags var complCmds = make(complete.Commands) for _, cmd := range appCmds { complCmds[cmd.Name] = cmdToCompleteCmd(cmd, "") } complFlags := flagsToCompleteFlags(globalFlags) mcComplete := complete.Co...
go
func mainComplete() error { // Recursively register all commands and subcommands // along with global and local flags var complCmds = make(complete.Commands) for _, cmd := range appCmds { complCmds[cmd.Name] = cmdToCompleteCmd(cmd, "") } complFlags := flagsToCompleteFlags(globalFlags) mcComplete := complete.Co...
[ "func", "mainComplete", "(", ")", "error", "{", "// Recursively register all commands and subcommands", "// along with global and local flags", "var", "complCmds", "=", "make", "(", "complete", ".", "Commands", ")", "\n", "for", "_", ",", "cmd", ":=", "range", "appCmd...
// Main function to answer to bash completion calls
[ "Main", "function", "to", "answer", "to", "bash", "completion", "calls" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/complete.go#L242-L257
train
minio/mc
cmd/client-s3-trace_v2.go
Response
func (t traceV2) Response(resp *http.Response) (err error) { var respTrace []byte // For errors we make sure to dump response body as well. if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusPartialContent && resp.StatusCode != http.StatusNoContent { respTrace, err = httputil.DumpResponse(res...
go
func (t traceV2) Response(resp *http.Response) (err error) { var respTrace []byte // For errors we make sure to dump response body as well. if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusPartialContent && resp.StatusCode != http.StatusNoContent { respTrace, err = httputil.DumpResponse(res...
[ "func", "(", "t", "traceV2", ")", "Response", "(", "resp", "*", "http", ".", "Response", ")", "(", "err", "error", ")", "{", "var", "respTrace", "[", "]", "byte", "\n", "// For errors we make sure to dump response body as well.", "if", "resp", ".", "StatusCode...
// Response - Trace HTTP Response
[ "Response", "-", "Trace", "HTTP", "Response" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-s3-trace_v2.go#L60-L79
train
minio/mc
cmd/client-fs.go
fsNew
func fsNew(path string) (Client, *probe.Error) { if strings.TrimSpace(path) == "" { return nil, probe.NewError(EmptyPath{}) } return &fsClient{ PathURL: newClientURL(normalizePath(path)), }, nil }
go
func fsNew(path string) (Client, *probe.Error) { if strings.TrimSpace(path) == "" { return nil, probe.NewError(EmptyPath{}) } return &fsClient{ PathURL: newClientURL(normalizePath(path)), }, nil }
[ "func", "fsNew", "(", "path", "string", ")", "(", "Client", ",", "*", "probe", ".", "Error", ")", "{", "if", "strings", ".", "TrimSpace", "(", "path", ")", "==", "\"", "\"", "{", "return", "nil", ",", "probe", ".", "NewError", "(", "EmptyPath", "{"...
// fsNew - instantiate a new fs
[ "fsNew", "-", "instantiate", "a", "new", "fs" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-fs.go#L58-L65
train
minio/mc
cmd/client-fs.go
isIgnoredFile
func isIgnoredFile(filename string) bool { matchFile := path.Base(filename) // OS specific ignore list. for _, ignoredFile := range ignoreFiles[runtime.GOOS] { matched, err := filepath.Match(ignoredFile, matchFile) if err != nil { panic(err) } if matched { return true } } // Default ignore list f...
go
func isIgnoredFile(filename string) bool { matchFile := path.Base(filename) // OS specific ignore list. for _, ignoredFile := range ignoreFiles[runtime.GOOS] { matched, err := filepath.Match(ignoredFile, matchFile) if err != nil { panic(err) } if matched { return true } } // Default ignore list f...
[ "func", "isIgnoredFile", "(", "filename", "string", ")", "bool", "{", "matchFile", ":=", "path", ".", "Base", "(", "filename", ")", "\n\n", "// OS specific ignore list.", "for", "_", ",", "ignoredFile", ":=", "range", "ignoreFiles", "[", "runtime", ".", "GOOS"...
// isIgnoredFile returns true if 'filename' is on the exclude list.
[ "isIgnoredFile", "returns", "true", "if", "filename", "is", "on", "the", "exclude", "list", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-fs.go#L81-L107
train
minio/mc
cmd/client-fs.go
Select
func (f *fsClient) Select(expression string, sse encrypt.ServerSide, opts SelectObjectOpts) (io.ReadCloser, *probe.Error) { return nil, probe.NewError(APINotImplemented{}) }
go
func (f *fsClient) Select(expression string, sse encrypt.ServerSide, opts SelectObjectOpts) (io.ReadCloser, *probe.Error) { return nil, probe.NewError(APINotImplemented{}) }
[ "func", "(", "f", "*", "fsClient", ")", "Select", "(", "expression", "string", ",", "sse", "encrypt", ".", "ServerSide", ",", "opts", "SelectObjectOpts", ")", "(", "io", ".", "ReadCloser", ",", "*", "probe", ".", "Error", ")", "{", "return", "nil", ","...
// Select replies a stream of query results.
[ "Select", "replies", "a", "stream", "of", "query", "results", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-fs.go#L115-L117
train
minio/mc
cmd/client-fs.go
Watch
func (f *fsClient) Watch(params watchParams) (*watchObject, *probe.Error) { eventChan := make(chan EventInfo) errorChan := make(chan *probe.Error) doneChan := make(chan bool) // Make the channel buffered to ensure no event is dropped. Notify will drop // an event if the receiver is not able to keep up the sending ...
go
func (f *fsClient) Watch(params watchParams) (*watchObject, *probe.Error) { eventChan := make(chan EventInfo) errorChan := make(chan *probe.Error) doneChan := make(chan bool) // Make the channel buffered to ensure no event is dropped. Notify will drop // an event if the receiver is not able to keep up the sending ...
[ "func", "(", "f", "*", "fsClient", ")", "Watch", "(", "params", "watchParams", ")", "(", "*", "watchObject", ",", "*", "probe", ".", "Error", ")", "{", "eventChan", ":=", "make", "(", "chan", "EventInfo", ")", "\n", "errorChan", ":=", "make", "(", "c...
// Watches for all fs events on an input path.
[ "Watches", "for", "all", "fs", "events", "on", "an", "input", "path", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-fs.go#L120-L213
train
minio/mc
cmd/client-fs.go
Put
func (f *fsClient) Put(ctx context.Context, reader io.Reader, size int64, metadata map[string]string, progress io.Reader, sse encrypt.ServerSide) (int64, *probe.Error) { return f.put(reader, size, nil, progress) }
go
func (f *fsClient) Put(ctx context.Context, reader io.Reader, size int64, metadata map[string]string, progress io.Reader, sse encrypt.ServerSide) (int64, *probe.Error) { return f.put(reader, size, nil, progress) }
[ "func", "(", "f", "*", "fsClient", ")", "Put", "(", "ctx", "context", ".", "Context", ",", "reader", "io", ".", "Reader", ",", "size", "int64", ",", "metadata", "map", "[", "string", "]", "string", ",", "progress", "io", ".", "Reader", ",", "sse", ...
// Put - create a new file with metadata.
[ "Put", "-", "create", "a", "new", "file", "with", "metadata", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-fs.go#L345-L347
train
minio/mc
cmd/client-fs.go
ShareDownload
func (f *fsClient) ShareDownload(expires time.Duration) (string, *probe.Error) { return "", probe.NewError(APINotImplemented{ API: "ShareDownload", APIType: "filesystem", }) }
go
func (f *fsClient) ShareDownload(expires time.Duration) (string, *probe.Error) { return "", probe.NewError(APINotImplemented{ API: "ShareDownload", APIType: "filesystem", }) }
[ "func", "(", "f", "*", "fsClient", ")", "ShareDownload", "(", "expires", "time", ".", "Duration", ")", "(", "string", ",", "*", "probe", ".", "Error", ")", "{", "return", "\"", "\"", ",", "probe", ".", "NewError", "(", "APINotImplemented", "{", "API", ...
// ShareDownload - share download not implemented for filesystem.
[ "ShareDownload", "-", "share", "download", "not", "implemented", "for", "filesystem", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-fs.go#L350-L355
train
minio/mc
cmd/client-fs.go
ShareUpload
func (f *fsClient) ShareUpload(startsWith bool, expires time.Duration, contentType string) (string, map[string]string, *probe.Error) { return "", nil, probe.NewError(APINotImplemented{ API: "ShareUpload", APIType: "filesystem", }) }
go
func (f *fsClient) ShareUpload(startsWith bool, expires time.Duration, contentType string) (string, map[string]string, *probe.Error) { return "", nil, probe.NewError(APINotImplemented{ API: "ShareUpload", APIType: "filesystem", }) }
[ "func", "(", "f", "*", "fsClient", ")", "ShareUpload", "(", "startsWith", "bool", ",", "expires", "time", ".", "Duration", ",", "contentType", "string", ")", "(", "string", ",", "map", "[", "string", "]", "string", ",", "*", "probe", ".", "Error", ")",...
// ShareUpload - share upload not implemented for filesystem.
[ "ShareUpload", "-", "share", "upload", "not", "implemented", "for", "filesystem", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-fs.go#L358-L363
train
minio/mc
cmd/client-fs.go
readFile
func readFile(fpath string) (io.ReadCloser, error) { // Golang strips trailing / if you clean(..) or // EvalSymlinks(..). Adding '.' prevents it from doing so. if strings.HasSuffix(fpath, "/") { fpath = fpath + "." } fpath, e := filepath.EvalSymlinks(fpath) if e != nil { return nil, e } fileData, e := os.Op...
go
func readFile(fpath string) (io.ReadCloser, error) { // Golang strips trailing / if you clean(..) or // EvalSymlinks(..). Adding '.' prevents it from doing so. if strings.HasSuffix(fpath, "/") { fpath = fpath + "." } fpath, e := filepath.EvalSymlinks(fpath) if e != nil { return nil, e } fileData, e := os.Op...
[ "func", "readFile", "(", "fpath", "string", ")", "(", "io", ".", "ReadCloser", ",", "error", ")", "{", "// Golang strips trailing / if you clean(..) or", "// EvalSymlinks(..). Adding '.' prevents it from doing so.", "if", "strings", ".", "HasSuffix", "(", "fpath", ",", ...
// readFile reads and returns the data inside the file located // at the provided filepath.
[ "readFile", "reads", "and", "returns", "the", "data", "inside", "the", "file", "located", "at", "the", "provided", "filepath", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-fs.go#L367-L382
train
minio/mc
cmd/client-fs.go
Copy
func (f *fsClient) Copy(source string, size int64, progress io.Reader, srcSSE, tgtSSE encrypt.ServerSide, metadata map[string]string) *probe.Error { destination := f.PathURL.Path rc, e := readFile(source) if e != nil { err := f.toClientError(e, destination) return err.Trace(destination) } defer rc.Close() _,...
go
func (f *fsClient) Copy(source string, size int64, progress io.Reader, srcSSE, tgtSSE encrypt.ServerSide, metadata map[string]string) *probe.Error { destination := f.PathURL.Path rc, e := readFile(source) if e != nil { err := f.toClientError(e, destination) return err.Trace(destination) } defer rc.Close() _,...
[ "func", "(", "f", "*", "fsClient", ")", "Copy", "(", "source", "string", ",", "size", "int64", ",", "progress", "io", ".", "Reader", ",", "srcSSE", ",", "tgtSSE", "encrypt", ".", "ServerSide", ",", "metadata", "map", "[", "string", "]", "string", ")", ...
// Copy - copy data from source to destination
[ "Copy", "-", "copy", "data", "from", "source", "to", "destination" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-fs.go#L385-L399
train
minio/mc
cmd/client-fs.go
get
func (f *fsClient) get() (io.ReadCloser, *probe.Error) { tmppath := f.PathURL.Path // Golang strips trailing / if you clean(..) or // EvalSymlinks(..). Adding '.' prevents it from doing so. if strings.HasSuffix(tmppath, string(f.PathURL.Separator)) { tmppath = tmppath + "." } // Resolve symlinks. _, e := file...
go
func (f *fsClient) get() (io.ReadCloser, *probe.Error) { tmppath := f.PathURL.Path // Golang strips trailing / if you clean(..) or // EvalSymlinks(..). Adding '.' prevents it from doing so. if strings.HasSuffix(tmppath, string(f.PathURL.Separator)) { tmppath = tmppath + "." } // Resolve symlinks. _, e := file...
[ "func", "(", "f", "*", "fsClient", ")", "get", "(", ")", "(", "io", ".", "ReadCloser", ",", "*", "probe", ".", "Error", ")", "{", "tmppath", ":=", "f", ".", "PathURL", ".", "Path", "\n", "// Golang strips trailing / if you clean(..) or", "// EvalSymlinks(..)...
// get - get wrapper returning object reader.
[ "get", "-", "get", "wrapper", "returning", "object", "reader", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-fs.go#L402-L422
train
minio/mc
cmd/client-fs.go
Get
func (f *fsClient) Get(sse encrypt.ServerSide) (io.ReadCloser, *probe.Error) { return f.get() }
go
func (f *fsClient) Get(sse encrypt.ServerSide) (io.ReadCloser, *probe.Error) { return f.get() }
[ "func", "(", "f", "*", "fsClient", ")", "Get", "(", "sse", "encrypt", ".", "ServerSide", ")", "(", "io", ".", "ReadCloser", ",", "*", "probe", ".", "Error", ")", "{", "return", "f", ".", "get", "(", ")", "\n", "}" ]
// Get returns reader and any additional metadata.
[ "Get", "returns", "reader", "and", "any", "additional", "metadata", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-fs.go#L425-L427
train
minio/mc
cmd/client-fs.go
Remove
func (f *fsClient) Remove(isIncomplete, isRemoveBucket bool, contentCh <-chan *clientContent) <-chan *probe.Error { errorCh := make(chan *probe.Error) // Goroutine reads from contentCh and removes the entry in content. go func() { defer close(errorCh) for content := range contentCh { name := content.URL.Pat...
go
func (f *fsClient) Remove(isIncomplete, isRemoveBucket bool, contentCh <-chan *clientContent) <-chan *probe.Error { errorCh := make(chan *probe.Error) // Goroutine reads from contentCh and removes the entry in content. go func() { defer close(errorCh) for content := range contentCh { name := content.URL.Pat...
[ "func", "(", "f", "*", "fsClient", ")", "Remove", "(", "isIncomplete", ",", "isRemoveBucket", "bool", ",", "contentCh", "<-", "chan", "*", "clientContent", ")", "<-", "chan", "*", "probe", ".", "Error", "{", "errorCh", ":=", "make", "(", "chan", "*", "...
// Remove - remove entry read from clientContent channel.
[ "Remove", "-", "remove", "entry", "read", "from", "clientContent", "channel", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-fs.go#L430-L456
train
minio/mc
cmd/client-fs.go
List
func (f *fsClient) List(isRecursive, isIncomplete bool, showDir DirOpt) <-chan *clientContent { contentCh := make(chan *clientContent) filteredCh := make(chan *clientContent) if isRecursive { if showDir == DirNone { go f.listRecursiveInRoutine(contentCh) } else { go f.listDirOpt(contentCh, isIncomplete, s...
go
func (f *fsClient) List(isRecursive, isIncomplete bool, showDir DirOpt) <-chan *clientContent { contentCh := make(chan *clientContent) filteredCh := make(chan *clientContent) if isRecursive { if showDir == DirNone { go f.listRecursiveInRoutine(contentCh) } else { go f.listDirOpt(contentCh, isIncomplete, s...
[ "func", "(", "f", "*", "fsClient", ")", "List", "(", "isRecursive", ",", "isIncomplete", "bool", ",", "showDir", "DirOpt", ")", "<-", "chan", "*", "clientContent", "{", "contentCh", ":=", "make", "(", "chan", "*", "clientContent", ")", "\n", "filteredCh", ...
// List - list files and folders.
[ "List", "-", "list", "files", "and", "folders", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-fs.go#L459-L496
train
minio/mc
cmd/client-fs.go
readDir
func readDir(dirname string) ([]os.FileInfo, error) { f, e := os.Open(dirname) if e != nil { return nil, e } list, e := f.Readdir(-1) if e != nil { return nil, e } if e = f.Close(); e != nil { return nil, e } sort.Sort(byDirName(list)) return list, nil }
go
func readDir(dirname string) ([]os.FileInfo, error) { f, e := os.Open(dirname) if e != nil { return nil, e } list, e := f.Readdir(-1) if e != nil { return nil, e } if e = f.Close(); e != nil { return nil, e } sort.Sort(byDirName(list)) return list, nil }
[ "func", "readDir", "(", "dirname", "string", ")", "(", "[", "]", "os", ".", "FileInfo", ",", "error", ")", "{", "f", ",", "e", ":=", "os", ".", "Open", "(", "dirname", ")", "\n", "if", "e", "!=", "nil", "{", "return", "nil", ",", "e", "\n", "...
// readDir reads the directory named by dirname and returns // a list of sorted directory entries.
[ "readDir", "reads", "the", "directory", "named", "by", "dirname", "and", "returns", "a", "list", "of", "sorted", "directory", "entries", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-fs.go#L519-L533
train
minio/mc
cmd/client-fs.go
listPrefixes
func (f *fsClient) listPrefixes(prefix string, contentCh chan<- *clientContent) { dirName := filepath.Dir(prefix) files, e := readDir(dirName) if e != nil { err := f.toClientError(e, dirName) contentCh <- &clientContent{ Err: err.Trace(dirName), } return } pathURL := *f.PathURL for _, fi := range files...
go
func (f *fsClient) listPrefixes(prefix string, contentCh chan<- *clientContent) { dirName := filepath.Dir(prefix) files, e := readDir(dirName) if e != nil { err := f.toClientError(e, dirName) contentCh <- &clientContent{ Err: err.Trace(dirName), } return } pathURL := *f.PathURL for _, fi := range files...
[ "func", "(", "f", "*", "fsClient", ")", "listPrefixes", "(", "prefix", "string", ",", "contentCh", "chan", "<-", "*", "clientContent", ")", "{", "dirName", ":=", "filepath", ".", "Dir", "(", "prefix", ")", "\n", "files", ",", "e", ":=", "readDir", "(",...
// listPrefixes - list all files for any given prefix.
[ "listPrefixes", "-", "list", "all", "files", "for", "any", "given", "prefix", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-fs.go#L536-L602
train
minio/mc
cmd/client-fs.go
listDirOpt
func (f *fsClient) listDirOpt(contentCh chan *clientContent, isIncomplete bool, dirOpt DirOpt) { defer close(contentCh) // Trim trailing / or \. currentPath := f.PathURL.Path currentPath = strings.TrimSuffix(currentPath, "/") if runtime.GOOS == "windows" { currentPath = strings.TrimSuffix(currentPath, `\`) } ...
go
func (f *fsClient) listDirOpt(contentCh chan *clientContent, isIncomplete bool, dirOpt DirOpt) { defer close(contentCh) // Trim trailing / or \. currentPath := f.PathURL.Path currentPath = strings.TrimSuffix(currentPath, "/") if runtime.GOOS == "windows" { currentPath = strings.TrimSuffix(currentPath, `\`) } ...
[ "func", "(", "f", "*", "fsClient", ")", "listDirOpt", "(", "contentCh", "chan", "*", "clientContent", ",", "isIncomplete", "bool", ",", "dirOpt", "DirOpt", ")", "{", "defer", "close", "(", "contentCh", ")", "\n\n", "// Trim trailing / or \\.", "currentPath", "...
// List files recursively using non-recursive mode.
[ "List", "files", "recursively", "using", "non", "-", "recursive", "mode", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-fs.go#L698-L762
train
minio/mc
cmd/client-fs.go
MakeBucket
func (f *fsClient) MakeBucket(region string, ignoreExisting bool) *probe.Error { // TODO: ignoreExisting has no effect currently. In the future, we want // to call os.Mkdir() when ignoredExisting is disabled and os.MkdirAll() // otherwise. e := os.MkdirAll(f.PathURL.Path, 0777) if e != nil { return probe.NewErro...
go
func (f *fsClient) MakeBucket(region string, ignoreExisting bool) *probe.Error { // TODO: ignoreExisting has no effect currently. In the future, we want // to call os.Mkdir() when ignoredExisting is disabled and os.MkdirAll() // otherwise. e := os.MkdirAll(f.PathURL.Path, 0777) if e != nil { return probe.NewErro...
[ "func", "(", "f", "*", "fsClient", ")", "MakeBucket", "(", "region", "string", ",", "ignoreExisting", "bool", ")", "*", "probe", ".", "Error", "{", "// TODO: ignoreExisting has no effect currently. In the future, we want", "// to call os.Mkdir() when ignoredExisting is disabl...
// MakeBucket - create a new bucket.
[ "MakeBucket", "-", "create", "a", "new", "bucket", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-fs.go#L891-L900
train
minio/mc
cmd/client-fs.go
GetAccessRules
func (f *fsClient) GetAccessRules() (map[string]string, *probe.Error) { return map[string]string{}, probe.NewError(APINotImplemented{ API: "ListBucketPolicies", APIType: "filesystem", }) }
go
func (f *fsClient) GetAccessRules() (map[string]string, *probe.Error) { return map[string]string{}, probe.NewError(APINotImplemented{ API: "ListBucketPolicies", APIType: "filesystem", }) }
[ "func", "(", "f", "*", "fsClient", ")", "GetAccessRules", "(", ")", "(", "map", "[", "string", "]", "string", ",", "*", "probe", ".", "Error", ")", "{", "return", "map", "[", "string", "]", "string", "{", "}", ",", "probe", ".", "NewError", "(", ...
// GetAccessRules - unsupported API
[ "GetAccessRules", "-", "unsupported", "API" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-fs.go#L903-L908
train
minio/mc
cmd/client-fs.go
GetAccess
func (f *fsClient) GetAccess() (access string, policyJSON string, err *probe.Error) { // For windows this feature is not implemented. if runtime.GOOS == "windows" { return "", "", probe.NewError(APINotImplemented{API: "GetAccess", APIType: "filesystem"}) } st, err := f.fsStat(false) if err != nil { return "", ...
go
func (f *fsClient) GetAccess() (access string, policyJSON string, err *probe.Error) { // For windows this feature is not implemented. if runtime.GOOS == "windows" { return "", "", probe.NewError(APINotImplemented{API: "GetAccess", APIType: "filesystem"}) } st, err := f.fsStat(false) if err != nil { return "", ...
[ "func", "(", "f", "*", "fsClient", ")", "GetAccess", "(", ")", "(", "access", "string", ",", "policyJSON", "string", ",", "err", "*", "probe", ".", "Error", ")", "{", "// For windows this feature is not implemented.", "if", "runtime", ".", "GOOS", "==", "\""...
// GetAccess - get access policy permissions.
[ "GetAccess", "-", "get", "access", "policy", "permissions", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-fs.go#L911-L933
train
minio/mc
cmd/client-fs.go
SetAccess
func (f *fsClient) SetAccess(access string, isJSON bool) *probe.Error { // For windows this feature is not implemented. // JSON policy for fs is not yet implemented. if runtime.GOOS == "windows" || isJSON { return probe.NewError(APINotImplemented{API: "SetAccess", APIType: "filesystem"}) } st, err := f.fsStat(fa...
go
func (f *fsClient) SetAccess(access string, isJSON bool) *probe.Error { // For windows this feature is not implemented. // JSON policy for fs is not yet implemented. if runtime.GOOS == "windows" || isJSON { return probe.NewError(APINotImplemented{API: "SetAccess", APIType: "filesystem"}) } st, err := f.fsStat(fa...
[ "func", "(", "f", "*", "fsClient", ")", "SetAccess", "(", "access", "string", ",", "isJSON", "bool", ")", "*", "probe", ".", "Error", "{", "// For windows this feature is not implemented.", "// JSON policy for fs is not yet implemented.", "if", "runtime", ".", "GOOS",...
// SetAccess - set access policy permissions.
[ "SetAccess", "-", "set", "access", "policy", "permissions", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-fs.go#L936-L965
train
minio/mc
cmd/client-fs.go
Stat
func (f *fsClient) Stat(isIncomplete, isFetchMeta bool, sse encrypt.ServerSide) (content *clientContent, err *probe.Error) { st, err := f.fsStat(isIncomplete) if err != nil { return nil, err.Trace(f.PathURL.String()) } content = &clientContent{} content.URL = *f.PathURL content.Size = st.Size() content.Time =...
go
func (f *fsClient) Stat(isIncomplete, isFetchMeta bool, sse encrypt.ServerSide) (content *clientContent, err *probe.Error) { st, err := f.fsStat(isIncomplete) if err != nil { return nil, err.Trace(f.PathURL.String()) } content = &clientContent{} content.URL = *f.PathURL content.Size = st.Size() content.Time =...
[ "func", "(", "f", "*", "fsClient", ")", "Stat", "(", "isIncomplete", ",", "isFetchMeta", "bool", ",", "sse", "encrypt", ".", "ServerSide", ")", "(", "content", "*", "clientContent", ",", "err", "*", "probe", ".", "Error", ")", "{", "st", ",", "err", ...
// Stat - get metadata from path.
[ "Stat", "-", "get", "metadata", "from", "path", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-fs.go#L968-L997
train
minio/mc
cmd/client-fs.go
toClientError
func (f *fsClient) toClientError(e error, fpath string) *probe.Error { if os.IsPermission(e) { return probe.NewError(PathInsufficientPermission{Path: fpath}) } if os.IsNotExist(e) { return probe.NewError(PathNotFound{Path: fpath}) } return probe.NewError(e) }
go
func (f *fsClient) toClientError(e error, fpath string) *probe.Error { if os.IsPermission(e) { return probe.NewError(PathInsufficientPermission{Path: fpath}) } if os.IsNotExist(e) { return probe.NewError(PathNotFound{Path: fpath}) } return probe.NewError(e) }
[ "func", "(", "f", "*", "fsClient", ")", "toClientError", "(", "e", "error", ",", "fpath", "string", ")", "*", "probe", ".", "Error", "{", "if", "os", ".", "IsPermission", "(", "e", ")", "{", "return", "probe", ".", "NewError", "(", "PathInsufficientPer...
// toClientError error constructs a typed client error for known filesystem errors.
[ "toClientError", "error", "constructs", "a", "typed", "client", "error", "for", "known", "filesystem", "errors", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-fs.go#L1000-L1008
train
minio/mc
cmd/client-fs.go
fsStat
func (f *fsClient) fsStat(isIncomplete bool) (os.FileInfo, *probe.Error) { fpath := f.PathURL.Path // Check if the path corresponds to a directory and returns // the successful result whether isIncomplete is specified or not. st, e := os.Stat(fpath) if e == nil && st.IsDir() { return st, nil } if isIncomplet...
go
func (f *fsClient) fsStat(isIncomplete bool) (os.FileInfo, *probe.Error) { fpath := f.PathURL.Path // Check if the path corresponds to a directory and returns // the successful result whether isIncomplete is specified or not. st, e := os.Stat(fpath) if e == nil && st.IsDir() { return st, nil } if isIncomplet...
[ "func", "(", "f", "*", "fsClient", ")", "fsStat", "(", "isIncomplete", "bool", ")", "(", "os", ".", "FileInfo", ",", "*", "probe", ".", "Error", ")", "{", "fpath", ":=", "f", ".", "PathURL", ".", "Path", "\n\n", "// Check if the path corresponds to a direc...
// fsStat - wrapper function to get file stat.
[ "fsStat", "-", "wrapper", "function", "to", "get", "file", "stat", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-fs.go#L1011-L1050
train
minio/mc
cmd/sql-main.go
getSQLFlags
func getSQLFlags() []cli.Flag { flags := append(sqlFlags, ioFlags...) for _, f := range globalFlags { if f.GetName() != "json" { flags = append(flags, f) } } return flags }
go
func getSQLFlags() []cli.Flag { flags := append(sqlFlags, ioFlags...) for _, f := range globalFlags { if f.GetName() != "json" { flags = append(flags, f) } } return flags }
[ "func", "getSQLFlags", "(", ")", "[", "]", "cli", ".", "Flag", "{", "flags", ":=", "append", "(", "sqlFlags", ",", "ioFlags", "...", ")", "\n", "for", "_", ",", "f", ":=", "range", "globalFlags", "{", "if", "f", ".", "GetName", "(", ")", "!=", "\...
// filter json from allowed flags for sql command
[ "filter", "json", "from", "allowed", "flags", "for", "sql", "command" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/sql-main.go#L127-L135
train
minio/mc
cmd/sql-main.go
parseKVArgs
func parseKVArgs(is string) (map[string]string, *probe.Error) { kvmap := make(map[string]string) var key, value string var s, e int // tracking start and end of value var index int // current index in string if is != "" { for index < len(is) { i := strings.Index(is[index:], "=") if i == -1 { return ni...
go
func parseKVArgs(is string) (map[string]string, *probe.Error) { kvmap := make(map[string]string) var key, value string var s, e int // tracking start and end of value var index int // current index in string if is != "" { for index < len(is) { i := strings.Index(is[index:], "=") if i == -1 { return ni...
[ "func", "parseKVArgs", "(", "is", "string", ")", "(", "map", "[", "string", "]", "string", ",", "*", "probe", ".", "Error", ")", "{", "kvmap", ":=", "make", "(", "map", "[", "string", "]", "string", ")", "\n", "var", "key", ",", "value", "string", ...
// parseKVArgs parses string of the form k=v delimited by "," // into a map of k-v pairs
[ "parseKVArgs", "parses", "string", "of", "the", "form", "k", "=", "v", "delimited", "by", "into", "a", "map", "of", "k", "-", "v", "pairs" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/sql-main.go#L154-L197
train
minio/mc
cmd/sql-main.go
parseSerializationOpts
func parseSerializationOpts(inp string, validKeys []string, validAbbrKeys map[string]string) (map[string]string, *probe.Error) { if validAbbrKeys == nil { validAbbrKeys = make(map[string]string) } validKeyFn := func(key string, validKeys []string) bool { for _, name := range validKeys { if strings.ToLower(nam...
go
func parseSerializationOpts(inp string, validKeys []string, validAbbrKeys map[string]string) (map[string]string, *probe.Error) { if validAbbrKeys == nil { validAbbrKeys = make(map[string]string) } validKeyFn := func(key string, validKeys []string) bool { for _, name := range validKeys { if strings.ToLower(nam...
[ "func", "parseSerializationOpts", "(", "inp", "string", ",", "validKeys", "[", "]", "string", ",", "validAbbrKeys", "map", "[", "string", "]", "string", ")", "(", "map", "[", "string", "]", "string", ",", "*", "probe", ".", "Error", ")", "{", "if", "va...
// parses the input string and constructs a k-v map, replacing any abbreviated keys with actual keys
[ "parses", "the", "input", "string", "and", "constructs", "a", "k", "-", "v", "map", "replacing", "any", "abbreviated", "keys", "with", "actual", "keys" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/sql-main.go#L219-L250
train
minio/mc
cmd/sql-main.go
getInputSerializationOpts
func getInputSerializationOpts(ctx *cli.Context) map[string]map[string]string { icsv := ctx.String("csv-input") ijson := ctx.String("json-input") m := make(map[string]map[string]string) csvType := ctx.IsSet("csv-input") jsonType := ctx.IsSet("json-input") if csvType && jsonType { fatalIf(errInvalidArgument(), ...
go
func getInputSerializationOpts(ctx *cli.Context) map[string]map[string]string { icsv := ctx.String("csv-input") ijson := ctx.String("json-input") m := make(map[string]map[string]string) csvType := ctx.IsSet("csv-input") jsonType := ctx.IsSet("json-input") if csvType && jsonType { fatalIf(errInvalidArgument(), ...
[ "func", "getInputSerializationOpts", "(", "ctx", "*", "cli", ".", "Context", ")", "map", "[", "string", "]", "map", "[", "string", "]", "string", "{", "icsv", ":=", "ctx", ".", "String", "(", "\"", "\"", ")", "\n", "ijson", ":=", "ctx", ".", "String"...
// gets the input serialization opts from cli context and constructs a map of csv, json or parquet options
[ "gets", "the", "input", "serialization", "opts", "from", "cli", "context", "and", "constructs", "a", "map", "of", "csv", "json", "or", "parquet", "options" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/sql-main.go#L253-L278
train
minio/mc
cmd/sql-main.go
getOutputSerializationOpts
func getOutputSerializationOpts(ctx *cli.Context, csvHdrs []string) (opts map[string]map[string]string) { m := make(map[string]map[string]string) ocsv := ctx.String("csv-output") ojson := ctx.String("json-output") csvType := ctx.IsSet("csv-output") jsonType := ctx.IsSet("json-output") if csvType && jsonType { ...
go
func getOutputSerializationOpts(ctx *cli.Context, csvHdrs []string) (opts map[string]map[string]string) { m := make(map[string]map[string]string) ocsv := ctx.String("csv-output") ojson := ctx.String("json-output") csvType := ctx.IsSet("csv-output") jsonType := ctx.IsSet("json-output") if csvType && jsonType { ...
[ "func", "getOutputSerializationOpts", "(", "ctx", "*", "cli", ".", "Context", ",", "csvHdrs", "[", "]", "string", ")", "(", "opts", "map", "[", "string", "]", "map", "[", "string", "]", "string", ")", "{", "m", ":=", "make", "(", "map", "[", "string"...
// gets the output serialization opts from cli context and constructs a map of csv or json options
[ "gets", "the", "output", "serialization", "opts", "from", "cli", "context", "and", "constructs", "a", "map", "of", "csv", "or", "json", "options" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/sql-main.go#L281-L310
train
minio/mc
cmd/sql-main.go
getCSVHeader
func getCSVHeader(sourceURL string, encKeyDB map[string][]prefixSSEPair) ([]string, *probe.Error) { var r io.ReadCloser switch sourceURL { case "-": r = os.Stdin default: var err *probe.Error var metadata map[string]string if r, metadata, err = getSourceStreamMetadataFromURL(sourceURL, encKeyDB); err != nil...
go
func getCSVHeader(sourceURL string, encKeyDB map[string][]prefixSSEPair) ([]string, *probe.Error) { var r io.ReadCloser switch sourceURL { case "-": r = os.Stdin default: var err *probe.Error var metadata map[string]string if r, metadata, err = getSourceStreamMetadataFromURL(sourceURL, encKeyDB); err != nil...
[ "func", "getCSVHeader", "(", "sourceURL", "string", ",", "encKeyDB", "map", "[", "string", "]", "[", "]", "prefixSSEPair", ")", "(", "[", "]", "string", ",", "*", "probe", ".", "Error", ")", "{", "var", "r", "io", ".", "ReadCloser", "\n", "switch", "...
// getCSVHeader fetches the first line of csv query object
[ "getCSVHeader", "fetches", "the", "first", "line", "of", "csv", "query", "object" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/sql-main.go#L313-L345
train
minio/mc
cmd/sql-main.go
isSelectAll
func isSelectAll(query string) bool { match, _ := regexp.MatchString("^\\s*?select\\s+?\\*\\s+?.*?$", query) return match }
go
func isSelectAll(query string) bool { match, _ := regexp.MatchString("^\\s*?select\\s+?\\*\\s+?.*?$", query) return match }
[ "func", "isSelectAll", "(", "query", "string", ")", "bool", "{", "match", ",", "_", ":=", "regexp", ".", "MatchString", "(", "\"", "\\\\", "\\\\", "\\\\", "\\\\", "\"", ",", "query", ")", "\n", "return", "match", "\n", "}" ]
// returns true if query is selectign all columns of the csv object
[ "returns", "true", "if", "query", "is", "selectign", "all", "columns", "of", "the", "csv", "object" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/sql-main.go#L348-L351
train
minio/mc
cmd/sql-main.go
getCSVOutputHeaders
func getCSVOutputHeaders(ctx *cli.Context, url string, encKeyDB map[string][]prefixSSEPair, query string) (hdrs []string) { if !ctx.IsSet("csv-output-header") { return } hdrStr := ctx.String("csv-output-header") if hdrStr == "" && isSelectAll(query) { // attempt to get the first line of csv as header if hdrs...
go
func getCSVOutputHeaders(ctx *cli.Context, url string, encKeyDB map[string][]prefixSSEPair, query string) (hdrs []string) { if !ctx.IsSet("csv-output-header") { return } hdrStr := ctx.String("csv-output-header") if hdrStr == "" && isSelectAll(query) { // attempt to get the first line of csv as header if hdrs...
[ "func", "getCSVOutputHeaders", "(", "ctx", "*", "cli", ".", "Context", ",", "url", "string", ",", "encKeyDB", "map", "[", "string", "]", "[", "]", "prefixSSEPair", ",", "query", "string", ")", "(", "hdrs", "[", "]", "string", ")", "{", "if", "!", "ct...
// if csv-output-header is set to a comma delimited string use it, othjerwise attempt to get the header from // query object
[ "if", "csv", "-", "output", "-", "header", "is", "set", "to", "a", "comma", "delimited", "string", "use", "it", "othjerwise", "attempt", "to", "get", "the", "header", "from", "query", "object" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/sql-main.go#L355-L369
train
minio/mc
cmd/sql-main.go
getSQLOpts
func getSQLOpts(ctx *cli.Context, csvHdrs []string) (s SelectObjectOpts) { is := getInputSerializationOpts(ctx) os := getOutputSerializationOpts(ctx, csvHdrs) return SelectObjectOpts{ InputSerOpts: is, OutputSerOpts: os, } }
go
func getSQLOpts(ctx *cli.Context, csvHdrs []string) (s SelectObjectOpts) { is := getInputSerializationOpts(ctx) os := getOutputSerializationOpts(ctx, csvHdrs) return SelectObjectOpts{ InputSerOpts: is, OutputSerOpts: os, } }
[ "func", "getSQLOpts", "(", "ctx", "*", "cli", ".", "Context", ",", "csvHdrs", "[", "]", "string", ")", "(", "s", "SelectObjectOpts", ")", "{", "is", ":=", "getInputSerializationOpts", "(", "ctx", ")", "\n", "os", ":=", "getOutputSerializationOpts", "(", "c...
// get the Select options for sql select API
[ "get", "the", "Select", "options", "for", "sql", "select", "API" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/sql-main.go#L372-L380
train
minio/mc
cmd/sql-main.go
getAndValidateArgs
func getAndValidateArgs(ctx *cli.Context, encKeyDB map[string][]prefixSSEPair, url string) (query string, csvHdrs []string, selOpts SelectObjectOpts) { query = ctx.String("query") csvHdrs = getCSVOutputHeaders(ctx, url, encKeyDB, query) selOpts = getSQLOpts(ctx, csvHdrs) validateOpts(selOpts, url) return }
go
func getAndValidateArgs(ctx *cli.Context, encKeyDB map[string][]prefixSSEPair, url string) (query string, csvHdrs []string, selOpts SelectObjectOpts) { query = ctx.String("query") csvHdrs = getCSVOutputHeaders(ctx, url, encKeyDB, query) selOpts = getSQLOpts(ctx, csvHdrs) validateOpts(selOpts, url) return }
[ "func", "getAndValidateArgs", "(", "ctx", "*", "cli", ".", "Context", ",", "encKeyDB", "map", "[", "string", "]", "[", "]", "prefixSSEPair", ",", "url", "string", ")", "(", "query", "string", ",", "csvHdrs", "[", "]", "string", ",", "selOpts", "SelectObj...
// validate args and optionally fetch the csv header of query object
[ "validate", "args", "and", "optionally", "fetch", "the", "csv", "header", "of", "query", "object" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/sql-main.go#L426-L432
train
minio/mc
cmd/sql-main.go
checkSQLSyntax
func checkSQLSyntax(ctx *cli.Context) { if !ctx.Args().Present() { cli.ShowCommandHelpAndExit(ctx, "sql", 1) // last argument is exit code. } }
go
func checkSQLSyntax(ctx *cli.Context) { if !ctx.Args().Present() { cli.ShowCommandHelpAndExit(ctx, "sql", 1) // last argument is exit code. } }
[ "func", "checkSQLSyntax", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "if", "!", "ctx", ".", "Args", "(", ")", ".", "Present", "(", ")", "{", "cli", ".", "ShowCommandHelpAndExit", "(", "ctx", ",", "\"", "\"", ",", "1", ")", "// last argument is...
// check sql input arguments.
[ "check", "sql", "input", "arguments", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/sql-main.go#L435-L439
train
minio/mc
cmd/sql-main.go
mainSQL
func mainSQL(ctx *cli.Context) error { var ( csvHdrs []string selOpts SelectObjectOpts query string ) // Parse encryption keys per command. encKeyDB, err := getEncKeys(ctx) fatalIf(err, "Unable to parse encryption keys.") // validate sql input arguments. checkSQLSyntax(ctx) // extract URLs. URLs := ct...
go
func mainSQL(ctx *cli.Context) error { var ( csvHdrs []string selOpts SelectObjectOpts query string ) // Parse encryption keys per command. encKeyDB, err := getEncKeys(ctx) fatalIf(err, "Unable to parse encryption keys.") // validate sql input arguments. checkSQLSyntax(ctx) // extract URLs. URLs := ct...
[ "func", "mainSQL", "(", "ctx", "*", "cli", ".", "Context", ")", "error", "{", "var", "(", "csvHdrs", "[", "]", "string", "\n", "selOpts", "SelectObjectOpts", "\n", "query", "string", "\n", ")", "\n", "// Parse encryption keys per command.", "encKeyDB", ",", ...
// mainSQL is the main entry point for sql command.
[ "mainSQL", "is", "the", "main", "entry", "point", "for", "sql", "command", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/sql-main.go#L442-L494
train
minio/mc
cmd/flags.go
registerCmd
func registerCmd(cmd cli.Command) { commands = append(commands, cmd) commandsTree.Insert(cmd.Name) }
go
func registerCmd(cmd cli.Command) { commands = append(commands, cmd) commandsTree.Insert(cmd.Name) }
[ "func", "registerCmd", "(", "cmd", "cli", ".", "Command", ")", "{", "commands", "=", "append", "(", "commands", ",", "cmd", ")", "\n", "commandsTree", ".", "Insert", "(", "cmd", ".", "Name", ")", "\n", "}" ]
// registerCmd registers a cli command
[ "registerCmd", "registers", "a", "cli", "command" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/flags.go#L68-L71
train
minio/mc
cmd/update-main.go
GetCurrentReleaseTime
func GetCurrentReleaseTime() (releaseTime time.Time, err *probe.Error) { if releaseTime, err = mcVersionToReleaseTime(Version); err == nil { return releaseTime, nil } // Looks like version is mc non-standard, we use mc // binary's ModTime as release time: path, e := os.Executable() if e != nil { return relea...
go
func GetCurrentReleaseTime() (releaseTime time.Time, err *probe.Error) { if releaseTime, err = mcVersionToReleaseTime(Version); err == nil { return releaseTime, nil } // Looks like version is mc non-standard, we use mc // binary's ModTime as release time: path, e := os.Executable() if e != nil { return relea...
[ "func", "GetCurrentReleaseTime", "(", ")", "(", "releaseTime", "time", ".", "Time", ",", "err", "*", "probe", ".", "Error", ")", "{", "if", "releaseTime", ",", "err", "=", "mcVersionToReleaseTime", "(", "Version", ")", ";", "err", "==", "nil", "{", "retu...
// GetCurrentReleaseTime - returns this process's release time. If it // is official mc version, parsed version is returned else mc // binary's mod time is returned.
[ "GetCurrentReleaseTime", "-", "returns", "this", "process", "s", "release", "time", ".", "If", "it", "is", "official", "mc", "version", "parsed", "version", "is", "returned", "else", "mc", "binary", "s", "mod", "time", "is", "returned", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/update-main.go#L150-L162
train
minio/mc
cmd/update-main.go
DownloadReleaseData
func DownloadReleaseData(timeout time.Duration) (data string, err *probe.Error) { releaseURLs := mcReleaseInfoURLs if runtime.GOOS == "windows" { releaseURLs = mcReleaseWindowsInfoURLs } return func() (data string, err *probe.Error) { for _, url := range releaseURLs { data, err = downloadReleaseURL(url, time...
go
func DownloadReleaseData(timeout time.Duration) (data string, err *probe.Error) { releaseURLs := mcReleaseInfoURLs if runtime.GOOS == "windows" { releaseURLs = mcReleaseWindowsInfoURLs } return func() (data string, err *probe.Error) { for _, url := range releaseURLs { data, err = downloadReleaseURL(url, time...
[ "func", "DownloadReleaseData", "(", "timeout", "time", ".", "Duration", ")", "(", "data", "string", ",", "err", "*", "probe", ".", "Error", ")", "{", "releaseURLs", ":=", "mcReleaseInfoURLs", "\n", "if", "runtime", ".", "GOOS", "==", "\"", "\"", "{", "re...
// DownloadReleaseData - downloads release data from mc official server.
[ "DownloadReleaseData", "-", "downloads", "release", "data", "from", "mc", "official", "server", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/update-main.go#L277-L291
train
minio/mc
cmd/progress-bar.go
newProgressBar
func newProgressBar(total int64) *progressBar { // Progress bar speific theme customization. console.SetColor("Bar", color.New(color.FgGreen, color.Bold)) pgbar := progressBar{} // get the new original progress bar. bar := pb.New64(total) // Set new human friendly print units. bar.SetUnits(pb.U_BYTES) // Re...
go
func newProgressBar(total int64) *progressBar { // Progress bar speific theme customization. console.SetColor("Bar", color.New(color.FgGreen, color.Bold)) pgbar := progressBar{} // get the new original progress bar. bar := pb.New64(total) // Set new human friendly print units. bar.SetUnits(pb.U_BYTES) // Re...
[ "func", "newProgressBar", "(", "total", "int64", ")", "*", "progressBar", "{", "// Progress bar speific theme customization.", "console", ".", "SetColor", "(", "\"", "\"", ",", "color", ".", "New", "(", "color", ".", "FgGreen", ",", "color", ".", "Bold", ")", ...
// newProgressBar - instantiate a progress bar.
[ "newProgressBar", "-", "instantiate", "a", "progress", "bar", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/progress-bar.go#L36-L85
train
minio/mc
cmd/progress-bar.go
SetCaption
func (p *progressBar) SetCaption(caption string) *progressBar { caption = fixateBarCaption(caption, getFixedWidth(p.ProgressBar.GetWidth(), 18)) p.ProgressBar.Prefix(caption) return p }
go
func (p *progressBar) SetCaption(caption string) *progressBar { caption = fixateBarCaption(caption, getFixedWidth(p.ProgressBar.GetWidth(), 18)) p.ProgressBar.Prefix(caption) return p }
[ "func", "(", "p", "*", "progressBar", ")", "SetCaption", "(", "caption", "string", ")", "*", "progressBar", "{", "caption", "=", "fixateBarCaption", "(", "caption", ",", "getFixedWidth", "(", "p", ".", "ProgressBar", ".", "GetWidth", "(", ")", ",", "18", ...
// Set caption.
[ "Set", "caption", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/progress-bar.go#L88-L92
train
minio/mc
cmd/progress-bar.go
cursorAnimate
func cursorAnimate() <-chan string { cursorCh := make(chan string) var cursors string switch runtime.GOOS { case "linux": // cursors = "➩➪➫➬➭➮➯➱" // cursors = "▁▃▄▅▆▇█▇▆▅▄▃" cursors = "◐◓◑◒" // cursors = "←↖↑↗→↘↓↙" // cursors = "◴◷◶◵" // cursors = "◰◳◲◱" //cursors = "⣾⣽⣻⢿⡿⣟⣯⣷" case "darwin": curso...
go
func cursorAnimate() <-chan string { cursorCh := make(chan string) var cursors string switch runtime.GOOS { case "linux": // cursors = "➩➪➫➬➭➮➯➱" // cursors = "▁▃▄▅▆▇█▇▆▅▄▃" cursors = "◐◓◑◒" // cursors = "←↖↑↗→↘↓↙" // cursors = "◴◷◶◵" // cursors = "◰◳◲◱" //cursors = "⣾⣽⣻⢿⡿⣟⣯⣷" case "darwin": curso...
[ "func", "cursorAnimate", "(", ")", "<-", "chan", "string", "{", "cursorCh", ":=", "make", "(", "chan", "string", ")", "\n", "var", "cursors", "string", "\n\n", "switch", "runtime", ".", "GOOS", "{", "case", "\"", "\"", ":", "// cursors = \"➩➪➫➬➭➮➯➱\"", "//...
// cursorAnimate - returns a animated rune through read channel for every read.
[ "cursorAnimate", "-", "returns", "a", "animated", "rune", "through", "read", "channel", "for", "every", "read", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/progress-bar.go#L118-L144
train
minio/mc
cmd/progress-bar.go
fixateBarCaption
func fixateBarCaption(caption string, width int) string { switch { case len(caption) > width: // Trim caption to fit within the screen trimSize := len(caption) - width + 3 if trimSize < len(caption) { caption = "..." + caption[trimSize:] } case len(caption) < width: caption += strings.Repeat(" ", width-...
go
func fixateBarCaption(caption string, width int) string { switch { case len(caption) > width: // Trim caption to fit within the screen trimSize := len(caption) - width + 3 if trimSize < len(caption) { caption = "..." + caption[trimSize:] } case len(caption) < width: caption += strings.Repeat(" ", width-...
[ "func", "fixateBarCaption", "(", "caption", "string", ",", "width", "int", ")", "string", "{", "switch", "{", "case", "len", "(", "caption", ")", ">", "width", ":", "// Trim caption to fit within the screen", "trimSize", ":=", "len", "(", "caption", ")", "-", ...
// fixateBarCaption - fancify bar caption based on the terminal width.
[ "fixateBarCaption", "-", "fancify", "bar", "caption", "based", "on", "the", "terminal", "width", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/progress-bar.go#L147-L159
train
minio/mc
cmd/cp-url.go
guessCopyURLType
func guessCopyURLType(sourceURLs []string, targetURL string, isRecursive bool, keys map[string][]prefixSSEPair) (copyURLsType, *probe.Error) { if len(sourceURLs) == 1 { // 1 Source, 1 Target sourceURL := sourceURLs[0] _, sourceContent, err := url2Stat(sourceURL, false, keys) if err != nil { return copyURLsTyp...
go
func guessCopyURLType(sourceURLs []string, targetURL string, isRecursive bool, keys map[string][]prefixSSEPair) (copyURLsType, *probe.Error) { if len(sourceURLs) == 1 { // 1 Source, 1 Target sourceURL := sourceURLs[0] _, sourceContent, err := url2Stat(sourceURL, false, keys) if err != nil { return copyURLsTyp...
[ "func", "guessCopyURLType", "(", "sourceURLs", "[", "]", "string", ",", "targetURL", "string", ",", "isRecursive", "bool", ",", "keys", "map", "[", "string", "]", "[", "]", "prefixSSEPair", ")", "(", "copyURLsType", ",", "*", "probe", ".", "Error", ")", ...
// guessCopyURLType guesses the type of clientURL. This approach all allows prepareURL // functions to accurately report failure causes.
[ "guessCopyURLType", "guesses", "the", "type", "of", "clientURL", ".", "This", "approach", "all", "allows", "prepareURL", "functions", "to", "accurately", "report", "failure", "causes", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/cp-url.go#L53-L81
train
minio/mc
cmd/cp-url.go
makeCopyContentTypeA
func makeCopyContentTypeA(sourceAlias string, sourceContent *clientContent, targetAlias string, targetURL string, encKeyDB map[string][]prefixSSEPair) URLs { targetContent := clientContent{URL: *newClientURL(targetURL)} return URLs{ SourceAlias: sourceAlias, SourceContent: sourceContent, TargetAlias: target...
go
func makeCopyContentTypeA(sourceAlias string, sourceContent *clientContent, targetAlias string, targetURL string, encKeyDB map[string][]prefixSSEPair) URLs { targetContent := clientContent{URL: *newClientURL(targetURL)} return URLs{ SourceAlias: sourceAlias, SourceContent: sourceContent, TargetAlias: target...
[ "func", "makeCopyContentTypeA", "(", "sourceAlias", "string", ",", "sourceContent", "*", "clientContent", ",", "targetAlias", "string", ",", "targetURL", "string", ",", "encKeyDB", "map", "[", "string", "]", "[", "]", "prefixSSEPair", ")", "URLs", "{", "targetCo...
// prepareCopyContentTypeA - makes CopyURLs content for copying.
[ "prepareCopyContentTypeA", "-", "makes", "CopyURLs", "content", "for", "copying", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/cp-url.go#L106-L114
train
minio/mc
cmd/cp-url.go
makeCopyContentTypeB
func makeCopyContentTypeB(sourceAlias string, sourceContent *clientContent, targetAlias string, targetURL string, encKeyDB map[string][]prefixSSEPair) URLs { // All OK.. We can proceed. Type B: source is a file, target is a folder and exists. targetURLParse := newClientURL(targetURL) targetURLParse.Path = filepath.T...
go
func makeCopyContentTypeB(sourceAlias string, sourceContent *clientContent, targetAlias string, targetURL string, encKeyDB map[string][]prefixSSEPair) URLs { // All OK.. We can proceed. Type B: source is a file, target is a folder and exists. targetURLParse := newClientURL(targetURL) targetURLParse.Path = filepath.T...
[ "func", "makeCopyContentTypeB", "(", "sourceAlias", "string", ",", "sourceContent", "*", "clientContent", ",", "targetAlias", "string", ",", "targetURL", "string", ",", "encKeyDB", "map", "[", "string", "]", "[", "]", "prefixSSEPair", ")", "URLs", "{", "// All O...
// makeCopyContentTypeB - CopyURLs content for copying.
[ "makeCopyContentTypeB", "-", "CopyURLs", "content", "for", "copying", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/cp-url.go#L143-L148
train
minio/mc
cmd/cp-url.go
makeCopyContentTypeC
func makeCopyContentTypeC(sourceAlias string, sourceURL clientURL, sourceContent *clientContent, targetAlias string, targetURL string, encKeyDB map[string][]prefixSSEPair) URLs { newSourceURL := sourceContent.URL pathSeparatorIndex := strings.LastIndex(sourceURL.Path, string(sourceURL.Separator)) newSourceSuffix := ...
go
func makeCopyContentTypeC(sourceAlias string, sourceURL clientURL, sourceContent *clientContent, targetAlias string, targetURL string, encKeyDB map[string][]prefixSSEPair) URLs { newSourceURL := sourceContent.URL pathSeparatorIndex := strings.LastIndex(sourceURL.Path, string(sourceURL.Separator)) newSourceSuffix := ...
[ "func", "makeCopyContentTypeC", "(", "sourceAlias", "string", ",", "sourceURL", "clientURL", ",", "sourceContent", "*", "clientContent", ",", "targetAlias", "string", ",", "targetURL", "string", ",", "encKeyDB", "map", "[", "string", "]", "[", "]", "prefixSSEPair"...
// makeCopyContentTypeC - CopyURLs content for copying.
[ "makeCopyContentTypeC", "-", "CopyURLs", "content", "for", "copying", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/cp-url.go#L188-L198
train
minio/mc
cmd/cp-url.go
prepareCopyURLs
func prepareCopyURLs(sourceURLs []string, targetURL string, isRecursive bool, encKeyDB map[string][]prefixSSEPair) <-chan URLs { copyURLsCh := make(chan URLs) go func(sourceURLs []string, targetURL string, copyURLsCh chan URLs, encKeyDB map[string][]prefixSSEPair) { defer close(copyURLsCh) cpType, err := guessCop...
go
func prepareCopyURLs(sourceURLs []string, targetURL string, isRecursive bool, encKeyDB map[string][]prefixSSEPair) <-chan URLs { copyURLsCh := make(chan URLs) go func(sourceURLs []string, targetURL string, copyURLsCh chan URLs, encKeyDB map[string][]prefixSSEPair) { defer close(copyURLsCh) cpType, err := guessCop...
[ "func", "prepareCopyURLs", "(", "sourceURLs", "[", "]", "string", ",", "targetURL", "string", ",", "isRecursive", "bool", ",", "encKeyDB", "map", "[", "string", "]", "[", "]", "prefixSSEPair", ")", "<-", "chan", "URLs", "{", "copyURLsCh", ":=", "make", "("...
// prepareCopyURLs - prepares target and source clientURLs for copying.
[ "prepareCopyURLs", "-", "prepares", "target", "and", "source", "clientURLs", "for", "copying", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/cp-url.go#L216-L242
train
minio/mc
cmd/client-url.go
getHost
func getHost(authority string) (host string) { i := strings.LastIndex(authority, "@") if i >= 0 { // TODO support, username@password style userinfo, useful for ftp support. return } return authority }
go
func getHost(authority string) (host string) { i := strings.LastIndex(authority, "@") if i >= 0 { // TODO support, username@password style userinfo, useful for ftp support. return } return authority }
[ "func", "getHost", "(", "authority", "string", ")", "(", "host", "string", ")", "{", "i", ":=", "strings", ".", "LastIndex", "(", "authority", ",", "\"", "\"", ")", "\n", "if", "i", ">=", "0", "{", "// TODO support, username@password style userinfo, useful for...
// getHost - extract host from authority string, we do not support ftp style username@ yet.
[ "getHost", "-", "extract", "host", "from", "authority", "string", "we", "do", "not", "support", "ftp", "style", "username" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-url.go#L84-L91
train
minio/mc
cmd/client-url.go
newClientURL
func newClientURL(urlStr string) *clientURL { scheme, rest := getScheme(urlStr) if strings.HasPrefix(rest, "//") { // if rest has '//' prefix, skip them var authority string authority, rest = splitSpecial(rest[2:], "/", false) if rest == "" { rest = "/" } host := getHost(authority) if host != "" && (...
go
func newClientURL(urlStr string) *clientURL { scheme, rest := getScheme(urlStr) if strings.HasPrefix(rest, "//") { // if rest has '//' prefix, skip them var authority string authority, rest = splitSpecial(rest[2:], "/", false) if rest == "" { rest = "/" } host := getHost(authority) if host != "" && (...
[ "func", "newClientURL", "(", "urlStr", "string", ")", "*", "clientURL", "{", "scheme", ",", "rest", ":=", "getScheme", "(", "urlStr", ")", "\n", "if", "strings", ".", "HasPrefix", "(", "rest", ",", "\"", "\"", ")", "{", "// if rest has '//' prefix, skip them...
// newClientURL returns an abstracted URL for filesystems and object storage.
[ "newClientURL", "returns", "an", "abstracted", "URL", "for", "filesystems", "and", "object", "storage", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-url.go#L94-L120
train
minio/mc
cmd/client-url.go
joinURLs
func joinURLs(url1, url2 *clientURL) *clientURL { var url1Path, url2Path string url1Path = filepath.ToSlash(url1.Path) url2Path = filepath.ToSlash(url2.Path) if strings.HasSuffix(url1Path, "/") { url1.Path = url1Path + strings.TrimPrefix(url2Path, "/") } else { url1.Path = url1Path + "/" + strings.TrimPrefix(u...
go
func joinURLs(url1, url2 *clientURL) *clientURL { var url1Path, url2Path string url1Path = filepath.ToSlash(url1.Path) url2Path = filepath.ToSlash(url2.Path) if strings.HasSuffix(url1Path, "/") { url1.Path = url1Path + strings.TrimPrefix(url2Path, "/") } else { url1.Path = url1Path + "/" + strings.TrimPrefix(u...
[ "func", "joinURLs", "(", "url1", ",", "url2", "*", "clientURL", ")", "*", "clientURL", "{", "var", "url1Path", ",", "url2Path", "string", "\n", "url1Path", "=", "filepath", ".", "ToSlash", "(", "url1", ".", "Path", ")", "\n", "url2Path", "=", "filepath",...
// joinURLs join two input urls and returns a url
[ "joinURLs", "join", "two", "input", "urls", "and", "returns", "a", "url" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-url.go#L123-L133
train
minio/mc
cmd/client-url.go
String
func (u clientURL) String() string { var buf bytes.Buffer // if fileSystem no translation needed, return as is. if u.Type == fileSystem { return u.Path } // if objectStorage convert from any non standard paths to a supported URL path style. if u.Type == objectStorage { buf.WriteString(u.Scheme) buf.WriteByt...
go
func (u clientURL) String() string { var buf bytes.Buffer // if fileSystem no translation needed, return as is. if u.Type == fileSystem { return u.Path } // if objectStorage convert from any non standard paths to a supported URL path style. if u.Type == objectStorage { buf.WriteString(u.Scheme) buf.WriteByt...
[ "func", "(", "u", "clientURL", ")", "String", "(", ")", "string", "{", "var", "buf", "bytes", ".", "Buffer", "\n", "// if fileSystem no translation needed, return as is.", "if", "u", ".", "Type", "==", "fileSystem", "{", "return", "u", ".", "Path", "\n", "}"...
// String convert URL into its canonical form.
[ "String", "convert", "URL", "into", "its", "canonical", "form", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-url.go#L136-L164
train
minio/mc
cmd/client-url.go
urlJoinPath
func urlJoinPath(url1, url2 string) string { u1 := newClientURL(url1) u2 := newClientURL(url2) return joinURLs(u1, u2).String() }
go
func urlJoinPath(url1, url2 string) string { u1 := newClientURL(url1) u2 := newClientURL(url2) return joinURLs(u1, u2).String() }
[ "func", "urlJoinPath", "(", "url1", ",", "url2", "string", ")", "string", "{", "u1", ":=", "newClientURL", "(", "url1", ")", "\n", "u2", ":=", "newClientURL", "(", "url2", ")", "\n", "return", "joinURLs", "(", "u1", ",", "u2", ")", ".", "String", "("...
// urlJoinPath Join a path to existing URL.
[ "urlJoinPath", "Join", "a", "path", "to", "existing", "URL", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-url.go#L167-L171
train
minio/mc
cmd/client-url.go
url2Stat
func url2Stat(urlStr string, isFetchMeta bool, encKeyDB map[string][]prefixSSEPair) (client Client, content *clientContent, err *probe.Error) { client, err = newClient(urlStr) if err != nil { return nil, nil, err.Trace(urlStr) } alias, _ := url2Alias(urlStr) sse := getSSE(urlStr, encKeyDB[alias]) content, err ...
go
func url2Stat(urlStr string, isFetchMeta bool, encKeyDB map[string][]prefixSSEPair) (client Client, content *clientContent, err *probe.Error) { client, err = newClient(urlStr) if err != nil { return nil, nil, err.Trace(urlStr) } alias, _ := url2Alias(urlStr) sse := getSSE(urlStr, encKeyDB[alias]) content, err ...
[ "func", "url2Stat", "(", "urlStr", "string", ",", "isFetchMeta", "bool", ",", "encKeyDB", "map", "[", "string", "]", "[", "]", "prefixSSEPair", ")", "(", "client", "Client", ",", "content", "*", "clientContent", ",", "err", "*", "probe", ".", "Error", ")...
// url2Stat returns stat info for URL.
[ "url2Stat", "returns", "stat", "info", "for", "URL", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-url.go#L174-L187
train
minio/mc
cmd/client-url.go
isURLPrefixExists
func isURLPrefixExists(urlPrefix string, incomplete bool) bool { clnt, err := newClient(urlPrefix) if err != nil { return false } isRecursive := false isIncomplete := incomplete for entry := range clnt.List(isRecursive, isIncomplete, DirNone) { return entry.Err == nil } return false }
go
func isURLPrefixExists(urlPrefix string, incomplete bool) bool { clnt, err := newClient(urlPrefix) if err != nil { return false } isRecursive := false isIncomplete := incomplete for entry := range clnt.List(isRecursive, isIncomplete, DirNone) { return entry.Err == nil } return false }
[ "func", "isURLPrefixExists", "(", "urlPrefix", "string", ",", "incomplete", "bool", ")", "bool", "{", "clnt", ",", "err", ":=", "newClient", "(", "urlPrefix", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", "\n", "}", "\n", "isRecursive", ":...
// isURLPrefixExists - check if object key prefix exists.
[ "isURLPrefixExists", "-", "check", "if", "object", "key", "prefix", "exists", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/client-url.go#L214-L225
train
minio/mc
cmd/admin-user-disable.go
checkAdminUserDisableSyntax
func checkAdminUserDisableSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { cli.ShowCommandHelpAndExit(ctx, "disable", 1) // last argument is exit code } }
go
func checkAdminUserDisableSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { cli.ShowCommandHelpAndExit(ctx, "disable", 1) // last argument is exit code } }
[ "func", "checkAdminUserDisableSyntax", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "if", "len", "(", "ctx", ".", "Args", "(", ")", ")", "!=", "2", "{", "cli", ".", "ShowCommandHelpAndExit", "(", "ctx", ",", "\"", "\"", ",", "1", ")", "// last a...
// checkAdminUserDisableSyntax - validate all the passed arguments
[ "checkAdminUserDisableSyntax", "-", "validate", "all", "the", "passed", "arguments" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/admin-user-disable.go#L49-L53
train
minio/mc
cmd/admin-user-disable.go
mainAdminUserDisable
func mainAdminUserDisable(ctx *cli.Context) error { checkAdminUserDisableSyntax(ctx) console.SetColor("UserMessage", color.New(color.FgGreen)) // Get the alias parameter from cli args := ctx.Args() aliasedURL := args.Get(0) // Create a new MinIO Admin Client client, err := newAdminClient(aliasedURL) fatalIf(...
go
func mainAdminUserDisable(ctx *cli.Context) error { checkAdminUserDisableSyntax(ctx) console.SetColor("UserMessage", color.New(color.FgGreen)) // Get the alias parameter from cli args := ctx.Args() aliasedURL := args.Get(0) // Create a new MinIO Admin Client client, err := newAdminClient(aliasedURL) fatalIf(...
[ "func", "mainAdminUserDisable", "(", "ctx", "*", "cli", ".", "Context", ")", "error", "{", "checkAdminUserDisableSyntax", "(", "ctx", ")", "\n\n", "console", ".", "SetColor", "(", "\"", "\"", ",", "color", ".", "New", "(", "color", ".", "FgGreen", ")", "...
// mainAdminUserDisable is the handle for "mc admin user disable" command.
[ "mainAdminUserDisable", "is", "the", "handle", "for", "mc", "admin", "user", "disable", "command", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/admin-user-disable.go#L56-L78
train
minio/mc
cmd/table-ui.go
getPrintCol
func getPrintCol(c col) *color.Color { switch c { case colGrey: return color.New(color.FgWhite, color.Bold) case colRed: return color.New(color.FgRed, color.Bold) case colYellow: return color.New(color.FgYellow, color.Bold) case colGreen: return color.New(color.FgGreen, color.Bold) } return nil }
go
func getPrintCol(c col) *color.Color { switch c { case colGrey: return color.New(color.FgWhite, color.Bold) case colRed: return color.New(color.FgRed, color.Bold) case colYellow: return color.New(color.FgYellow, color.Bold) case colGreen: return color.New(color.FgGreen, color.Bold) } return nil }
[ "func", "getPrintCol", "(", "c", "col", ")", "*", "color", ".", "Color", "{", "switch", "c", "{", "case", "colGrey", ":", "return", "color", ".", "New", "(", "color", ".", "FgWhite", ",", "color", ".", "Bold", ")", "\n", "case", "colRed", ":", "ret...
// getPrintCol - map color code to color for printing
[ "getPrintCol", "-", "map", "color", "code", "to", "color", "for", "printing" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/table-ui.go#L32-L44
train
minio/mc
cmd/share-main.go
migrateShare
func migrateShare() { if !isShareDirExists() { return } // Shared URLs are now managed by sub-commands. So delete any old URLs file if found. oldShareFile := filepath.Join(mustGetShareDir(), "urls.json") if _, e := os.Stat(oldShareFile); e == nil { // Old file exits. e := os.Remove(oldShareFile) fatalIf(p...
go
func migrateShare() { if !isShareDirExists() { return } // Shared URLs are now managed by sub-commands. So delete any old URLs file if found. oldShareFile := filepath.Join(mustGetShareDir(), "urls.json") if _, e := os.Stat(oldShareFile); e == nil { // Old file exits. e := os.Remove(oldShareFile) fatalIf(p...
[ "func", "migrateShare", "(", ")", "{", "if", "!", "isShareDirExists", "(", ")", "{", "return", "\n", "}", "\n\n", "// Shared URLs are now managed by sub-commands. So delete any old URLs file if found.", "oldShareFile", ":=", "filepath", ".", "Join", "(", "mustGetShareDir"...
// migrateShare migrate to newest version sequentially.
[ "migrateShare", "migrate", "to", "newest", "version", "sequentially", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/share-main.go#L48-L61
train
minio/mc
cmd/rb-main.go
String
func (s removeBucketMessage) String() string { return console.Colorize("RemoveBucket", fmt.Sprintf("Removed `%s` successfully.", s.Bucket)) }
go
func (s removeBucketMessage) String() string { return console.Colorize("RemoveBucket", fmt.Sprintf("Removed `%s` successfully.", s.Bucket)) }
[ "func", "(", "s", "removeBucketMessage", ")", "String", "(", ")", "string", "{", "return", "console", ".", "Colorize", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "s", ".", "Bucket", ")", ")", "\n", "}" ]
// String colorized delete bucket message.
[ "String", "colorized", "delete", "bucket", "message", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/rb-main.go#L82-L84
train
minio/mc
cmd/rb-main.go
JSON
func (s removeBucketMessage) JSON() string { removeBucketJSONBytes, e := json.Marshal(s) fatalIf(probe.NewError(e), "Unable to marshal into JSON.") return string(removeBucketJSONBytes) }
go
func (s removeBucketMessage) JSON() string { removeBucketJSONBytes, e := json.Marshal(s) fatalIf(probe.NewError(e), "Unable to marshal into JSON.") return string(removeBucketJSONBytes) }
[ "func", "(", "s", "removeBucketMessage", ")", "JSON", "(", ")", "string", "{", "removeBucketJSONBytes", ",", "e", ":=", "json", ".", "Marshal", "(", "s", ")", "\n", "fatalIf", "(", "probe", ".", "NewError", "(", "e", ")", ",", "\"", "\"", ")", "\n\n"...
// JSON jsonified remove bucket message.
[ "JSON", "jsonified", "remove", "bucket", "message", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/rb-main.go#L87-L92
train
minio/mc
cmd/rb-main.go
deleteBucket
func deleteBucket(url string) *probe.Error { targetAlias, targetURL, _ := mustExpandAlias(url) clnt, pErr := newClientFromAlias(targetAlias, targetURL) if pErr != nil { return pErr } var isIncomplete bool isRemoveBucket := true contentCh := make(chan *clientContent) errorCh := clnt.Remove(isIncomplete, isRemo...
go
func deleteBucket(url string) *probe.Error { targetAlias, targetURL, _ := mustExpandAlias(url) clnt, pErr := newClientFromAlias(targetAlias, targetURL) if pErr != nil { return pErr } var isIncomplete bool isRemoveBucket := true contentCh := make(chan *clientContent) errorCh := clnt.Remove(isIncomplete, isRemo...
[ "func", "deleteBucket", "(", "url", "string", ")", "*", "probe", ".", "Error", "{", "targetAlias", ",", "targetURL", ",", "_", ":=", "mustExpandAlias", "(", "url", ")", "\n", "clnt", ",", "pErr", ":=", "newClientFromAlias", "(", "targetAlias", ",", "target...
// deletes a bucket and all its contents
[ "deletes", "a", "bucket", "and", "all", "its", "contents" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/rb-main.go#L116-L184
train
minio/mc
cmd/rb-main.go
isNamespaceRemoval
func isNamespaceRemoval(url string) bool { // clean path for aliases like s3/. //Note: UNC path using / works properly in go 1.9.2 even though it breaks the UNC specification. url = filepath.ToSlash(filepath.Clean(url)) // namespace removal applies only for non FS. So filter out if passed url represents a directory...
go
func isNamespaceRemoval(url string) bool { // clean path for aliases like s3/. //Note: UNC path using / works properly in go 1.9.2 even though it breaks the UNC specification. url = filepath.ToSlash(filepath.Clean(url)) // namespace removal applies only for non FS. So filter out if passed url represents a directory...
[ "func", "isNamespaceRemoval", "(", "url", "string", ")", "bool", "{", "// clean path for aliases like s3/.", "//Note: UNC path using / works properly in go 1.9.2 even though it breaks the UNC specification.", "url", "=", "filepath", ".", "ToSlash", "(", "filepath", ".", "Clean", ...
// isNamespaceRemoval returns true if alias // is not qualified by bucket
[ "isNamespaceRemoval", "returns", "true", "if", "alias", "is", "not", "qualified", "by", "bucket" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/rb-main.go#L188-L198
train
minio/mc
cmd/rb-main.go
mainRemoveBucket
func mainRemoveBucket(ctx *cli.Context) error { // check 'rb' cli arguments. checkRbSyntax(ctx) isForce := ctx.Bool("force") // Additional command specific theme customization. console.SetColor("RemoveBucket", color.New(color.FgGreen, color.Bold)) var cErr error for _, targetURL := range ctx.Args() { // Inst...
go
func mainRemoveBucket(ctx *cli.Context) error { // check 'rb' cli arguments. checkRbSyntax(ctx) isForce := ctx.Bool("force") // Additional command specific theme customization. console.SetColor("RemoveBucket", color.New(color.FgGreen, color.Bold)) var cErr error for _, targetURL := range ctx.Args() { // Inst...
[ "func", "mainRemoveBucket", "(", "ctx", "*", "cli", ".", "Context", ")", "error", "{", "// check 'rb' cli arguments.", "checkRbSyntax", "(", "ctx", ")", "\n", "isForce", ":=", "ctx", ".", "Bool", "(", "\"", "\"", ")", "\n\n", "// Additional command specific them...
// mainRemoveBucket is entry point for rb command.
[ "mainRemoveBucket", "is", "entry", "point", "for", "rb", "command", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/rb-main.go#L201-L242
train
minio/mc
cmd/share.go
String
func (s shareMesssage) String() string { msg := console.Colorize("URL", fmt.Sprintf("URL: %s\n", s.ObjectURL)) msg += console.Colorize("Expire", fmt.Sprintf("Expire: %s\n", timeDurationToHumanizedDuration(s.TimeLeft))) if s.ContentType != "" { msg += console.Colorize("Content-type", fmt.Sprintf("Content-Type: %s\n...
go
func (s shareMesssage) String() string { msg := console.Colorize("URL", fmt.Sprintf("URL: %s\n", s.ObjectURL)) msg += console.Colorize("Expire", fmt.Sprintf("Expire: %s\n", timeDurationToHumanizedDuration(s.TimeLeft))) if s.ContentType != "" { msg += console.Colorize("Content-type", fmt.Sprintf("Content-Type: %s\n...
[ "func", "(", "s", "shareMesssage", ")", "String", "(", ")", "string", "{", "msg", ":=", "console", ".", "Colorize", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\\n", "\"", ",", "s", ".", "ObjectURL", ")", ")", "\n", "msg", "+=", "con...
// String - Themefied string message for console printing.
[ "String", "-", "Themefied", "string", "message", "for", "console", "printing", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/share.go#L62-L77
train
minio/mc
cmd/share.go
JSON
func (s shareMesssage) JSON() string { s.Status = "success" shareMessageBytes, e := json.MarshalIndent(s, "", " ") fatalIf(probe.NewError(e), "Failed to marshal into JSON.") // JSON encoding escapes ampersand into its unicode character // which is not usable directly for share and fails with cloud // storage. co...
go
func (s shareMesssage) JSON() string { s.Status = "success" shareMessageBytes, e := json.MarshalIndent(s, "", " ") fatalIf(probe.NewError(e), "Failed to marshal into JSON.") // JSON encoding escapes ampersand into its unicode character // which is not usable directly for share and fails with cloud // storage. co...
[ "func", "(", "s", "shareMesssage", ")", "JSON", "(", ")", "string", "{", "s", ".", "Status", "=", "\"", "\"", "\n", "shareMessageBytes", ",", "e", ":=", "json", ".", "MarshalIndent", "(", "s", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "fatalIf",...
// JSON - JSONified message for scripting.
[ "JSON", "-", "JSONified", "message", "for", "scripting", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/share.go#L80-L93
train
minio/mc
cmd/share.go
shareSetColor
func shareSetColor() { // Additional command speific theme customization. console.SetColor("URL", color.New(color.Bold)) console.SetColor("Expire", color.New(color.FgCyan)) console.SetColor("Content-type", color.New(color.FgBlue)) console.SetColor("Share", color.New(color.FgGreen)) console.SetColor("File", color....
go
func shareSetColor() { // Additional command speific theme customization. console.SetColor("URL", color.New(color.Bold)) console.SetColor("Expire", color.New(color.FgCyan)) console.SetColor("Content-type", color.New(color.FgBlue)) console.SetColor("Share", color.New(color.FgGreen)) console.SetColor("File", color....
[ "func", "shareSetColor", "(", ")", "{", "// Additional command speific theme customization.", "console", ".", "SetColor", "(", "\"", "\"", ",", "color", ".", "New", "(", "color", ".", "Bold", ")", ")", "\n", "console", ".", "SetColor", "(", "\"", "\"", ",", ...
// shareSetColor sets colors share sub-commands.
[ "shareSetColor", "sets", "colors", "share", "sub", "-", "commands", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/share.go#L96-L103
train
minio/mc
cmd/share.go
getShareDir
func getShareDir() (string, *probe.Error) { configDir, err := getMcConfigDir() if err != nil { return "", err.Trace() } sharedURLsDataDir := filepath.Join(configDir, globalSharedURLsDataDir) return sharedURLsDataDir, nil }
go
func getShareDir() (string, *probe.Error) { configDir, err := getMcConfigDir() if err != nil { return "", err.Trace() } sharedURLsDataDir := filepath.Join(configDir, globalSharedURLsDataDir) return sharedURLsDataDir, nil }
[ "func", "getShareDir", "(", ")", "(", "string", ",", "*", "probe", ".", "Error", ")", "{", "configDir", ",", "err", ":=", "getMcConfigDir", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", ".", "Trace", "(", ")", "...
// Get share dir name.
[ "Get", "share", "dir", "name", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/share.go#L106-L114
train
minio/mc
cmd/share.go
isShareDirExists
func isShareDirExists() bool { if _, e := os.Stat(mustGetShareDir()); e != nil { return false } return true }
go
func isShareDirExists() bool { if _, e := os.Stat(mustGetShareDir()); e != nil { return false } return true }
[ "func", "isShareDirExists", "(", ")", "bool", "{", "if", "_", ",", "e", ":=", "os", ".", "Stat", "(", "mustGetShareDir", "(", ")", ")", ";", "e", "!=", "nil", "{", "return", "false", "\n", "}", "\n", "return", "true", "\n", "}" ]
// Check if the share dir exists.
[ "Check", "if", "the", "share", "dir", "exists", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/share.go#L124-L129
train
minio/mc
cmd/share.go
createShareDir
func createShareDir() *probe.Error { if e := os.MkdirAll(mustGetShareDir(), 0700); e != nil { return probe.NewError(e) } return nil }
go
func createShareDir() *probe.Error { if e := os.MkdirAll(mustGetShareDir(), 0700); e != nil { return probe.NewError(e) } return nil }
[ "func", "createShareDir", "(", ")", "*", "probe", ".", "Error", "{", "if", "e", ":=", "os", ".", "MkdirAll", "(", "mustGetShareDir", "(", ")", ",", "0700", ")", ";", "e", "!=", "nil", "{", "return", "probe", ".", "NewError", "(", "e", ")", "\n", ...
// Create config share dir.
[ "Create", "config", "share", "dir", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/share.go#L132-L137
train
minio/mc
cmd/share.go
isShareUploadsExists
func isShareUploadsExists() bool { if _, e := os.Stat(getShareUploadsFile()); e != nil { return false } return true }
go
func isShareUploadsExists() bool { if _, e := os.Stat(getShareUploadsFile()); e != nil { return false } return true }
[ "func", "isShareUploadsExists", "(", ")", "bool", "{", "if", "_", ",", "e", ":=", "os", ".", "Stat", "(", "getShareUploadsFile", "(", ")", ")", ";", "e", "!=", "nil", "{", "return", "false", "\n", "}", "\n", "return", "true", "\n", "}" ]
// Check if share uploads file exists?.
[ "Check", "if", "share", "uploads", "file", "exists?", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/share.go#L150-L155
train
minio/mc
cmd/share.go
isShareDownloadsExists
func isShareDownloadsExists() bool { if _, e := os.Stat(getShareDownloadsFile()); e != nil { return false } return true }
go
func isShareDownloadsExists() bool { if _, e := os.Stat(getShareDownloadsFile()); e != nil { return false } return true }
[ "func", "isShareDownloadsExists", "(", ")", "bool", "{", "if", "_", ",", "e", ":=", "os", ".", "Stat", "(", "getShareDownloadsFile", "(", ")", ")", ";", "e", "!=", "nil", "{", "return", "false", "\n", "}", "\n", "return", "true", "\n", "}" ]
// Check if share downloads file exists?.
[ "Check", "if", "share", "downloads", "file", "exists?", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/share.go#L158-L163
train
minio/mc
cmd/share.go
initShareConfig
func initShareConfig() { // Share directory. if !isShareDirExists() { fatalIf(createShareDir().Trace(mustGetShareDir()), "Failed to create share `"+mustGetShareDir()+"` folder.") if !globalQuiet && !globalJSON { console.Infof("Successfully created `%s`.\n", mustGetShareDir()) } } // Uploads share file....
go
func initShareConfig() { // Share directory. if !isShareDirExists() { fatalIf(createShareDir().Trace(mustGetShareDir()), "Failed to create share `"+mustGetShareDir()+"` folder.") if !globalQuiet && !globalJSON { console.Infof("Successfully created `%s`.\n", mustGetShareDir()) } } // Uploads share file....
[ "func", "initShareConfig", "(", ")", "{", "// Share directory.", "if", "!", "isShareDirExists", "(", ")", "{", "fatalIf", "(", "createShareDir", "(", ")", ".", "Trace", "(", "mustGetShareDir", "(", ")", ")", ",", "\"", "\"", "+", "mustGetShareDir", "(", ")...
// Initialize share directory, if not done already.
[ "Initialize", "share", "directory", "if", "not", "done", "already", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/share.go#L176-L203
train
minio/mc
pkg/console/themes.go
SetColor
func SetColor(tag string, cl *color.Color) { privateMutex.Lock() defer privateMutex.Unlock() // add new theme Theme[tag] = cl }
go
func SetColor(tag string, cl *color.Color) { privateMutex.Lock() defer privateMutex.Unlock() // add new theme Theme[tag] = cl }
[ "func", "SetColor", "(", "tag", "string", ",", "cl", "*", "color", ".", "Color", ")", "{", "privateMutex", ".", "Lock", "(", ")", "\n", "defer", "privateMutex", ".", "Unlock", "(", ")", "\n", "// add new theme", "Theme", "[", "tag", "]", "=", "cl", "...
// SetColor sets a color for a particular tag.
[ "SetColor", "sets", "a", "color", "for", "a", "particular", "tag", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/pkg/console/themes.go#L49-L54
train
minio/mc
cmd/watch-main.go
checkWatchSyntax
func checkWatchSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { cli.ShowCommandHelpAndExit(ctx, "watch", 1) // last argument is exit code } }
go
func checkWatchSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { cli.ShowCommandHelpAndExit(ctx, "watch", 1) // last argument is exit code } }
[ "func", "checkWatchSyntax", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "if", "len", "(", "ctx", ".", "Args", "(", ")", ")", "!=", "1", "{", "cli", ".", "ShowCommandHelpAndExit", "(", "ctx", ",", "\"", "\"", ",", "1", ")", "// last argument is ...
// checkWatchSyntax - validate all the passed arguments
[ "checkWatchSyntax", "-", "validate", "all", "the", "passed", "arguments" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/watch-main.go#L90-L94
train
minio/mc
cmd/admin-config-get.go
checkAdminConfigGetSyntax
func checkAdminConfigGetSyntax(ctx *cli.Context) { if len(ctx.Args()) == 0 || len(ctx.Args()) > 2 { cli.ShowCommandHelpAndExit(ctx, "get", 1) // last argument is exit code } }
go
func checkAdminConfigGetSyntax(ctx *cli.Context) { if len(ctx.Args()) == 0 || len(ctx.Args()) > 2 { cli.ShowCommandHelpAndExit(ctx, "get", 1) // last argument is exit code } }
[ "func", "checkAdminConfigGetSyntax", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "if", "len", "(", "ctx", ".", "Args", "(", ")", ")", "==", "0", "||", "len", "(", "ctx", ".", "Args", "(", ")", ")", ">", "2", "{", "cli", ".", "ShowCommandHel...
// checkAdminConfigGetSyntax - validate all the passed arguments
[ "checkAdminConfigGetSyntax", "-", "validate", "all", "the", "passed", "arguments" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/admin-config-get.go#L71-L75
train
minio/mc
cmd/admin-credential.go
checkAdminCredsSyntax
func checkAdminCredsSyntax(ctx *cli.Context) { if len(ctx.Args()) != 3 { cli.ShowCommandHelpAndExit(ctx, credsCmdName, 1) // last argument is exit code } }
go
func checkAdminCredsSyntax(ctx *cli.Context) { if len(ctx.Args()) != 3 { cli.ShowCommandHelpAndExit(ctx, credsCmdName, 1) // last argument is exit code } }
[ "func", "checkAdminCredsSyntax", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "if", "len", "(", "ctx", ".", "Args", "(", ")", ")", "!=", "3", "{", "cli", ".", "ShowCommandHelpAndExit", "(", "ctx", ",", "credsCmdName", ",", "1", ")", "// last argum...
// checkAdminCredsSyntax - validate all the passed arguments
[ "checkAdminCredsSyntax", "-", "validate", "all", "the", "passed", "arguments" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/admin-credential.go#L52-L56
train
minio/mc
cmd/admin-service-restart.go
JSON
func (s serviceRestartCommand) JSON() string { serviceRestartJSONBytes, e := json.MarshalIndent(s, "", " ") fatalIf(probe.NewError(e), "Unable to marshal into JSON.") return string(serviceRestartJSONBytes) }
go
func (s serviceRestartCommand) JSON() string { serviceRestartJSONBytes, e := json.MarshalIndent(s, "", " ") fatalIf(probe.NewError(e), "Unable to marshal into JSON.") return string(serviceRestartJSONBytes) }
[ "func", "(", "s", "serviceRestartCommand", ")", "JSON", "(", ")", "string", "{", "serviceRestartJSONBytes", ",", "e", ":=", "json", ".", "MarshalIndent", "(", "s", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "fatalIf", "(", "probe", ".", "NewError", "...
// JSON jsonified service restart command message.
[ "JSON", "jsonified", "service", "restart", "command", "message", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/admin-service-restart.go#L64-L69
train
minio/mc
cmd/admin-service-restart.go
String
func (s serviceRestartMessage) String() string { if s.Err == nil { return console.Colorize("ServiceRestart", "Restarted `"+s.ServerURL+"` successfully.") } return console.Colorize("FailedServiceRestart", "Failed to restart `"+s.ServerURL+"`. error: "+s.Err.Error()) }
go
func (s serviceRestartMessage) String() string { if s.Err == nil { return console.Colorize("ServiceRestart", "Restarted `"+s.ServerURL+"` successfully.") } return console.Colorize("FailedServiceRestart", "Failed to restart `"+s.ServerURL+"`. error: "+s.Err.Error()) }
[ "func", "(", "s", "serviceRestartMessage", ")", "String", "(", ")", "string", "{", "if", "s", ".", "Err", "==", "nil", "{", "return", "console", ".", "Colorize", "(", "\"", "\"", ",", "\"", "\"", "+", "s", ".", "ServerURL", "+", "\"", "\"", ")", ...
// String colorized service restart message.
[ "String", "colorized", "service", "restart", "message", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/admin-service-restart.go#L79-L84
train
minio/mc
cmd/admin-service-restart.go
checkAdminServiceRestartSyntax
func checkAdminServiceRestartSyntax(ctx *cli.Context) { if len(ctx.Args()) == 0 || len(ctx.Args()) > 2 { cli.ShowCommandHelpAndExit(ctx, "restart", 1) // last argument is exit code } }
go
func checkAdminServiceRestartSyntax(ctx *cli.Context) { if len(ctx.Args()) == 0 || len(ctx.Args()) > 2 { cli.ShowCommandHelpAndExit(ctx, "restart", 1) // last argument is exit code } }
[ "func", "checkAdminServiceRestartSyntax", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "if", "len", "(", "ctx", ".", "Args", "(", ")", ")", "==", "0", "||", "len", "(", "ctx", ".", "Args", "(", ")", ")", ">", "2", "{", "cli", ".", "ShowComma...
// checkAdminServiceRestartSyntax - validate all the passed arguments
[ "checkAdminServiceRestartSyntax", "-", "validate", "all", "the", "passed", "arguments" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/admin-service-restart.go#L95-L99
train
minio/mc
cmd/find-main.go
checkFindSyntax
func checkFindSyntax(ctx *cli.Context, encKeyDB map[string][]prefixSSEPair) { args := ctx.Args() if !args.Present() { args = []string{"./"} // No args just default to present directory. } else if args.Get(0) == "." { args[0] = "./" // If the arg is '.' treat it as './'. } for _, arg := range args { if strin...
go
func checkFindSyntax(ctx *cli.Context, encKeyDB map[string][]prefixSSEPair) { args := ctx.Args() if !args.Present() { args = []string{"./"} // No args just default to present directory. } else if args.Get(0) == "." { args[0] = "./" // If the arg is '.' treat it as './'. } for _, arg := range args { if strin...
[ "func", "checkFindSyntax", "(", "ctx", "*", "cli", ".", "Context", ",", "encKeyDB", "map", "[", "string", "]", "[", "]", "prefixSSEPair", ")", "{", "args", ":=", "ctx", ".", "Args", "(", ")", "\n", "if", "!", "args", ".", "Present", "(", ")", "{", ...
// checkFindSyntax - validate the passed arguments
[ "checkFindSyntax", "-", "validate", "the", "passed", "arguments" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/find-main.go#L158-L183
train
minio/mc
cmd/find-main.go
mainFind
func mainFind(ctx *cli.Context) error { // Additional command specific theme customization. console.SetColor("Find", color.New(color.FgGreen, color.Bold)) console.SetColor("FindExecErr", color.New(color.FgRed, color.Italic, color.Bold)) // Parse encryption keys per command. encKeyDB, err := getEncKeys(ctx) fatal...
go
func mainFind(ctx *cli.Context) error { // Additional command specific theme customization. console.SetColor("Find", color.New(color.FgGreen, color.Bold)) console.SetColor("FindExecErr", color.New(color.FgRed, color.Italic, color.Bold)) // Parse encryption keys per command. encKeyDB, err := getEncKeys(ctx) fatal...
[ "func", "mainFind", "(", "ctx", "*", "cli", ".", "Context", ")", "error", "{", "// Additional command specific theme customization.", "console", ".", "SetColor", "(", "\"", "\"", ",", "color", ".", "New", "(", "color", ".", "FgGreen", ",", "color", ".", "Bol...
// mainFind - handler for mc find commands
[ "mainFind", "-", "handler", "for", "mc", "find", "commands" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/find-main.go#L211-L283
train
minio/mc
cmd/policy-main.go
JSON
func (s policyRules) JSON() string { policyJSONBytes, e := json.MarshalIndent(s, "", " ") fatalIf(probe.NewError(e), "Unable to marshal into JSON.") return string(policyJSONBytes) }
go
func (s policyRules) JSON() string { policyJSONBytes, e := json.MarshalIndent(s, "", " ") fatalIf(probe.NewError(e), "Unable to marshal into JSON.") return string(policyJSONBytes) }
[ "func", "(", "s", "policyRules", ")", "JSON", "(", ")", "string", "{", "policyJSONBytes", ",", "e", ":=", "json", ".", "MarshalIndent", "(", "s", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "fatalIf", "(", "probe", ".", "NewError", "(", "e", ")", ...
// JSON jsonified policy message.
[ "JSON", "jsonified", "policy", "message", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/policy-main.go#L108-L112
train