Comparing version
@@ -44,2 +44,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
var commit_1 = require("./commit"); | ||
var push_1 = require("./push"); | ||
var MainPage = /** @class */ (function () { | ||
@@ -69,2 +70,8 @@ function MainPage(app, t) { | ||
} | ||
}, | ||
{ | ||
name: 'Push', | ||
"function": { | ||
base: 'git push' | ||
} | ||
} | ||
@@ -108,2 +115,8 @@ ]; | ||
.newLine(); | ||
if (this.app.gitInfo.remotes().length == 0) { | ||
this.t.interactor | ||
.write(this.t.interactor.color.red('No remote provided.')) | ||
.newLine() | ||
.newLine(); | ||
} | ||
return [4 /*yield*/, this.pickList.run()]; | ||
@@ -125,2 +138,5 @@ case 2: | ||
} | ||
case 3: { | ||
return [2 /*return*/, new push_1.PushPage(this.app, this.t)]; | ||
} | ||
} | ||
@@ -127,0 +143,0 @@ return [2 /*return*/, this]; |
@@ -0,1 +1,21 @@ | ||
var __read = (this && this.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spread = (this && this.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); | ||
return ar; | ||
}; | ||
exports.__esModule = true; | ||
@@ -10,6 +30,45 @@ var fs_1 = require("fs"); | ||
GitInfo.prototype.gitFolderPresent = function () { | ||
return fs_1.existsSync(this.currentDirectory() + "/.git"); | ||
return fs_1.existsSync(this.gitFolderPath()); | ||
}; | ||
GitInfo.prototype.gitFolderPath = function () { | ||
return this.currentDirectory() + "/.git"; | ||
}; | ||
GitInfo.prototype.gitFolderPathWithSlash = function () { | ||
return this.gitFolderPath() + '/'; | ||
}; | ||
GitInfo.prototype.branches = function () { | ||
try { | ||
return fs_1.readdirSync(this.gitFolderPathWithSlash() + 'refs/heads/', { withFileTypes: true }) | ||
.map(function (file) { return file.name; }); | ||
} | ||
catch (error) { | ||
return []; | ||
} | ||
}; | ||
GitInfo.prototype.branchesWithCurrentFirst = function () { | ||
var currentBranch = this.currentBranch() || ''; | ||
var branches = this.branches().filter(function (branch) { return branch != currentBranch; }); | ||
return __spread([currentBranch], branches); | ||
}; | ||
GitInfo.prototype.currentBranch = function () { | ||
try { | ||
var data = fs_1.readFileSync(this.gitFolderPathWithSlash() + 'HEAD', 'utf8'); | ||
return data.split('/').pop().trim(); | ||
} | ||
catch (error) { | ||
return null; // no found | ||
} | ||
}; | ||
GitInfo.prototype.remotes = function () { | ||
try { | ||
return fs_1.readdirSync(this.gitFolderPathWithSlash() + 'refs/remotes/', { withFileTypes: true }) | ||
.filter(function (file) { return file.isDirectory(); }) | ||
.map(function (dir) { return dir.name; }); | ||
} | ||
catch (error) { | ||
return []; | ||
} | ||
}; | ||
return GitInfo; | ||
}()); | ||
exports.GitInfo = GitInfo; |
@@ -56,3 +56,2 @@ #!/usr/bin/env node | ||
.clear() | ||
.write(t.interactor.color.yellow('Goodbye...')) | ||
.showCaret(); | ||
@@ -59,0 +58,0 @@ return [2 /*return*/]; |
{ | ||
"name": "agita", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"main": "bin/index.js", | ||
@@ -5,0 +5,0 @@ "author": "Joel Huggett", |
94043
11.77%29
3.57%2053
11.88%