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

Special case for xclip to support --help #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

EdwardBetts
Copy link
Contributor

When somebody tries a new tool they're likely to try --help to find how to use it.

This commit adds a special case to show the usage information when called with --help as the first argument.

When somebody tries a new tool they're likely to try --help to find how
to use it.

This commit adds a special case to show the usage information when
called with --help as the first argument.
@astrand
Copy link
Owner

astrand commented Nov 20, 2017

xclip already has "-h" and "-help". I don't think we should add a special exception just for help. We could consider supporting both single and double dashes for all options like, for example, vncviewer, but I'm not sure it is worth it.

@hackerb9
Copy link
Collaborator

I believe that if it is easy, it is completely worth it. Using double-dashes is the norm for most UNIX applications I use and I have to remind myself that xclip will get confused if I do that. However, I understand parsing the command line arguments using XrmParseCommand(3) severely restricts what can be done and it might not even be possible.

Since the command line parsing is fairly simple, it might make more sense to switch over to GNU's getopt_long_only(3) which handles both single and double dash long options as well as short options. I believe current users would not notice any difference, except that incorrect arguments like "-targets" won't give the error message: "No such file or directory".

It may seem strange to depend on a GNU extension, but the BSD systems implemented a getopt_long_only workalike. I haven't seen a UNIX machine without it in a long, long time.

Still, I can understand if that's not acceptable for portability reasons or if it is very important to use the Xresources Database for options.

However, at the least, it shouldn't harm anything to accept this patch. It would alllow novice users to use '--help' and adds only a few extra lines. It wouldn't even need to be a documented or supported feature, just a nicety for those first learning xclip who stumble upon it.

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