Skip to content
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
12 changes: 12 additions & 0 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,10 @@ The command will try to detect your editor in the following order:
Supported editors include VS Code, Cursor, Sublime Text, Atom, Vim, Emacs, and
many JetBrains IDEs.

You can also set a preferred editor via `epicshop config editor` (or
`epicshop config --editor <command>`). The `open` command will prompt you to
confirm the detected editor the first time and then reuse your preference.

### `config`

View or update workshop configuration settings.
Expand All @@ -324,6 +328,7 @@ epicshop config [options]
#### Options

- `--repos-dir <path>` - Set the default directory where workshops are cloned
- `--editor <command>` - Set the preferred editor command
- `--silent, -s` - Run without output logs (default: false)

#### Examples
Expand All @@ -334,12 +339,19 @@ epicshop config

# Set the repos directory
epicshop config --repos-dir ~/epicweb-workshops

# Choose a preferred editor
epicshop config editor

# Set preferred editor to VS Code
epicshop config --editor code
```

#### Configuration

- **Repos directory**: The default location where workshops are cloned. Defaults
to `~/epicweb-workshops` on most systems.
- **Preferred editor**: The editor command the CLI uses when opening workshops.

### `update` / `upgrade`

Expand Down
17 changes: 15 additions & 2 deletions packages/workshop-cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,12 +387,16 @@ const cli = yargs(args)
.positional('subcommand', {
describe: 'Config subcommand (reset)',
type: 'string',
choices: ['reset'],
choices: ['reset', 'editor'],
})
.option('repos-dir', {
type: 'string',
description: 'Set the default directory for workshop repos',
})
.option('editor', {
type: 'string',
description: 'Set the preferred editor command',
})
.option('silent', {
alias: 's',
type: 'boolean',
Expand All @@ -402,18 +406,27 @@ const cli = yargs(args)
.example('$0 config', 'View current configuration')
.example('$0 config reset', 'Delete config file and reset to defaults')
.example('$0 config --repos-dir ~/epicweb', 'Set the repos directory')
.example('$0 config editor', 'Choose a preferred editor')
.example('$0 config --editor code', 'Set preferred editor to VS Code')
},
async (
argv: ArgumentsCamelCase<{
subcommand?: string
reposDir?: string
editor?: string
silent?: boolean
}>,
) => {
const { config } = await import('./commands/workshops.js')
const result = await config({
subcommand: argv.subcommand === 'reset' ? 'reset' : undefined,
subcommand:
argv.subcommand === 'reset'
? 'reset'
: argv.subcommand === 'editor'
? 'editor'
: undefined,
reposDir: argv.reposDir,
preferredEditor: argv.editor,
silent: argv.silent,
})
if (!result.success) {
Expand Down
Loading
Loading