cmd2 icon indicating copy to clipboard operation
cmd2 copied to clipboard

Consider implementing/documenting a way to disable clipboard feature

Open alhernau opened this issue 3 years ago • 2 comments

It would be nice to have a supported way to disable clipboard feature altogether. Purpose: Bypass checks and save a few milliseconds startup time (up to 400ms on systems I have to support)

alhernau avatar Apr 21 '22 16:04 alhernau

@alhernau This is a good callout since end users tend to care a lot about performance and startup time. I like this idea for a feature request. We can look into it. But please feel free to submit a PR.

tleonhardt avatar Jul 14 '22 17:07 tleonhardt

I wonder if we could make this a load-on-first-use thing so it doesn't impact startup time.

anselor avatar Jul 15 '22 18:07 anselor

I have a potential solution for this on the clipboard branch.

kotfu avatar Jan 29 '23 01:01 kotfu

If the goal is to improve startup time, what if, instead of yet another thing to configure, we defer loading anything related to the clipboard until something is called that uses it. Take the 400ms hit at that the point when something needs to use the clipboard.

anselor avatar Jan 29 '23 03:01 anselor

andd ... I just realized I'd said that months ago.

anselor avatar Jan 29 '23 03:01 anselor

The clipboard branch now has a useful solution to this problem. It both adds an allow_clipboard attribute and initialization parameter, but also defers the pyperclip initialization until the user attempts to direct output to the clipboard.

kotfu avatar Jan 31 '23 01:01 kotfu

This has been added and will be included in the next release of cmd2.

kotfu avatar Feb 27 '23 21:02 kotfu