Skip to content
Open
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
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Commands:
dev [options] Enables developer mode.
validate [options] [path] Validates the Stream Deck plugin.
pack|bundle [options] [path] Creates a .streamDeckPlugin file from the plugin.
add-action [options] Adds a new action to an existing Stream Deck plugin.
config Manage the local configuration.
help [command] display help for command

Expand All @@ -51,6 +52,37 @@ The `streamdeck create` command enables you to scaffold a new Stream Deck plugin
<img src="./assets/cli-create.gif">
</p>


## Adding actions to a plugin

The `streamdeck add-action` command allows you to quickly add new actions to an existing Stream Deck plugin. The command can be used both interactively (with prompts) or with command-line parameters for automation.

### Interactive mode

Running the command without parameters will start an interactive prompt:

```bash
streamdeck add-action
```

This will ask you for:
- Action name (display name)
- Action identifier (unique ID within the plugin)
- Action description
- Whether to create a property inspector UI

### Command-line mode

You can also provide all parameters directly via command-line options:

```bash
streamdeck add-action --name "My Action" --action-id "my-action" --description "Does something awesome" (--ui|--no-ui) [--yes]
```

Notes:
- The `--yes` option can be used to skip confirmation prompts, allowing for quick creation of actions without manual intervention.
- The `--ui` option specifies whether to create a property inspector UI for the action. The `--no-ui` option can be used to skip creating a UI file.

## Further Reading

- Learn more about [Stream Deck CLI commands](https://docs.elgato.com/streamdeck/cli).
Expand Down
13 changes: 12 additions & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { program } from "commander";

import { config, create, link, pack, restart, setDeveloperMode, stop, validate } from "./commands";
import { addAction, config, create, link, pack, restart, setDeveloperMode, stop, validate } from "./commands";
import { packageManager } from "./package-manager";

program.version(packageManager.getVersion({ checkEnvironment: true }), "-v", "display CLI version");
Expand Down Expand Up @@ -57,6 +57,17 @@ program
.option("--no-update-check", "Disables updating schemas", true)
.action((path, opts) => pack({ ...opts, path }));

program
.command("add-action")
.description("Adds a new action to an existing Stream Deck plugin.")
.option("-n, --name <name>", "Name of the action")
.option("-i, --action-id <actionId>", "Action identifier (appended to plugin UUID)")
.option("-d, --description <description>", "Description of the action")
.option("--ui", "Create property inspector UI", true)
.option("--no-ui", "Skip creating property inspector UI")
.option("-y, --yes", "Skip confirmation prompt", false)
.action((opts) => addAction(opts));

const configCommand = program.command("config").description("Manage the local configuration.");

configCommand
Expand Down
Loading