Skip to content

Commit

Permalink
Merge pull request #1877 from Automattic/update/docs-pt-cache
Browse files Browse the repository at this point in the history
Updated vip cache commands descriptions and examples to follow the VIP-CLI style guide
  • Loading branch information
yolih authored Jun 20, 2024
2 parents a75b2ca + 9447de1 commit c7b7683
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
18 changes: 12 additions & 6 deletions src/bin/vip-cache-purge-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,20 @@ import * as exit from '../lib/cli/exit';
import { readFromFile } from '../lib/read-file';
import { trackEvent } from '../lib/tracker';

const usage = 'vip cache purge-url';
const exampleUsage = 'vip @example-app.develop cache purge-url';

const examples = [
{
usage: 'vip cache purge-url <URL>',
description: 'Purge a URL from page cache',
usage:
`${ exampleUsage } https://example-app-develop.go-vip.co/sample-page/` +
'\n - Purged URL: https://example-app.develop.go-vip.co/sample-page/',
description: 'Purge the page cache for a single URL.',
},
{
usage: 'vip cache purge-url --from-file=/dev/vip/urls.txt',
description: 'Purge multiple URLs from page cache',
usage: `${ exampleUsage } --from-file=./urls.txt`,
description:
'Purge the page cache for multiple URLs, each listed on a single line in a local file.',
},
];

Expand Down Expand Up @@ -64,8 +70,8 @@ command( {
appQuery,
envContext: true,
wildcardCommand: true,
usage: 'vip cache purge-url <URL>',
usage,
} )
.option( 'from-file', 'Read URLs from file (useful to purge multiple URLs)' )
.option( 'from-file', 'Read one or more URLs from a file, each listed on a single line.' )
.examples( examples )
.argv( process.argv, cachePurgeCommand );
21 changes: 20 additions & 1 deletion src/bin/vip-cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,27 @@

import command from '../lib/cli/command';

const usage = 'vip cache';
const exampleUsage = 'vip @example-app.develop cache';

const examples = [
{
usage:
`${ exampleUsage } purge-url https://example-app-develop.go-vip.co/sample-page/` +
'\n - Purged URL: https://example-app.develop.go-vip.co/sample-page/',
description: 'Purge the page cache for a single URL.',
},
{
usage: `${ exampleUsage } purge-url --from-file=./urls.txt`,
description:
'Purge the page cache for multiple URLs, each listed on a single line in a local file.',
},
];

command( {
requiredArgs: 1,
usage,
} )
.command( 'purge-url', 'Purge page cache' )
.command( 'purge-url', 'Purge page cache for one or more URLs.' )
.examples( examples )
.argv( process.argv );
2 changes: 1 addition & 1 deletion src/bin/vip.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const runCmd = async function () {
.command( 'logout', 'Log out the current authenticated VIP-CLI user.' )
.command( 'app', 'List and modify your VIP applications' )
.command( 'backup', 'Generate a backup of an environment.' )
.command( 'cache', 'Manage page cache for your VIP applications' )
.command( 'cache', 'Manage page cache for an environment.' )
.command( 'config', 'Manage environment configurations.' )
.command( 'dev-env', 'Create and manage VIP Local Development Environments.' )
.command( 'export', 'Export a copy of data associated with an environment.' )
Expand Down

0 comments on commit c7b7683

Please sign in to comment.