-
Notifications
You must be signed in to change notification settings - Fork 26
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
update dasht-query-line and dasht-query-html to work with tsv #56
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR. I've requested some minor changes in the code review.
bin/dasht-query-line
Outdated
@@ -28,8 +28,8 @@ | |||
# | |||
# Searches for *PATTERN* in all installed [Dash] docsets, optionally searching | |||
# only in those whose names match *DOCSET*s, by calling dasht-query-exec(1) | |||
# and emits the results in groups of lines, as described in "Results" below. | |||
# However, if no results were found, this program exits with a nonzero status. | |||
# and emits the results as TSV. However, if no results were found, this program |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please spell out "TSV" in prose: "as TSV" -> "in Tab Separated Vector (TSV) format"
bin/dasht-query-line
Outdated
@@ -42,26 +42,24 @@ | |||
# | |||
# ### Results | |||
# | |||
# Each search result is printed to stdout as a group of four lines of text: | |||
# Each search result is printed to stdout as a tab-separated line with fields: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fields are separated, not the line; so "as a line with 4 tab-separated fields".
bin/dasht-query-line
Outdated
@@ -245,9 +243,11 @@ dasht-docsets "$@" | while read -r docset; do | |||
|
|||
{ $1 = $1 } # strip whitespace from key | |||
|
|||
$2 == "=" { | |||
result[$1] = substr($0, index($0, $2) + length($2) + 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would change the index($0, $2)
call to length($1) + 1
for robustness (no problem if $1
contains =
).
bin/dasht-query-line
Outdated
|
||
/./ # reject any empty lines from input | ||
# print TSV line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would drop this (redundant) comment.
bin/dasht-query-line
Outdated
|
||
/./ # reject any empty lines from input | ||
# print TSV line | ||
printf "%s\t%s\t%s\t%s\n", result["name"], docset, \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add parentheses to the printf()
call and list each argument on its own line.
Made the changes! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @smackesey! I found some time to experiment with your latest changes and I would suggest applying the changes in the attached patch file in addition to my code review feedback.
This PR is coming along nicely and we'll reach the finish line soon! 😅 Thanks for your patience.
Thanks! So I made the changes you listed, but I was unable to apply the patch. I've never applied a patch file to a git repo before so perhaps I was doing something wrong, but I tried
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update. There's a potential AWK incompatibility that I've called out in the code review. No worries about the patch file: I'll apply it on my side when I finally merge the PR. 🤓
Looks great, thanks! I'll try this out for a few days and let you know. Overall, we should be good to merge. 👍 |
Hi @smackesey, I found an issue when searching the BASH docset:
Following the first result link shows a |
Fixed, the issue was that the |
Sorry for the long delay. 😅 I'll merge this PR soon (ETA this week). |
Switch to Tab-Separated Values (TSV) format in dasht-query-line(1) and dasht-query-html(1) for easier line-by-line parsing and user scripting.
Merged in commit 882c7f2. Thanks for your contribution 🙏 and sorry for the long delay! 😅 |
Switch to Tab-Separated Values (TSV) format in dasht-query-line(1) and dasht-query-html(1) for easier line-by-line parsing and user scripting.
I extracted my work on TSV from the other Dash.app integration fork so that this could be separately merged. It follows your requests in #38.