本文整理汇总了Golang中github.com/prasmussen/gdrive/cli.Context类的典型用法代码示例。如果您正苦于以下问题:Golang Context类的具体用法?Golang Context怎么用?Golang Context使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Context类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: aboutExportHandler
func aboutExportHandler(ctx cli.Context) {
args := ctx.Args()
err := newDrive(args).AboutExport(drive.AboutExportArgs{
Out: os.Stdout,
})
checkErr(err)
}
开发者ID:RandomArray,项目名称:gdrive,代码行数:7,代码来源:handlers_drive.go
示例2: printCommandPrefixHelp
func printCommandPrefixHelp(ctx cli.Context, prefix ...string) {
handler := getHandler(ctx.Handlers(), prefix)
if handler == nil {
ExitF("Command not found")
}
w := new(tabwriter.Writer)
w.Init(os.Stdout, 0, 0, 3, ' ', 0)
fmt.Fprintf(w, "%s\n", handler.Description)
fmt.Fprintf(w, "%s %s\n", Name, handler.Pattern)
for _, group := range handler.FlagGroups {
fmt.Fprintf(w, "\n%s:\n", group.Name)
for _, flag := range group.Flags {
boolFlag, isBool := flag.(cli.BoolFlag)
if isBool && boolFlag.OmitValue {
fmt.Fprintf(w, " %s\t%s\n", strings.Join(flag.GetPatterns(), ", "), flag.GetDescription())
} else {
fmt.Fprintf(w, " %s <%s>\t%s\n", strings.Join(flag.GetPatterns(), ", "), flag.GetName(), flag.GetDescription())
}
}
}
w.Flush()
}
开发者ID:RandomArray,项目名称:gdrive,代码行数:26,代码来源:handlers_meta.go
示例3: listSyncHandler
func listSyncHandler(ctx cli.Context) {
args := ctx.Args()
err := newDrive(args).ListSync(drive.ListSyncArgs{
Out: os.Stdout,
SkipHeader: args.Bool("skipHeader"),
})
checkErr(err)
}
开发者ID:RandomArray,项目名称:gdrive,代码行数:8,代码来源:handlers_drive.go
示例4: aboutHandler
func aboutHandler(ctx cli.Context) {
args := ctx.Args()
err := newDrive(args).About(drive.AboutArgs{
Out: os.Stdout,
SizeInBytes: args.Bool("sizeInBytes"),
})
checkErr(err)
}
开发者ID:RandomArray,项目名称:gdrive,代码行数:8,代码来源:handlers_drive.go
示例5: shareListHandler
func shareListHandler(ctx cli.Context) {
args := ctx.Args()
err := newDrive(args).ListPermissions(drive.ListPermissionsArgs{
Out: os.Stdout,
FileId: args.String("fileId"),
})
checkErr(err)
}
开发者ID:RandomArray,项目名称:gdrive,代码行数:8,代码来源:handlers_drive.go
示例6: infoHandler
func infoHandler(ctx cli.Context) {
args := ctx.Args()
err := newDrive(args).Info(drive.FileInfoArgs{
Out: os.Stdout,
Id: args.String("fileId"),
SizeInBytes: args.Bool("sizeInBytes"),
})
checkErr(err)
}
开发者ID:RandomArray,项目名称:gdrive,代码行数:9,代码来源:handlers_drive.go
示例7: deleteHandler
func deleteHandler(ctx cli.Context) {
args := ctx.Args()
err := newDrive(args).Delete(drive.DeleteArgs{
Out: os.Stdout,
Id: args.String("fileId"),
Recursive: args.Bool("recursive"),
})
checkErr(err)
}
开发者ID:RandomArray,项目名称:gdrive,代码行数:9,代码来源:handlers_drive.go
示例8: shareRevokeHandler
func shareRevokeHandler(ctx cli.Context) {
args := ctx.Args()
err := newDrive(args).RevokePermission(drive.RevokePermissionArgs{
Out: os.Stdout,
FileId: args.String("fileId"),
PermissionId: args.String("permissionId"),
})
checkErr(err)
}
开发者ID:RandomArray,项目名称:gdrive,代码行数:9,代码来源:handlers_drive.go
示例9: mkdirHandler
func mkdirHandler(ctx cli.Context) {
args := ctx.Args()
err := newDrive(args).Mkdir(drive.MkdirArgs{
Out: os.Stdout,
Name: args.String("name"),
Parents: args.StringSlice("parent"),
})
checkErr(err)
}
开发者ID:RandomArray,项目名称:gdrive,代码行数:9,代码来源:handlers_drive.go
示例10: deleteRevisionHandler
func deleteRevisionHandler(ctx cli.Context) {
args := ctx.Args()
err := newDrive(args).DeleteRevision(drive.DeleteRevisionArgs{
Out: os.Stdout,
FileId: args.String("fileId"),
RevisionId: args.String("revId"),
})
checkErr(err)
}
开发者ID:RandomArray,项目名称:gdrive,代码行数:9,代码来源:handlers_drive.go
示例11: importHandler
func importHandler(ctx cli.Context) {
args := ctx.Args()
err := newDrive(args).Import(drive.ImportArgs{
Out: os.Stdout,
Path: args.String("path"),
Parents: args.StringSlice("parent"),
Progress: progressWriter(args.Bool("noProgress")),
})
checkErr(err)
}
开发者ID:RandomArray,项目名称:gdrive,代码行数:10,代码来源:handlers_drive.go
示例12: exportHandler
func exportHandler(ctx cli.Context) {
args := ctx.Args()
err := newDrive(args).Export(drive.ExportArgs{
Out: os.Stdout,
Id: args.String("fileId"),
Mime: args.String("mime"),
PrintMimes: args.Bool("printMimes"),
Force: args.Bool("force"),
})
checkErr(err)
}
开发者ID:RandomArray,项目名称:gdrive,代码行数:11,代码来源:handlers_drive.go
示例13: listRevisionsHandler
func listRevisionsHandler(ctx cli.Context) {
args := ctx.Args()
err := newDrive(args).ListRevisions(drive.ListRevisionsArgs{
Out: os.Stdout,
Id: args.String("fileId"),
NameWidth: args.Int64("nameWidth"),
SizeInBytes: args.Bool("sizeInBytes"),
SkipHeader: args.Bool("skipHeader"),
})
checkErr(err)
}
开发者ID:RandomArray,项目名称:gdrive,代码行数:11,代码来源:handlers_drive.go
示例14: printHelp
func printHelp(ctx cli.Context) {
w := new(tabwriter.Writer)
w.Init(os.Stdout, 0, 0, 3, ' ', 0)
fmt.Fprintf(w, "%s usage:\n\n", Name)
for _, h := range ctx.Handlers() {
fmt.Fprintf(w, "%s %s\t%s\n", Name, h.Pattern, h.Description)
}
w.Flush()
}
开发者ID:RandomArray,项目名称:gdrive,代码行数:12,代码来源:handlers_meta.go
示例15: downloadQueryHandler
func downloadQueryHandler(ctx cli.Context) {
args := ctx.Args()
err := newDrive(args).DownloadQuery(drive.DownloadQueryArgs{
Out: os.Stdout,
Query: args.String("query"),
Force: args.Bool("force"),
Recursive: args.Bool("recursive"),
Path: args.String("path"),
Progress: progressWriter(args.Bool("noProgress")),
})
checkErr(err)
}
开发者ID:RandomArray,项目名称:gdrive,代码行数:12,代码来源:handlers_drive.go
示例16: listChangesHandler
func listChangesHandler(ctx cli.Context) {
args := ctx.Args()
err := newDrive(args).ListChanges(drive.ListChangesArgs{
Out: os.Stdout,
PageToken: args.String("pageToken"),
MaxChanges: args.Int64("maxChanges"),
Now: args.Bool("now"),
NameWidth: args.Int64("nameWidth"),
SkipHeader: args.Bool("skipHeader"),
})
checkErr(err)
}
开发者ID:RandomArray,项目名称:gdrive,代码行数:12,代码来源:handlers_drive.go
示例17: listRecursiveSyncHandler
func listRecursiveSyncHandler(ctx cli.Context) {
args := ctx.Args()
err := newDrive(args).ListRecursiveSync(drive.ListRecursiveSyncArgs{
Out: os.Stdout,
RootId: args.String("fileId"),
SkipHeader: args.Bool("skipHeader"),
PathWidth: args.Int64("pathWidth"),
SizeInBytes: args.Bool("sizeInBytes"),
SortOrder: args.String("sortOrder"),
})
checkErr(err)
}
开发者ID:RandomArray,项目名称:gdrive,代码行数:12,代码来源:handlers_drive.go
示例18: shareHandler
func shareHandler(ctx cli.Context) {
args := ctx.Args()
err := newDrive(args).Share(drive.ShareArgs{
Out: os.Stdout,
FileId: args.String("fileId"),
Role: args.String("role"),
Type: args.String("type"),
Email: args.String("email"),
Discoverable: args.Bool("discoverable"),
})
checkErr(err)
}
开发者ID:RandomArray,项目名称:gdrive,代码行数:12,代码来源:handlers_drive.go
示例19: downloadRevisionHandler
func downloadRevisionHandler(ctx cli.Context) {
args := ctx.Args()
err := newDrive(args).DownloadRevision(drive.DownloadRevisionArgs{
Out: os.Stdout,
FileId: args.String("fileId"),
RevisionId: args.String("revId"),
Force: args.Bool("force"),
Stdout: args.Bool("stdout"),
Path: args.String("path"),
Progress: progressWriter(args.Bool("noProgress")),
Timeout: durationInSeconds(args.Int64("timeout")),
})
checkErr(err)
}
开发者ID:RandomArray,项目名称:gdrive,代码行数:14,代码来源:handlers_drive.go
示例20: listHandler
func listHandler(ctx cli.Context) {
args := ctx.Args()
err := newDrive(args).List(drive.ListFilesArgs{
Out: os.Stdout,
MaxFiles: args.Int64("maxFiles"),
NameWidth: args.Int64("nameWidth"),
Query: args.String("query"),
SortOrder: args.String("sortOrder"),
SkipHeader: args.Bool("skipHeader"),
SizeInBytes: args.Bool("sizeInBytes"),
AbsPath: args.Bool("absPath"),
})
checkErr(err)
}
开发者ID:RandomArray,项目名称:gdrive,代码行数:14,代码来源:handlers_drive.go
注:本文中的github.com/prasmussen/gdrive/cli.Context类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论