Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating vip cache commands descriptions and examples to follow the VIP-CLI style guide #1877

Merged
merged 3 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.',
Copy link
Member

@sanmai sanmai Jun 18, 2024

Choose a reason for hiding this comment

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

Looks like this:
Screenshot

Copy link
Contributor

Choose a reason for hiding this comment

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

I just tested this and can confirm that the example output matches the actual output when that command is run successfully. 👍

},
{
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