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

search: add --not-one flag for not using exit code 1 when no match #1810

Merged
merged 2 commits into from
May 11, 2024

Conversation

rzmk
Copy link
Collaborator

@rzmk rzmk commented May 10, 2024

Allows a user to keep using exit code 0 even if there are no matches.

Example

Say I have a file data.csv:

Name,Department,Salary,Phone
,IT,71000,
Alice Johnson,HR,65000,294-203-0222
Bob Anderson,IT,71000,
Jane Smith,Finance,75000,
John Doe,IT,60000,850-240-4924

Now I want to search a value but it doesn't exist:

qsv search 'Jake' data.csv

We'll get the headers back (so no matches):

Name,Department,Salary,Phone

And when we run:

echo $?

The value returned is the exit code, in this case 1. But by using --not-one we get 0.

Copy link
Owner

@jqnatividad jqnatividad left a comment

Choose a reason for hiding this comment

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

LGTM!

@jqnatividad jqnatividad merged commit 8223f09 into master May 11, 2024
15 checks passed
@jqnatividad
Copy link
Owner

Thanks @rzmk !

@rzmk rzmk deleted the search/not-one branch May 11, 2024 13:05
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.

None yet

2 participants