Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add shortcuts for selection and version options in xclip #150

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

erikd234
Copy link

This commit introduces two new command-line shortcuts for the xclip utility. The '-s' shortcut has been added for the '--selection'
option, allowing users to specify the X selection (primary, clipboard, secondary, or buffer-cut) more conveniently. Additionally, the
'-v' shortcut for '--version' has been implemented, making it easier to check the version of xclip. The help message in xcprint.c has
been updated accordingly to reflect these new shortcuts.

Also I added in the help command the short forms of the differetn selection targets (p, s, c , and b)

If you want me to update the to also use -s I can, manual testing works and the tests pass after changes.

 This commit introduces two new command-line shortcuts for the xclip utility. The '-s' shortcut has been added for the '--selection'
 option, allowing users to specify the X selection (primary, clipboard, secondary, or buffer-cut) more conveniently. Additionally, the
 '-v' shortcut for '--version' has been implemented, making it easier to check the version of xclip. The help message in xcprint.c has
 been updated accordingly to reflect these new shortcuts.
@hackerb9
Copy link
Collaborator

hackerb9 commented Jan 22, 2024

Thanks for the pull request, Erik!

I'm surprised -sel is not in the short help. Perhaps that is because xclip, like many X applications, allows any option to be abbreviated as long as it is unique. My tab completion on xclip -sTab shows

$ xclip -s
-selection  -sensitive  -silent

That means if xclip ever adds a -selfie options, for example, -sel would stop working and the documentation mentioning it would need to be changed.

While I like your proposal, I'm against using -s for selection, but only because it could be even better.

A while ago I made a pull request for a version which provided -c for clipboard, which is pretty much the only selection anyone frequently wants access to that is not the default. I do not think it got merged, though. (I also added -b for compatibility with xsel.)

By the way, editing the short help is not enough when changing command line options. The man page and the tab completion should also be updated.

@erikd234
Copy link
Author

erikd234 commented Jan 22, 2024

Thanks, I thougth about the man page but I coudnlt find the man entry in the code base.

I see what your saying about -c. But -s fits with the other shortcuts (although -s could also be -silent)

At the very least we should add -sel to the help menu and man page. (and the info about c,s,p,b)

@quartzjer
Copy link
Collaborator

Hi @erikd234! I'm helping @astrand with some maintenance of xclip, I've brought your PR up to date with master.

If you're still interested in getting this merged, would you be up for updating the man page (xclip.1 file) too?

I've got no issues w/ -s as I don't see the xclip arg-space getting much more busy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants