abhi-cli-content-type v1.0.2
Description
This is a plugin for Contentstack's CLI. It allows you to quickly retrieve information about Content Types in a Stack.
Why use this plugin
The
csdx content-type:auditcommand lists recent changes to a content type and by whom. This is useful when needing to find Content Type versions to compare withcsdx content-type:compare. Audit logs are stored for 90 days within Contentstack.The
csdx content-type:compare-remotecommand allows you to compare the same Content Type between two Stacks. This is useful when you have cloned or duplicated a Stack, and want to check what has changed in a child Stack.The
csdx content-type:comparecommand allows you to compare multiple versions of a Content Type within a single Stack. This is useful when you are working in a development team, and want to compare changes made by colleagues.The
csdx content-type:listcommand is useful when you want to see all the Content Types within a Stack. The Content Type's Display Name, UID, Last Modified Date, and Version number is shown. The list can be ordered bytitleormodifieddate. When developing against Contentstack, Content Type UIDs are needed when requesting data.The
csdx content-type:detailscommand provides useful information, such as:- Field UID and Data Types
- Referenced Content Types
- Options such as required, multiple, and unique
- The full path to a field, useful when using the include reference endpoint or filtering operations, such as the equality endpoint.
The
csdx content-type:diagramcommand creates a visual representation of a Stack's content model.- The ouput format can be either
svgordot. - The diagram's orientation can be changed, using the
-d landscape|portraitflag. - GraphViz is the layout engine. You can export the generated DOT Language source, using the
-t dotflag.
- The ouput format can be either
How to install this plugin
$ csdx plugins:install contentstack-cli-content-typeHow to use this plugin
This plugin requires you to be authenticated using csdx auth:login.
Several commands, such as csdx content-type:compare support token aliases as input.
These token aliases should be created using csdx auth:tokens:add.
The commands only use the Stack API Key. The management token is ignored. They are provided as a convenience, so the Stack API Keys do not have to be re-typed.
Usability
The csdx content-type:details command requires a wide terminal window. If the path column is not needed, you can hide it:
$ csdx content-type:details -a "management token" -c "content type" --no-pathCommands
csdx content-type:auditcsdx content-type:comparecsdx content-type:compare-remotecsdx content-type:detailscsdx content-type:diagramcsdx content-type:list
csdx content-type:audit
display recent changes to a Content Type
USAGE
$ csdx content-type:audit
OPTIONS
-a, --token-alias=token-alias management token alias
-c, --content-type=content-type (required) Content Type UID
-s, --stack=stack Stack UID
EXAMPLES
$ csdx content-type:audit -s "xxxxxxxxxxxxxxxxxxx" -c "home_page"
$ csdx content-type:audit -a "management token" -c "home_page"See code: src/commands/content-type/audit.ts
csdx content-type:compare
compare two Content Type versions
USAGE
$ csdx content-type:compare
OPTIONS
-a, --token-alias=token-alias management token alias
-c, --content-type=content-type (required) Content Type UID
-l, --left=left Content Type version, i.e. prev version
-r, --right=right Content Type version, i.e. later version
-s, --stack=stack Stack UID
EXAMPLES
$ csdx content-type:compare -s "xxxxxxxxxxxxxxxxxxx" -c "home_page"
$ csdx content-type:compare -s "xxxxxxxxxxxxxxxxxxx" -c "home_page" -l # -r #
$ csdx content-type:compare -a "management token" -c "home_page" -l # -r #See code: src/commands/content-type/compare.ts
csdx content-type:compare-remote
compare two Content Types on different Stacks
USAGE
$ csdx content-type:compare-remote
OPTIONS
-c, --content-type=content-type (required) Content Type UID
-o, --origin-stack=origin-stack (required) origin Stack UID
-r, --remote-stack=remote-stack (required) remote Stack UID
EXAMPLE
$ csdx content-type:compare-remote -o "xxxxxxxxxxxxxxxxxxx" -r "xxxxxxxxxxxxxxxxxxx" -c "home_page"See code: src/commands/content-type/compare-remote.ts
csdx content-type:details
display Content Type details
USAGE
$ csdx content-type:details
OPTIONS
-a, --token-alias=token-alias management token alias
-c, --content-type=content-type (required) Content Type UID
-p, --[no-]path show path column
-s, --stack=stack Stack UID
EXAMPLES
$ csdx content-type:details -s "xxxxxxxxxxxxxxxxxxx" -c "home_page"
$ csdx content-type:details -a "management token" -c "home_page"
$ csdx content-type:details -a "management token" -c "home_page" --no-pathSee code: src/commands/content-type/details.ts
csdx content-type:diagram
create a visual diagram of a Stack's Content Types
USAGE
$ csdx content-type:diagram
OPTIONS
-a, --token-alias=token-alias management token alias
-d, --direction=portrait|landscape (required) [default: portrait] graph orientation
-o, --output=output (required) full path to output
-s, --stack=stack Stack UID
-t, --type=svg|dot (required) [default: svg] graph output file type
EXAMPLES
$ csdx content-type:diagram -s "xxxxxxxxxxxxxxxxxxx" -o "content-model.svg"
$ csdx content-type:diagram -a "management token" -o "content-model.svg"
$ csdx content-type:diagram -a "management token" -o "content-model.svg" -d "landscape"
$ csdx content-type:diagram -a "management token" -o "content-model.dot" -t "dot"See code: src/commands/content-type/diagram.ts
csdx content-type:list
list all Content Types in a Stack
USAGE
$ csdx content-type:list
OPTIONS
-a, --token-alias=token-alias management token alias
-o, --order=title|modified [default: title] order by column
-s, --stack=stack Stack UID
EXAMPLES
$ csdx content-type:list -s "xxxxxxxxxxxxxxxxxxx"
$ csdx content-type:list -a "management token"
$ csdx content-type:list -a "management token" -o modifiedSee code: src/commands/content-type/list.ts