cmd.go 862 B

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