Closed nodiscc closed 2 years ago
Hi!
It is required to pass all values to --searchtags
as a quoted string:
shaarli get-links --searchtags "video -idontwantthistag"
The value passed to --searchtags
must not start with a dash though, a workaround is to start the string with a space:
shaarli get-links --searchtags " -idontwantthistag -northisone"
This feels clumsy though, a solution could be to introduce an excludetags
parameter to the API so we can do:
shaarli get-links --searchtags video --excludetags idontwantthistag
For clarity and consistency we could have:
searchtags
(deprecated, kept for compatibility)includetags
excludetags
@ArthurHoaro what do you think of it?
shaarli get-links --searchtags "video -idontwantthistag" shaarli get-links --searchtags " -idontwantthistag -northisone"
Thanks!
It is required to pass all values to --searchtags as a quoted string:
It does work without quotes (except this edge case with the minus sign), it's what confused me initially:
(.venv) $ shaarli get-links --limit 2 --searchtags video technology
# returns correct results
The value passed to --searchtags must not start with a dash though, a workaround is to start the string with a space: This feels clumsy though, a solution could be to introduce an excludetags parameter to the API
Actually your workaround looks fine to me, if we document it.
I'd rather have a consistency between API parameters, python client command line, and Shaarli URL parameters (what you suggest would mean supporting the excludetags
URL parameter in Shaarli, hence an extra search field, am I right?) I think the -
operator make more sense.
The fact that it does not work in first position with the python client is an unfortunate limitation of the ArgumentParser
implementation. Really, I can live with it.
https://shaarli.example.org/?searchterm=&searchtags=video+-idontwantthistag will return all links tagged
video
but NOT taggedidontwantthistag
. Excluding tags in this way using the python client does not appear to work.This might be a limitation of the API (?), I have not checked using
curl
since I don't know exactly how to generate a JWT token to use withcurl --header 'Autorization: Bearer ...