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

Auto-select company's uniq result #1

Conversation

acdesouza
Copy link

@acdesouza acdesouza commented Jan 6, 2019

I wish to generate all companies reports, so I could filter which company to analyse and which to ignore.

So, you could generate all report using:
$ ./rapina list | xargs -I % ./rapina report '%'

Also, you could filter by name:
$ ./rapina list | grep ITAÚ | xargs -I % ./rapina report '%'

disclaimer: I'm not a Go developer. So, sorry for mistakes ;)

So, you could generate all report using:
$ ./rapina list | xargs -I % ./rapina report '%'

Also, you could filter by name:
$ ./rapina list | grep ITAÚ | xargs -I % ./rapina report '%'
@dude333
Copy link
Owner

dude333 commented Jan 6, 2019

Hey, good point. I'll add this as an option to the report command. Something like rapina report --all and rapina report --like itau. What do you think?

@acdesouza
Copy link
Author

I have a strong believe in simplicity. And the --all feels like an increase in complexity.

On the other hand, I'd no ideia how to do it on Windows. Which doesn't have the |(pipe) operator.

@dude333
Copy link
Owner

dude333 commented Jan 7, 2019

Yes, the simpler the better. And I discovered a way to run it on Windows, so if you agree we can cancel this PR.

I found a source code for a Windows xargs (xargs.bat) here. And I tested it using the -s flag (with this flag there is no need to change the code as you proposed):

rapina list | findstr WE | xargs rapina report -s

findstr is a grep equivalent on Windows.

@acdesouza
Copy link
Author

Yes, the simpler the better. And I discovered a way to run it on Windows, so if you agree we can cancel this PR.

This PR is to auto-select a company, when only one was returned. So, you could use rapina on a pipe. Otherwise, they will fail to generate report, since rapina was waiting and company confirmation.

@dude333
Copy link
Owner

dude333 commented Jan 8, 2019

Actually, that's the purpose of the -s flag (rapina report -s company_name).

The -s or --script flag is there to be used on scripts, pipes and other actions where no user interaction is desired.

This is the code that deals with the script flag:

// Script mode
if len(matches) >= 1 && scriptMode {
	rank := fuzzy.RankFindFold(company, matches)
	if len(rank) <= 0 {
		return ""
	}
	sort.Sort(rank)
	return rank[0].Target
}

@urlan
Copy link

urlan commented Jul 6, 2019

Hey, good point. I'll add this as an option to the report command. Something like rapina report --all and rapina report --like itau. What do you think?

I think it's a perfect idea. So, besides including the "--all" parameter, why don't you search for the companies based on CNPJ or CVM number, once these strings are like keys, instead of the name?

Thank you so much for the tool. I appreciate a lot! =)

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