main.go 617 B

123456789101112131415161718192021222324252627282930313233
  1. // License: GPLv3 Copyright: 2022, Kovid Goyal, <kovid at kovidgoyal.net>
  2. package clipboard
  3. import (
  4. "os"
  5. "kitty/tools/cli"
  6. )
  7. func run_mime_loop(opts *Options, args []string) (err error) {
  8. cwd, err = os.Getwd()
  9. if err != nil {
  10. return err
  11. }
  12. if opts.GetClipboard {
  13. return run_get_loop(opts, args)
  14. }
  15. return run_set_loop(opts, args)
  16. }
  17. func clipboard_main(cmd *cli.Command, opts *Options, args []string) (rc int, err error) {
  18. if len(args) > 0 {
  19. return 0, run_mime_loop(opts, args)
  20. }
  21. return 0, run_plain_text_loop(opts)
  22. }
  23. func EntryPoint(parent *cli.Command) {
  24. create_cmd(parent, clipboard_main)
  25. }