Skip to content

🎥 Make videos programmatically with React

help in subcommand

Jonny Burgerff6e7d005aef
diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts
index ecb6ddd18c..c9e43833ca 100644
--- a/packages/cli/src/index.ts
+++ b/packages/cli/src/index.ts
@@ -140,7 +140,7 @@ export const cli = async () => {
args: additionalArgs,
});
} else if (command === 'skills') {
- await skillsCommand(args);
+ await skillsCommand(args, logLevel);
} else if (command === VERSIONS_COMMAND) {
await versionsCommand(remotionRoot, logLevel);
} else if (command === BROWSER_COMMAND) {
diff --git a/packages/cli/src/print-help.ts b/packages/cli/src/print-help.ts
index ace5dd2e23..219c27f156 100644
--- a/packages/cli/src/print-help.ts
+++ b/packages/cli/src/print-help.ts
@@ -147,18 +147,6 @@ export const printHelp = (logLevel: LogLevel) => {
chalk.gray('https://www.remotion.dev/docs/cli/add'),
);
- Log.info({indent: false, logLevel});
- Log.info(
- {indent: false, logLevel},
- chalk.blue('remotion skills add') +
- chalk.gray(' | ') +
- chalk.blue('update'),
- );
- Log.info(
- {indent: false, logLevel},
- 'Install or update skills from remotion-dev/skills.',
- );
-
Log.info({indent: false, logLevel});
Log.info(
{indent: false, logLevel},
diff --git a/packages/cli/src/skills.ts b/packages/cli/src/skills.ts
index d4e5c4d96b..f41c557fae 100644
--- a/packages/cli/src/skills.ts
+++ b/packages/cli/src/skills.ts
@@ -1,17 +1,48 @@
+import type {LogLevel} from '@remotion/renderer';
import {spawn} from 'node:child_process';
+import {chalk} from './chalk';
+import {Log} from './log';
-export const skillsCommand = async (args: string[]) => {
+export const printSkillsHelp = (logLevel: LogLevel) => {
+ Log.info({indent: false, logLevel}, chalk.blue('remotion skills'));
+ Log.info(
+ {indent: false, logLevel},
+ 'Install or update skills from remotion-dev/skills.',
+ );
+ Log.info({indent: false, logLevel});
+ Log.info({indent: false, logLevel}, 'Available subcommands:');
+ Log.info({indent: false, logLevel});
+ Log.info({indent: false, logLevel}, chalk.blue('remotion skills add'));
+ Log.info(
+ {indent: false, logLevel},
+ 'Install skills from remotion-dev/skills.',
+ );
+ Log.info({indent: false, logLevel});
+ Log.info({indent: false, logLevel}, chalk.blue('remotion skills update'));
+ Log.info(
+ {indent: false, logLevel},
+ 'Update skills from remotion-dev/skills.',
+ );
+};
+
+export const skillsCommand = async (args: string[], logLevel: LogLevel) => {
const subcommand = args[0]; // add | update
const restArgs = args.slice(1);
if (!subcommand || !['add', 'update'].includes(subcommand)) {
- throw new Error(
- `Unknown skills command: ${subcommand ?? 'none'}. Supported: add, update`,
- );
+ printSkillsHelp(logLevel);
+ return;
}
const command = process.platform === 'win32' ? 'npx.cmd' : 'npx';
- const fullArgs = ['skills', subcommand, 'remotion-dev/skills', ...restArgs];
+ const fullArgs = [
+ '-y',
+ '--loglevel=error',
+ 'skills',
+ subcommand,
+ 'remotion-dev/skills',
+ ...restArgs,
+ ];
const child = spawn(command, fullArgs, {
stdio: 'inherit',