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

feat: rewrite command descriptions #727

Merged
merged 16 commits into from
Jan 15, 2025
Merged
3 changes: 1 addition & 2 deletions src/commands/actor/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { ApifyCommand } from '../../lib/apify_command.js';

export class ActorIndexCommand extends ApifyCommand<typeof ActorIndexCommand> {
static override description =
'Commands are designed to be used in Actor runs. All commands are in PoC state, do not use in production environments.\n';
static override description = 'Manages runtime data operations inside of a running Actor.';

async run() {
await this.printHelp();
Expand Down
12 changes: 6 additions & 6 deletions src/commands/actor/push-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import { error } from '../../lib/outputs.js';

export class PushDataCommand extends ApifyCommand<typeof PushDataCommand> {
static override description =
'Stores an object or an array of objects to the default dataset of the Actor run.\n' +
'It is possible to pass data using item argument or stdin.\n' +
'Passing data using argument:\n' +
'$ apify actor push-data {"foo": "bar"}\n' +
'Passing data using stdin with pipe:\n' +
'$ cat ./test.json | apify actor push-data\n';
"Saves data to Actor's run default dataset.\n\n" +
'Accept input as:\n' +
' - JSON argument:\n' +
' $ apify actor push-data {"key": "value"}\n' +
' - Piped stdin:\n' +
' $ cat ./test.json | apify actor push-data';

static override args = {
item: Args.string({
Expand Down
8 changes: 4 additions & 4 deletions src/commands/actor/set-value.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import { ApifyCommand } from '../../lib/apify_command.js';

export class SetValueCommand extends ApifyCommand<typeof SetValueCommand> {
static override description =
'Sets or removes record into the default KeyValueStore associated with the Actor run.\n' +
'It is possible to pass data using argument or stdin.\n' +
'Sets or removes record into the default key-value store associated with the Actor run.\n\n' +
'It is possible to pass data using argument or stdin.\n\n' +
'Passing data using argument:\n' +
'$ apify actor set-value KEY my-value\n' +
'$ apify actor set-value KEY my-value\n\n' +
'Passing data using stdin with pipe:\n' +
'$ cat ./my-text-file.txt | apify actor set-value KEY --contentType text/plain\n';
'$ cat ./my-text-file.txt | apify actor set-value KEY --contentType text/plain';

static override args = {
key: Args.string({
Expand Down
7 changes: 3 additions & 4 deletions src/commands/actors/call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ import { getLocalConfig, getLocalUserInfo, getLoggedClientOrThrow, TimestampForm

export class ActorsCallCommand extends ApifyCommand<typeof ActorsCallCommand> {
static override description =
'Runs a specific Actor remotely on the Apify cloud platform.\n' +
'The Actor is run under your current Apify account. Therefore you need to be logged in by calling "apify login". ' +
'It takes input for the Actor from the default local key-value store by default.';
'Executes Actor remotely using your authenticated account.\n' +
'Reads input from local key-value store by default.';

static override flags = {
...SharedRunOnCloudFlags('Actor'),
Expand Down Expand Up @@ -60,7 +59,7 @@ export class ActorsCallCommand extends ApifyCommand<typeof ActorsCallCommand> {
required: false,
description:
'Name or ID of the Actor to run (e.g. "my-actor", "apify/hello-world" or "E2jjCZBezvAZnX8Rb"). ' +
`If not provided, the command runs the remote Actor specified in the "${LOCAL_CONFIG_PATH}" file.`,
`If not provided, the command runs the remote Actor specified in the '${LOCAL_CONFIG_PATH}' file.`,
}),
};

Expand Down
2 changes: 1 addition & 1 deletion src/commands/actors/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ApifyCommand } from '../../lib/apify_command.js';

export class ActorIndexCommand extends ApifyCommand<typeof ActorIndexCommand> {
static override description = 'Commands are designed to be used with Actors.';
static override description = 'Manages Actor creation, deployment, and execution on the Apify platform.';

async run() {
await this.printHelp();
Expand Down
2 changes: 1 addition & 1 deletion src/commands/actors/ls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ interface HydratedListData {
}

export class ActorsLsCommand extends ApifyCommand<typeof ActorsLsCommand> {
static override description = 'Lists all recently ran Actors or your own Actors.';
static override description = 'Prints a list of recently executed Actors or Actors you own.';

static override flags = {
my: Flags.boolean({
Expand Down
4 changes: 2 additions & 2 deletions src/commands/actors/pull.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ const extractGitHubZip = async (url: string, directoryPath: string) => {

export class ActorsPullCommand extends ApifyCommand<typeof ActorsPullCommand> {
static override description =
'Pulls an Actor from the Apify platform to the current directory. ' +
'If it is defined as Git repository, it will be cloned. If it is defined as Web IDE, it will fetch the files.';
'Download Actor code to current directory. ' +
'Clones Git repositories or fetches Actor files based on the source type.';

static override flags = {
version: Flags.string({
Expand Down
17 changes: 7 additions & 10 deletions src/commands/actors/push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,20 @@ const DEFAULT_BUILD_TAG = 'latest';

export class ActorsPushCommand extends ApifyCommand<typeof ActorsPushCommand> {
static override description =
'Uploads the Actor to the Apify platform and builds it there.\n' +
`The Actor settings are read from the "${LOCAL_CONFIG_PATH}" file in the current directory, but they can be overridden using command-line options.\n` +
`NOTE: If the source files are smaller than ${
MAX_MULTIFILE_BYTES / 1024 ** 2
} MB then they are uploaded as \n` +
'"Multiple source files", otherwise they are uploaded as "Zip file".\n\n' +
"When there's an attempt to push files that are older than the Actor on the platform, the command will fail. Can be overwritten with --force flag.";
`Deploys Actor to Apify platform using settings from '${LOCAL_CONFIG_PATH}'.\n` +
`Files under '${MAX_MULTIFILE_BYTES / 1024 ** 2}' MB upload as "Multiple source files"; ` +
`larger projects upload as ZIP file.\n` +
`Use --force to override newer remote versions.`;

static override flags = {
version: Flags.string({
char: 'v',
description: `Actor version number to which the files should be pushed. By default, it is taken from the "${LOCAL_CONFIG_PATH}" file.`,
description: `Actor version number to which the files should be pushed. By default, it is taken from the '${LOCAL_CONFIG_PATH}' file.`,
required: false,
}),
'build-tag': Flags.string({
char: 'b',
description: `Build tag to be applied to the successful Actor build. By default, it is taken from the "${LOCAL_CONFIG_PATH}" file`,
description: `Build tag to be applied to the successful Actor build. By default, it is taken from the '${LOCAL_CONFIG_PATH}' file`,
required: false,
}),
'wait-for-finish': Flags.string({
Expand Down Expand Up @@ -87,7 +84,7 @@ export class ActorsPushCommand extends ApifyCommand<typeof ActorsPushCommand> {
required: false,
description:
'Name or ID of the Actor to push (e.g. "apify/hello-world" or "E2jjCZBezvAZnX8Rb"). ' +
`If not provided, the command will create or modify the Actor with the name specified in "${LOCAL_CONFIG_PATH}" file.`,
`If not provided, the command will create or modify the Actor with the name specified in '${LOCAL_CONFIG_PATH}' file.`,
}),
};

Expand Down
2 changes: 1 addition & 1 deletion src/commands/actors/rm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { error, info, success } from '../../lib/outputs.js';
import { getLoggedClientOrThrow } from '../../lib/utils.js';

export class ActorRmCommand extends ApifyCommand<typeof ActorRmCommand> {
static override description = 'Deletes an Actor.';
static override description = 'Permanently removes an Actor from your account.';

static override args = {
actorId: Args.string({
Expand Down
7 changes: 3 additions & 4 deletions src/commands/actors/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ import { getLocalConfig, getLocalUserInfo, getLoggedClientOrThrow, TimestampForm

export class ActorsStartCommand extends ApifyCommand<typeof ActorsStartCommand> {
static override description =
'Runs a specific Actor remotely on the Apify cloud platform and immediately returns information about the run.\n' +
'The Actor is run under your current Apify account. Therefore you need to be logged in by calling "apify login". ' +
'It takes input for the Actor from the default local key-value store by default.';
'Starts Actor remotely and returns run details immediately.\n' +
'Uses authenticated account and local key-value store for input.';

static override flags = {
...SharedRunOnCloudFlags('Actor'),
Expand Down Expand Up @@ -42,7 +41,7 @@ export class ActorsStartCommand extends ApifyCommand<typeof ActorsStartCommand>
required: false,
description:
'Name or ID of the Actor to run (e.g. "my-actor", "apify/hello-world" or "E2jjCZBezvAZnX8Rb"). ' +
`If not provided, the command runs the remote Actor specified in the "${LOCAL_CONFIG_PATH}" file.`,
`If not provided, the command runs the remote Actor specified in the '${LOCAL_CONFIG_PATH}' file.`,
}),
};

Expand Down
2 changes: 1 addition & 1 deletion src/commands/builds/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ApifyCommand } from '../../lib/apify_command.js';

export class ActorIndexCommand extends ApifyCommand<typeof ActorIndexCommand> {
static override description = 'Commands are designed to be used with Actor Builds.';
static override description = 'Manages Actor build processes and versioning.';

async run() {
await this.printHelp();
Expand Down
2 changes: 1 addition & 1 deletion src/commands/builds/rm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { error, info, success } from '../../lib/outputs.js';
import { getLoggedClientOrThrow } from '../../lib/utils.js';

export class BuildsRmCommand extends ApifyCommand<typeof BuildsRmCommand> {
static override description = 'Deletes an Actor Build.';
static override description = 'Permanently removes an Actor build from the Apify platform.';

static override args = {
buildId: Args.string({
Expand Down
2 changes: 1 addition & 1 deletion src/commands/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
} from '../lib/utils.js';

export class CreateCommand extends ApifyCommand<typeof CreateCommand> {
static override description = 'Creates a new Actor project directory from a selected boilerplate template.';
static override description = 'Creates an Actor project from a template in a new directory.';

static override flags = {
template: Flags.string({
Expand Down
2 changes: 1 addition & 1 deletion src/commands/datasets/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { error, success } from '../../lib/outputs.js';
import { getLoggedClientOrThrow } from '../../lib/utils.js';

export class DatasetsCreateCommand extends ApifyCommand<typeof DatasetsCreateCommand> {
static override description = 'Creates a new Dataset on your account';
static override description = 'Creates a new dataset for storing structured data on your account.';

static override args = {
datasetName: Args.string({
Expand Down
2 changes: 1 addition & 1 deletion src/commands/datasets/get-items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const downloadFormatToContentType: Record<DownloadItemsFormat, string> = {
};

export class DatasetsGetItems extends ApifyCommand<typeof DatasetsGetItems> {
static override description = 'Exports the items present in a Dataset.';
static override description = 'Retrieves dataset items in specified format (JSON, CSV, etc).';

static override flags = {
limit: Flags.integer({
Expand Down
2 changes: 1 addition & 1 deletion src/commands/datasets/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ApifyCommand } from '../../lib/apify_command.js';

export class DatasetsIndexCommand extends ApifyCommand<typeof DatasetsIndexCommand> {
static override description = 'Commands are designed to be used with Datasets.';
static override description = 'Manages structured data storage and retrieval.';

async run() {
await this.printHelp();
Expand Down
2 changes: 1 addition & 1 deletion src/commands/datasets/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const consoleLikeTable = new ResponsiveTable({
});

export class DatasetsInfoCommand extends ApifyCommand<typeof DatasetsInfoCommand> {
static override description = 'Shows information about a dataset.';
static override description = 'Prints information about a specific dataset.';

static override args = {
storeId: Args.string({
Expand Down
10 changes: 5 additions & 5 deletions src/commands/datasets/ls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@ const table = new ResponsiveTable({
});

export class DatasetsLsCommand extends ApifyCommand<typeof DatasetsLsCommand> {
static override description = 'Lists all Datasets on your account.';
static override description = 'Prints all datasets on your account.';

static override flags = {
offset: Flags.integer({
description: 'Number of Datasets that will be skipped.',
description: 'Number of datasets that will be skipped.',
default: 0,
}),
limit: Flags.integer({
description: 'Number of Datasets that will be listed.',
description: 'Number of datasets that will be listed.',
default: 20,
}),
desc: Flags.boolean({
description: 'Sorts Datasets in descending order.',
description: 'Sorts datasets in descending order.',
default: false,
}),
unnamed: Flags.boolean({
description: "Lists Datasets that don't have a name set.",
description: "Lists datasets that don't have a name set.",
default: false,
}),
};
Expand Down
4 changes: 2 additions & 2 deletions src/commands/datasets/push-items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import { error, success } from '../../lib/outputs.js';
import { getLoggedClientOrThrow } from '../../lib/utils.js';

export class DatasetsPushDataCommand extends ApifyCommand<typeof DatasetsPushDataCommand> {
static override description = 'Pushes an object or an array of objects to the provided Dataset.';
static override description = 'Adds data items to specified dataset. Accepts single object or array of objects.';

static override args = {
nameOrId: Args.string({
required: true,
description: 'The Dataset ID or name to push the objects to',
description: 'The dataset ID or name to push the objects to',
ignoreStdin: true,
}),
item: Args.string({
Expand Down
16 changes: 8 additions & 8 deletions src/commands/datasets/rename.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ import { error, success } from '../../lib/outputs.js';
import { getLoggedClientOrThrow } from '../../lib/utils.js';

export class DatasetsRenameCommand extends ApifyCommand<typeof DatasetsRenameCommand> {
static override description = 'Renames a Dataset, or removes its unique name';
static override description = 'Change dataset name or removes name with --unname flag.';

static override flags = {
unname: Flags.boolean({
description: 'Removes the unique name of the Dataset',
description: 'Removes the unique name of the dataset.',
}),
};

static override args = {
nameOrId: Args.string({
description: 'The Dataset ID or name to delete',
description: 'The dataset ID or name to delete.',
required: true,
}),
newName: Args.string({
description: 'The new name for the Dataset',
description: 'The new name for the dataset.',
}),
};

Expand Down Expand Up @@ -57,14 +57,14 @@ export class DatasetsRenameCommand extends ApifyCommand<typeof DatasetsRenameCom

const successMessage = (() => {
if (!name) {
return `The name of the Dataset with ID ${chalk.yellow(id)} has been set to: ${chalk.yellow(newName)}`;
return `The name of the dataset with ID ${chalk.yellow(id)} has been set to: ${chalk.yellow(newName)}`;
}

if (unname) {
return `The name of the Dataset with ID ${chalk.yellow(id)} has been removed (was ${chalk.yellow(name)} previously).`;
return `The name of the dataset with ID ${chalk.yellow(id)} has been removed (was ${chalk.yellow(name)} previously).`;
}

return `The name of the Dataset with ID ${chalk.yellow(id)} was changed from ${chalk.yellow(name)} to ${chalk.yellow(newName)}.`;
return `The name of the dataset with ID ${chalk.yellow(id)} was changed from ${chalk.yellow(name)} to ${chalk.yellow(newName)}.`;
})();

try {
Expand All @@ -78,7 +78,7 @@ export class DatasetsRenameCommand extends ApifyCommand<typeof DatasetsRenameCom
const casted = err as ApifyApiError;

error({
message: `Failed to rename Dataset with ID ${chalk.yellow(id)}\n ${casted.message || casted}`,
message: `Failed to rename dataset with ID ${chalk.yellow(id)}\n ${casted.message || casted}`,
});
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/commands/datasets/rm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import { error, info, success } from '../../lib/outputs.js';
import { getLoggedClientOrThrow } from '../../lib/utils.js';

export class DatasetsRmCommand extends ApifyCommand<typeof DatasetsRmCommand> {
static override description = 'Deletes a Dataset';
static override description = 'Permanently removes a dataset.';

static override args = {
datasetNameOrId: Args.string({
description: 'The Dataset ID or name to delete',
description: 'The dataset ID or name to delete',
required: true,
}),
};
Expand Down Expand Up @@ -53,7 +53,7 @@ export class DatasetsRmCommand extends ApifyCommand<typeof DatasetsRmCommand> {
const casted = err as ApifyApiError;

error({
message: `Failed to delete Dataset with ID ${chalk.yellow(id)}\n ${casted.message || casted}`,
message: `Failed to delete dataset with ID ${chalk.yellow(id)}\n ${casted.message || casted}`,
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/edit-input-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class EditInputSchemaCommand extends ApifyCommand<typeof EditInputSchemaC
// If path is not returned, it means the input schema must be directly embedded as object in actor.json
// TODO - allow editing input schema embedded in actor.json
throw new Error(
`Editing an input schema directly embedded in "${LOCAL_CONFIG_PATH}" is not yet supported.`,
`Editing an input schema directly embedded in '${LOCAL_CONFIG_PATH}' is not yet supported.`,
);
}

Expand Down
4 changes: 1 addition & 3 deletions src/commands/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import { ApifyCommand } from '../lib/apify_command.js';
import { getLocalUserInfo, getLoggedClientOrThrow } from '../lib/utils.js';

export class InfoCommand extends ApifyCommand<typeof InfoCommand> {
static override description =
'Displays information about the currently active Apify account.\n' +
'The information is printed to the console.';
static override description = 'Prints details about your currently authenticated Apify account.';

async run() {
await getLoggedClientOrThrow();
Expand Down
11 changes: 5 additions & 6 deletions src/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ import {

export class InitCommand extends ApifyCommand<typeof InitCommand> {
static override description =
'Initializes a new Actor project in an existing directory.\n' +
`If the directory contains a Scrapy project in Python, the command automatically creates wrappers so that you can run your scrapers without changes.\n\n` +
`The command creates the "${LOCAL_CONFIG_PATH}" file and the "${DEFAULT_LOCAL_STORAGE_DIR}" directory in the current directory, ` +
'but does not touch any other existing files or directories.\n\n' +
`WARNING: The directory at "${DEFAULT_LOCAL_STORAGE_DIR}" will be overwritten if it already exists.`;
`Sets up an Actor project in your current directory by creating actor.json and storage files.\n` +
`If the directory contains a Scrapy project in Python, the command automatically creates wrappers so that you can run your scrapers without changes.\n` +
`Creates the '${LOCAL_CONFIG_PATH}' file and the '${DEFAULT_LOCAL_STORAGE_DIR}' directory in the current directory, but does not touch any other existing files or directories.\n\n` +
`WARNING: Overwrites existing '${DEFAULT_LOCAL_STORAGE_DIR}' directory.`;

static override args = {
actorName: Args.string({
Expand Down Expand Up @@ -69,7 +68,7 @@ export class InitCommand extends ApifyCommand<typeof InitCommand> {

if (getLocalConfig(cwd)) {
warning({
message: `Skipping creation of "${LOCAL_CONFIG_PATH}", the file already exists in the current directory.`,
message: `Skipping creation of '${LOCAL_CONFIG_PATH}', the file already exists in the current directory.`,
});
} else {
if (!actorName) {
Expand Down
Loading
Loading