-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move cli usage in setup onto internal commands
- Loading branch information
1 parent
83d27bc
commit 51e849b
Showing
11 changed files
with
216 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { commands } from 'vscode' | ||
import { Setup } from '.' | ||
import { run } from './runner' | ||
import { pickFocusedProjects } from './quickPick' | ||
import { AvailableCommands, InternalCommands } from '../commands/internal' | ||
import { Config } from '../config' | ||
import { RegisteredCliCommands, RegisteredCommands } from '../commands/external' | ||
import { getFirstWorkspaceFolder } from '../vscode/workspaceFolders' | ||
|
||
export const registerSetupCommands = ( | ||
setup: Setup, | ||
internalCommands: InternalCommands, | ||
config: Config | ||
) => { | ||
internalCommands.registerExternalCliCommand( | ||
RegisteredCliCommands.INIT, | ||
async () => { | ||
const root = getFirstWorkspaceFolder() | ||
if (root) { | ||
await internalCommands.executeCommand(AvailableCommands.INIT, root) | ||
} | ||
} | ||
) | ||
|
||
internalCommands.registerExternalCommand( | ||
RegisteredCommands.EXTENSION_CHECK_CLI_COMPATIBLE, | ||
() => run(setup) | ||
) | ||
|
||
setup.dispose.track( | ||
commands.registerCommand(RegisteredCommands.EXTENSION_SETUP_WORKSPACE, () => | ||
setup.setupWorkspace() | ||
) | ||
) | ||
|
||
internalCommands.registerExternalCommand( | ||
RegisteredCommands.SETUP_SHOW, | ||
async () => { | ||
await setup.showSetup() | ||
} | ||
) | ||
|
||
internalCommands.registerExternalCommand( | ||
RegisteredCommands.SELECT_FOCUSED_PROJECTS, | ||
async () => { | ||
const dvcRoots = await setup.findWorkspaceDvcRoots() | ||
const focusedProjects = await pickFocusedProjects( | ||
dvcRoots, | ||
setup.getRoots() | ||
) | ||
if (focusedProjects) { | ||
config.setFocusedProjectsOption(focusedProjects) | ||
} | ||
} | ||
) | ||
} |
Oops, something went wrong.