From 9e94a89f2ca772cd79de22b75f74c958aa2d777c Mon Sep 17 00:00:00 2001 From: David Kegley Date: Thu, 10 Feb 2022 14:05:18 -0500 Subject: [PATCH 1/2] default to == when no version filter is supplied --- rsconnect/actions_content.py | 2 +- rsconnect/models.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/rsconnect/actions_content.py b/rsconnect/actions_content.py index 2d472e06..c30741de 100644 --- a/rsconnect/actions_content.py +++ b/rsconnect/actions_content.py @@ -345,7 +345,7 @@ def do_filter(item): return compare == 1 elif version_filter.comp == "<": return compare == -1 - elif version_filter.comp == "==": + elif version_filter.comp in ["=", "=="]: return compare == 0 elif version_filter.comp == "<=": return compare <= 0 diff --git a/rsconnect/models.py b/rsconnect/models.py index a0c2c5dc..dce1204b 100644 --- a/rsconnect/models.py +++ b/rsconnect/models.py @@ -11,7 +11,7 @@ from click import ParamType from click.types import StringParamType -_version_search_pattern = r"(^[=><]{1,2})(.*)" +_version_search_pattern = r"(^[=><]{0,2})(.*)" _content_guid_pattern = r"([^,]*),?(.*)" @@ -310,7 +310,11 @@ def convert(self, value, param, ctx): version_search.comp = m.group(1) version_search.vers = m.group(2) - if version_search.comp in ["<<", "<>", "><", ">>", "=<", "=>", "="]: + # default to == if no comparator was provided + if not version_search.comp: + version_search.comp = "==" + + if version_search.comp not in [">", "<", ">=", "<=", "=", "=="]: self.fail("Failed to parse verison filter: %s is not a valid comparitor" % version_search.comp) try: From 5c964fbad6a24b03a177ea602b83de690b4fc025 Mon Sep 17 00:00:00 2001 From: David Kegley Date: Thu, 10 Feb 2022 14:16:32 -0500 Subject: [PATCH 2/2] add note to readme about quoting version filter args --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index a01bda2c..6ade6eac 100644 --- a/README.md +++ b/README.md @@ -821,6 +821,11 @@ The following are some examples of how publishers might use the By default, the `rsconnect content search` command will return metadata for ALL of the content on a RStudio Connect server, both published and unpublished content. +> **Note:** When using the `--r-version` and `--py-version` flags, users should +> make sure to quote the arguments to avoid conflicting with your shell. For +> example, bash would interpret `--py-version >3.0.0` as a shell redirect because of the +> unquoted `>` character. + ```bash # return only published content $ rsconnect content search --published