Skip to content

feat: facet argument for content item commands #111

Merged
rs-amp merged 9 commits into
amplience:masterfrom
rs-amp:feature/facet
Jan 6, 2022
Merged

feat: facet argument for content item commands #111
rs-amp merged 9 commits into
amplience:masterfrom
rs-amp:feature/facet

Conversation

@rs-amp
Copy link
Copy Markdown
Contributor

@rs-amp rs-amp commented Aug 18, 2021

This PR replaces the existing --name and --schemaId arguments with an all encompassing --facet argument, which adds filtering by locale and date modified.

These filters can be applied to any array of content items, and can currently be used on content-item archive unarchive copy move and export. As of right now, the facets are applied in software after fetching all content items (within the requested hub/repo/folder), though it is possible in the future to extend this to request content with the facets to save time in future. Note that the regex faceting mode will likely not see this treatment.

A full explanation of the --facet argument has been added to the HOW_TO_USE.md file. I'll dupe it below for ease of access:

FACETS

The content item export, copy, move, archive and unarchive commands allow the user to provide a facet string to filter the content that the commands work on. Multiple of these can be applied at a time, and you can even match on regex string. Note that you will need to surround your facet in quotes if it contains a space, which will change how backslash escaping works.

  • name: Filter on content item label. Example: --facet "name:exact name match"
  • schema: Filter on schema ids. Example: --facet schema:http://example.com/schema.json
  • locale: Filter on content item locale. Example: --facet locale:en-GB
  • lastModifiedDate: Filter on last modified date. Example: --facet "lastModifiedDate:Last 7 days"

Multiple facets can be applied at once when separated by a comma. Example:
--facet "schema:http://example.com/schema.json, name:/name regex/"

Commas can be escaped with a backslash, if they are used in your values. The whitespace after a comma is optional.

PRESET DATE RANGES

The preset date ranges are the same as DC provides:

  • Last 7 days
  • Last 14 days
  • Last 30 days
  • Last 60 days
  • Over 60 days

REGEX

You can use regex values on string fields when filtering content. They cannot be used on date ranges. Regex are surronded by two forward slashes:
--facet "name:/ends with this$/"

Copy link
Copy Markdown
Member

@easen-amp easen-amp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this removes and existing argument, it should be flagged as a breaking change see https://github.com/googleapis/release-please#how-should-i-write-my-commits

As it's pre v1.0.0, all this would do is bump the minor version.

@rs-amp rs-amp changed the title feat: facet argument for content item commands feat!: facet argument for content item commands Sep 17, 2021
@rs-amp
Copy link
Copy Markdown
Contributor Author

rs-amp commented Sep 17, 2021

I've changed the title to indicate the breaking change. It should be used as the commit message when squashed.

@rs-amp rs-amp changed the title feat!: facet argument for content item commands feat: facet argument for content item commands Sep 21, 2021
Copy link
Copy Markdown
Member

@easen-amp easen-amp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 For adding the old options back in. Can the help text be added back in, but mention that it is now deprecated.

Can the readme be updated to include mention that these options are now deprecated and document how to migrate to the new facet option.

@rs-amp
Copy link
Copy Markdown
Contributor Author

rs-amp commented Sep 22, 2021

The option description was removed because the old options were hidden. Should they be unhidden?

@rs-amp
Copy link
Copy Markdown
Contributor Author

rs-amp commented Nov 12, 2021

The PR has been updated to fix a few issues with the old argument support.

@rs-amp rs-amp merged commit dd4ddab into amplience:master Jan 6, 2022
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