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

Improved search criteria option parsing #146

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

Conversation

bdowling
Copy link
Contributor

@bdowling bdowling commented Sep 3, 2016

Search criteria option parsing is is improved in this PR. Fixes at least #14 and #71

The old default behavior, which was already deprecated by the warning message emitted as been further deprecated in this PR. A new option --match is added that is preferable and more explicit than the "assumption" previously made which avoids the warning. The manpage has been update to reflect more clearly that a [criteria] is required for search.

This PR fixes the case where you do

xdotool search --pid $$ getwindowname "%@"

previously it would consume the COMMAND CHAINING getwindowname as the search criteria and report "%@" as an error.

Previously deprecated --title option was removed from the manpage and usage.

- option --match added to skip error message searching all three
- simplified logic, removed extra variables
- updated help
Marked default search as deprecated given the warning message and
unanticpated behavior it can cause with COMMAND CHANINING.
Reordered manpage a little to identify criteria and options.
@bdowling
Copy link
Contributor Author

bdowling commented Sep 8, 2016

Jordan (@jordansissel) please let me know if there are any questions or concerns on this PR. I think you will find this fixes some bugs around search and --pid that have been reported a few times..

@@ -142,39 +153,36 @@ int cmd_search(context_t *context) {
consume_args(context, optind);

/* We require a pattern or a pid to search for */
if (context->argc < 1 && search.pid == 0) {
if ((context->argc < 1 && search.pid == 0) &&
!(search.searchmask & (SEARCH_NAME | SEARCH_CLASS | SEARCH_CLASSNAME))) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor note: SEARCH_PID could also just be looked for in the searchmask here as in line 164. Effect is the same, not sure which is clearer.

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.

1 participant