Skip to content

Commit

Permalink
refactor register setup commands
Browse files Browse the repository at this point in the history
  • Loading branch information
mattseddon committed Mar 9, 2023
1 parent 6cf65bc commit b027c46
Showing 1 changed file with 35 additions and 21 deletions.
56 changes: 35 additions & 21 deletions extension/src/setup/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,10 @@ import { Config } from '../config'
import { RegisteredCliCommands, RegisteredCommands } from '../commands/external'
import { getFirstWorkspaceFolder } from '../vscode/workspaceFolders'

export const registerSetupCommands = (
const registerRunSetupCommands = (
setup: Setup,
internalCommands: InternalCommands,
config: Config
) => {
internalCommands.registerExternalCliCommand(
RegisteredCliCommands.INIT,
async () => {
const root = getFirstWorkspaceFolder()
if (root) {
await internalCommands.executeCommand(AvailableCommands.INIT, root)
}
}
)

internalCommands: InternalCommands
): void => {
internalCommands.registerExternalCommand(
RegisteredCommands.EXTENSION_CHECK_CLI_COMPATIBLE,
() => run(setup)
Expand All @@ -32,14 +21,13 @@ export const registerSetupCommands = (
setup.setupWorkspace()
)
)
}

internalCommands.registerExternalCommand(
RegisteredCommands.SETUP_SHOW,
async () => {
await setup.showSetup()
}
)

const registerSetupConfigCommands = (
setup: Setup,
internalCommands: InternalCommands,
config: Config
): void => {
internalCommands.registerExternalCommand(
RegisteredCommands.SELECT_FOCUSED_PROJECTS,
async () => {
Expand All @@ -54,3 +42,29 @@ export const registerSetupCommands = (
}
)
}

export const registerSetupCommands = (
setup: Setup,
internalCommands: InternalCommands,
config: Config
): void => {
internalCommands.registerExternalCliCommand(
RegisteredCliCommands.INIT,
async () => {
const root = getFirstWorkspaceFolder()
if (root) {
await internalCommands.executeCommand(AvailableCommands.INIT, root)
}
}
)

internalCommands.registerExternalCommand(
RegisteredCommands.SETUP_SHOW,
async () => {
await setup.showSetup()
}
)

registerRunSetupCommands(setup, internalCommands)
registerSetupConfigCommands(setup, internalCommands, config)
}

0 comments on commit b027c46

Please sign in to comment.