Skip to content

Commit 4205716

Browse files
authored
Merge pull request #226 from rstudio/kegs-version-search
Content version search filter improvements
2 parents 654d4bb + 5c964fb commit 4205716

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,11 @@ The following are some examples of how publishers might use the
821821
By default, the `rsconnect content search` command will return metadata for ALL
822822
of the content on a RStudio Connect server, both published and unpublished content.
823823
824+
> **Note:** When using the `--r-version` and `--py-version` flags, users should
825+
> make sure to quote the arguments to avoid conflicting with your shell. For
826+
> example, bash would interpret `--py-version >3.0.0` as a shell redirect because of the
827+
> unquoted `>` character.
828+
824829
```bash
825830
# return only published content
826831
$ rsconnect content search --published

rsconnect/actions_content.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ def do_filter(item):
345345
return compare == 1
346346
elif version_filter.comp == "<":
347347
return compare == -1
348-
elif version_filter.comp == "==":
348+
elif version_filter.comp in ["=", "=="]:
349349
return compare == 0
350350
elif version_filter.comp == "<=":
351351
return compare <= 0

rsconnect/models.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from click import ParamType
1212
from click.types import StringParamType
1313

14-
_version_search_pattern = r"(^[=><]{1,2})(.*)"
14+
_version_search_pattern = r"(^[=><]{0,2})(.*)"
1515
_content_guid_pattern = r"([^,]*),?(.*)"
1616

1717

@@ -310,7 +310,11 @@ def convert(self, value, param, ctx):
310310
version_search.comp = m.group(1)
311311
version_search.vers = m.group(2)
312312

313-
if version_search.comp in ["<<", "<>", "><", ">>", "=<", "=>", "="]:
313+
# default to == if no comparator was provided
314+
if not version_search.comp:
315+
version_search.comp = "=="
316+
317+
if version_search.comp not in [">", "<", ">=", "<=", "=", "=="]:
314318
self.fail("Failed to parse verison filter: %s is not a valid comparitor" % version_search.comp)
315319

316320
try:

0 commit comments

Comments
 (0)