Closed mailsanchu closed 11 months ago
I am trying to find a url and activate it. I can use it. Using grep.
bt list | grep "facebok.com" |awk -F ' ' '{print $1}'
Can we do this using brotab
without using grep
and awk
It should be possible to not have the grep step. I'm not really familiar with awk, so I'm not sure what that step is doing.
I believe this query should work for the part before the second pipe in your bash line there :
brotab query -url *://*.facebook.com/*
I believe the pages https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/Tabs/query and https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Match_patterns document the "tabs.query" api and the "match patterns" for urls that are used in it.
Edit: Note that if you have multiple tabs open on facebook.com , this will list multiple tabs, each on its own line.
awk
is spliting the output by space and getting the tab id. Is it possible only to get the tab id in the output?
I don't know of a way to do that with just brotab.
Personally, I use cut
for that, instead of awk
.
Actually, I'm pretty sure that the brotab command line program receives the information in that format when it receives it from the browser extension. It isn't doing that itself. So, in order for it to give you the split version, it would have to do the splitting itself. Which, it could, but I don't think there is an option for that at present.
That is perfectly fine. Closing the ticket
Last question
Can we get multiple domains using query like facebook or github?
brotab query -url *://*.facebook.com/*
Yup! brotab query -url *://*.facebook.com/* -url *://*.github.com/*
will search for tabs satisfying either url condition
Have you tried
brotab query --help
? It gives a list of the arguments you can use with it, and generally how to use them.Does this answer your question? If not, can you be more specific?