Skip to content

Commit a59ff86

Browse files
committed
Rename 'change-visibility' tool for clarity
1 parent dca6eba commit a59ff86

File tree

7 files changed

+44
-21
lines changed

7 files changed

+44
-21
lines changed

README.md

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ Available tools include:
4444
* [`delete-unused-tags`](#delete-unused-tags)
4545
* [`find-replace`](#find-replace)
4646
* [`change-author`](#change-author)
47-
* [`change-visibility`](#change-visibility)
47+
* [`change-visibility-posts`](#change-visibility-posts)
48+
* [`change-visibility-pages`](#change-visibility-pages)
4849
* [`change-status`](#change-status)
4950
* [`change-role`](#change-role)
5051
* [`add-member-newsletter-subscription`](#add-member-newsletter-subscription)
@@ -342,25 +343,47 @@ gctools change-author <apiURL> <adminAPIKey> --author 'richard' --new_author 'mi
342343
```
343344

344345

345-
### change-visibility
346+
### change-visibility-posts
346347

347348
Change the visibility of posts
348349

349350
```sh
350351
# See all available options
351-
gctools change-visibility --help
352+
gctools change-visibility-posts --help
352353

353354
# Change the posts that are currently public to be members-only
354-
gctools change-visibility <apiURL> <adminAPIKey> --visibility 'public' --new_visibility 'members'
355+
gctools change-visibility-posts <apiURL> <adminAPIKey> --visibility 'public' --new_visibility 'members'
355356

356357
# Change the posts that are currently members-only to be paid-members only
357-
gctools change-visibility <apiURL> <adminAPIKey> --visibility 'members' --new_visibility 'paid'
358+
gctools change-visibility-posts <apiURL> <adminAPIKey> --visibility 'members' --new_visibility 'paid'
358359

359360
# Change the posts tagged with 'news' to be paid-members only
360-
gctools change-visibility <apiURL> <adminAPIKey> --tag 'news' --new_visibility 'paid'
361+
gctools change-visibility-posts <apiURL> <adminAPIKey> --tag 'news' --new_visibility 'paid'
361362

362363
# Change the posts tagged with 'news', and written by 'jane' to be paid-members only
363-
gctools change-visibility <apiURL> <adminAPIKey> --tag 'news' --author 'jane' --new_visibility 'paid'
364+
gctools change-visibility-posts <apiURL> <adminAPIKey> --tag 'news' --author 'jane' --new_visibility 'paid'
365+
```
366+
367+
368+
### change-visibility-pages
369+
370+
Change the visibility of pages
371+
372+
```sh
373+
# See all available options
374+
gctools change-visibility-pages --help
375+
376+
# Change the pages that are currently public to be members-only
377+
gctools change-visibility-pages <apiURL> <adminAPIKey> --visibility 'public' --new_visibility 'members'
378+
379+
# Change the pages that are currently members-only to be paid-members only
380+
gctools change-visibility-pages <apiURL> <adminAPIKey> --visibility 'members' --new_visibility 'paid'
381+
382+
# Change the pages tagged with 'news' to be paid-members only
383+
gctools change-visibility-pages <apiURL> <adminAPIKey> --tag 'news' --new_visibility 'paid'
384+
385+
# Change the pages tagged with 'news', and written by 'jane' to be paid-members only
386+
gctools change-visibility-pages <apiURL> <adminAPIKey> --tag 'news' --author 'jane' --new_visibility 'paid'
364387
```
365388

366389

bin/cli.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import addTagsCommands from '../commands/add-tags.js';
99
import changeAuthorCommands from '../commands/change-author.js';
1010
import changeRoleCommands from '../commands/change-role.js';
1111
import changeStatusCommands from '../commands/change-status.js';
12-
import changeVisibilityCommands from '../commands/change-visibility.js';
12+
import changeVisibilityPostsCommands from '../commands/change-visibility-posts.js';
1313
import changeVisibilityPagesCommands from '../commands/change-visibility-pages.js';
1414
import combineTagsCommands from '../commands/combine-tags.js';
1515
import contentStatsCommands from '../commands/content-stats.js';
@@ -35,7 +35,7 @@ prettyCLI.command(addTagsCommands);
3535
prettyCLI.command(changeAuthorCommands);
3636
prettyCLI.command(changeRoleCommands);
3737
prettyCLI.command(changeStatusCommands);
38-
prettyCLI.command(changeVisibilityCommands);
38+
prettyCLI.command(changeVisibilityPostsCommands);
3939
prettyCLI.command(changeVisibilityPagesCommands);
4040
prettyCLI.command(combineTagsCommands);
4141
prettyCLI.command(contentStatsCommands);

commands/change-visibility.js renamed to commands/change-visibility-posts.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import {ui} from '@tryghost/pretty-cli';
2-
import changeVisibility from '../tasks/change-visibility.js';
2+
import changeVisibilityPosts from '../tasks/change-visibility-posts.js';
33

44
// Internal ID in case we need one.
5-
const id = 'change-visibility';
5+
const id = 'change-visibility-posts';
66

77
const group = 'Content:';
88

99
// The command to run and any params
10-
const flags = 'change-visibility <apiURL> <adminAPIKey>';
10+
const flags = 'change-visibility-posts <apiURL> <adminAPIKey>';
1111

1212
// Description for the top level command
1313
const desc = 'Switch the visibility for posts from one level to another';
@@ -55,7 +55,7 @@ const run = async (argv) => {
5555

5656
try {
5757
// Fetch the tasks, configured correctly according to the options passed in
58-
let runner = changeVisibility.getTaskRunner(argv);
58+
let runner = changeVisibilityPosts.getTaskRunner(argv);
5959

6060
// Run the migration
6161
await runner.run(context);

commands/interactive.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ const run = async () => {
7777
value: tasks.changeAuthor.choice.value
7878
},
7979
{
80-
name: tasks.changeVisibility.choice.name,
81-
value: tasks.changeVisibility.choice.value
80+
name: tasks.changeVisibilityPosts.choice.name,
81+
value: tasks.changeVisibilityPosts.choice.value
8282
},
8383
{
8484
name: tasks.changeVisibilityPages.choice.name,

prompts/change-visibility.js renamed to prompts/change-visibility-posts.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import inquirerSearchCheckbox from 'inquirer-search-checkbox';
33
inquirer.registerPrompt('search-checkbox', inquirerSearchCheckbox);
44
import chalk from 'chalk';
55
import {ui} from '@tryghost/pretty-cli';
6-
import changeVisibility from '../tasks/change-visibility.js';
6+
import changeVisibilityPosts from '../tasks/change-visibility-posts.js';
77
import {getAPIAuthorsObj, getAPITagsObj, getAPIVisibilityObj} from '../lib/ghost-api-choices.js';
88
import ghostAPICreds from '../lib/ghost-api-creds.js';
99

1010
const choice = {
11-
name: 'Change Visibility',
12-
value: 'changeVisibility'
11+
name: 'Change Visibility for Posts',
12+
value: 'changeVisibilityPosts'
1313
};
1414

1515
const options = [
@@ -70,7 +70,7 @@ async function run() {
7070
let context = {errors: []};
7171

7272
try {
73-
let runner = changeVisibility.getTaskRunner(answers);
73+
let runner = changeVisibilityPosts.getTaskRunner(answers);
7474
await runner.run(context);
7575
ui.log.ok(`Successfully changed ${context.changed.length} posts in ${Date.now() - timer}ms.`);
7676
} catch (error) {

prompts/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import deleteTags from './delete-tags.js';
1212
import deleteUnusedTags from './delete-unused-tags.js';
1313
import findReplace from './find-replace.js';
1414
import changeAuthor from './change-author.js';
15-
import changeVisibility from './change-visibility.js';
15+
import changeVisibilityPosts from './change-visibility-posts.js';
1616
import changeVisibilityPages from './change-visibility-pages.js';
1717
import changeStatus from './change-status.js';
1818
import changeRole from './change-role.js';
@@ -36,7 +36,7 @@ export default {
3636
deleteUnusedTags,
3737
findReplace,
3838
changeAuthor,
39-
changeVisibility,
39+
changeVisibilityPosts,
4040
changeVisibilityPages,
4141
changeStatus,
4242
changeRole,
File renamed without changes.

0 commit comments

Comments
 (0)