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

Feature Request: standards compliant command line parameter syntax #16

Closed
sparr opened this issue Dec 27, 2022 · 5 comments
Closed

Feature Request: standards compliant command line parameter syntax #16

sparr opened this issue Dec 27, 2022 · 5 comments

Comments

@sparr
Copy link

sparr commented Dec 27, 2022

Is your feature request related to a problem? Please describe.
The copy1 / paste4 etc syntax makes clipboard incompatible with tools that automatically handle command line parameters for other tools, such as https://github.com/nevesnunes/sh-manpage-completions

Describe the solution you'd like
Add an optional syntax to specify the clipboard number as a named parameter.

clipboard cut1 somefile could instead be clipboard cut -n 1 somefile or clipboard cut --clipboard-number=1 somefile

PS: It would be even better if this was the only syntax, and the user could implement shortcut aliases themself if they want them, but I suspect from the motivations described in the README that such a suggestion would get much less traction, so I've written this as a request for an option.

@Slackadays
Copy link
Owner

Clipboard intentionally breaks the rules here, so changing this syntax to only be the other option would make Clipboard worse. However, I'm open to adding a different supported syntax, but what would you do if you needed to copy a file with name "-c"?

@sparr
Copy link
Author

sparr commented Dec 27, 2022

The standard solution is to have a parameter named -- which stops parsing of later dashes as options and treats them as literal strings. So clipboard copy -c 1 -- -c would copy the file named -c to clipboard #1 (if -c specifies the clipboard number).

https://unix.stackexchange.com/questions/11376/what-does-double-dash-mean

@Slackadays
Copy link
Owner

Done, added in latest commit f9e83ed and we don't have to check for -- because Clipboard's current code will only check for the -c or --clipboard= once.

@sparr
Copy link
Author

sparr commented Dec 28, 2022

Does that mean that you have to specify -c 1 -c 1 to copy files named -c and 1?

@Slackadays
Copy link
Owner

That's one way you could do it, or just 1 -c since the current logic only checks the third argument for the presence of -c (the first being clipboard, the second (action) and the third 1)

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

No branches or pull requests

2 participants