import { Disposable , commands } from 'vscode' ; import { Model } from '../model' ; import { pickRemoteSource } from '../remoteSource' ; import { GitBaseExtensionImpl } from './extension' ; import { API , PickRemoteSourceOptions , PickRemoteSourceResult , RemoteSourceProvider } from './git-base' ; export class ApiImpl implements API { constructor ( private _model ) { } pickRemoteSource ( options ) { return pickRemoteSource ( this . _model , options as any ) ; } registerRemoteSourceProvider ( provider ) { return this . _model . registerRemoteSourceProvider ( provider ) ; } } export function registerAPICommands ( extension ) { const disposables = [ ] ; disposables . push ( commands . registerCommand ( 'git-base.api.getRemoteSources' , ( opts ? ) => { if ( ! extension . model ) { return ; } return pickRemoteSource ( extension . model , opts as any ) ; } ) ) ; return Disposable . from ( ... disposables ) ; }