Adds experimental support for Open in GitHub

This commit is contained in:
Eric Amodio
2017-03-24 01:28:05 -04:00
parent ba69a19eeb
commit 4f84c03275
21 changed files with 399 additions and 43 deletions

View File

@@ -4,4 +4,5 @@ export * from './branch';
export * from './commit';
export * from './log';
export * from './logCommit';
export * from './remote';
export * from './status';

27
src/git/models/remote.ts Normal file
View File

@@ -0,0 +1,27 @@
'use strict';
import { HostingProvider, HostingProviderFactory } from '../hosting/factory';
export type GitRemoteType = 'fetch' | 'push';
export class GitRemote {
name: string;
url: string;
type: GitRemoteType;
provider?: HostingProvider;
constructor(remote: string) {
remote = remote.trim();
const [name, info] = remote.split('\t');
this.name = name;
const [url, typeInfo] = info.split(' ');
this.url = url;
this.type = typeInfo.substring(1, typeInfo.length - 1) as GitRemoteType;
this.provider = HostingProviderFactory.getHostingProvider(this.url);
}
}