cmd.go 768 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright 2015 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package cmd
  5. import (
  6. "time"
  7. "github.com/urfave/cli"
  8. )
  9. func stringFlag(name, value, usage string) cli.StringFlag {
  10. return cli.StringFlag{
  11. Name: name,
  12. Value: value,
  13. Usage: usage,
  14. }
  15. }
  16. func boolFlag(name, usage string) cli.BoolFlag {
  17. return cli.BoolFlag{
  18. Name: name,
  19. Usage: usage,
  20. }
  21. }
  22. func intFlag(name string, value int, usage string) cli.IntFlag {
  23. return cli.IntFlag{
  24. Name: name,
  25. Value: value,
  26. Usage: usage,
  27. }
  28. }
  29. func durationFlag(name string, value time.Duration, usage string) cli.DurationFlag {
  30. return cli.DurationFlag{
  31. Name: name,
  32. Value: value,
  33. Usage: usage,
  34. }
  35. }