Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

agita

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

agita - npm Package Compare versions

Comparing version 1.2.4 to 1.2.5

.github/workflows/npm-publish.yml

2

bin/App/app.js

@@ -37,3 +37,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.App = void 0;

@@ -40,0 +40,0 @@ var git_command_1 = require("./git-command");

@@ -37,3 +37,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.GitCommand = void 0;

@@ -97,3 +97,3 @@ var child_process_1 = require("child_process");

return [2 /*return*/, new Promise(function (resolve, reject) {
child_process_1.exec(_this.command(), function (error, stdout, stderr) {
(0, child_process_1.exec)(_this.command(), function (error, stdout, stderr) {
if (error)

@@ -100,0 +100,0 @@ console.warn(error);

@@ -37,3 +37,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AddMainPage = void 0;

@@ -43,3 +43,3 @@ var __1 = require("..");

var request_confirmation_1 = require("../../../Terminal/User Interactions/request-confirmation");
var selective_1 = require("./selective");
var selective_1 = require("../add/selective");
var AddMainPage = /** @class */ (function () {

@@ -53,21 +53,22 @@ function AddMainPage(app, t) {

{
name: 'Add all',
"function": {
base: 'git add .'
}
name: "Add all",
function: {
base: "git add .",
},
},
{
name: 'Add selectively',
"function": {
base: 'git add'
}
}
name: "Add selectively",
function: {
base: "git add",
},
},
];
this.pickList = new select_list_1.SelectList(this.t, {
text: 'Add:',
text: "Add:",
options: this.options.map(function (item) { return item.name; }),
back: 'Cancel',
back: "Cancel",
onChange: function (response) {
__1.showGitCommandForSelectList(response, _this.options, _this.t, _this.app);
}
response &&
(0, __1.showGitCommandForSelectList)(response, _this.options, _this.t, _this.app);
},
});

@@ -87,4 +88,3 @@ }

case 0:
this.t.interactor
.clear();
this.t.interactor.clear();
return [4 /*yield*/, this.pickList.run()];

@@ -107,3 +107,5 @@ case 1:

this.t.interactor.clear();
return [4 /*yield*/, (new request_confirmation_1.RequestConfirmation(this.t, { question: 'Are you sure you want to add everything?' }).run())];
return [4 /*yield*/, new request_confirmation_1.RequestConfirmation(this.t, {
question: "Are you sure you want to add everything?",
}).run()];
case 4:

@@ -110,0 +112,0 @@ if (!(_b.sent()).confirmed) return [3 /*break*/, 6];

@@ -64,3 +64,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SelectiveAddPage = void 0;

@@ -74,5 +74,5 @@ var select_tree_1 = require("../../../Terminal/User Interactions/select-tree");

this.tree = {
name: 'All',
name: "All",
open: true,
selected: false
selected: false,
};

@@ -98,3 +98,3 @@ }

try {
if (inBranches_1_1 && !inBranches_1_1.done && (_a = inBranches_1["return"])) _a.call(inBranches_1);
if (inBranches_1_1 && !inBranches_1_1.done && (_a = inBranches_1.return)) _a.call(inBranches_1);
}

@@ -111,3 +111,4 @@ finally { if (e_1) throw e_1.error; }

var part = pathToBranch_1_1.value;
if (part == branch.name) { // hit final part, i.e. branch
if (part == branch.name) {
// hit final part, i.e. branch
if (!currentBranch.sub)

@@ -126,3 +127,3 @@ currentBranch.sub = [];

selected: false,
upperBranch: currentBranch
upperBranch: currentBranch,
});

@@ -139,3 +140,3 @@ currentBranch = this.findBranchByName(part, currentBranch.sub);

try {
if (pathToBranch_1_1 && !pathToBranch_1_1.done && (_a = pathToBranch_1["return"])) _a.call(pathToBranch_1);
if (pathToBranch_1_1 && !pathToBranch_1_1.done && (_a = pathToBranch_1.return)) _a.call(pathToBranch_1);
}

@@ -148,7 +149,7 @@ finally { if (e_2) throw e_2.error; }

var path = [];
while (currentBranch && currentBranch.name != 'All') {
while (currentBranch && currentBranch.name != "All") {
path.push(currentBranch.name);
currentBranch = currentBranch.upperBranch;
}
return path.reverse().join('/');
return path.reverse().join("/");
};

@@ -167,3 +168,5 @@ SelectiveAddPage.prototype.run = function () {

_e.sent();
return [4 /*yield*/, this.app.gitCommand.push({ base: 'git status -s' }).execute()];
return [4 /*yield*/, this.app.gitCommand
.push({ base: "git status -s" })
.execute()];
case 2:

@@ -175,8 +178,18 @@ statusResponse = _e.sent();

filePath = files_1_1.value;
if (filePath == '')
if (filePath == "")
continue;
_a = __read(filePath, 2), staged = _a[0], notStaged = _a[1];
path = filePath.slice(3).split('/').map(function (part) { return part.trim(); }).map(function (piece) { return piece.split('').filter(function (char) { return char != '"'; }).join(''); });
path = filePath
.slice(3)
.split("/")
.map(function (part) { return part.trim(); })
.map(function (piece) {
return piece
.split("")
.filter(function (char) { return char != '"'; })
.join("");
});
selected = false;
if (staged != ' ' && staged != '?') { // already added
if (staged != " " && staged != "?") {
// already added
selected = true;

@@ -187,3 +200,3 @@ }

open: false,
selected: selected
selected: selected,
}, path);

@@ -195,3 +208,3 @@ }

try {
if (files_1_1 && !files_1_1.done && (_b = files_1["return"])) _b.call(files_1);
if (files_1_1 && !files_1_1.done && (_b = files_1.return)) _b.call(files_1);
}

@@ -203,10 +216,13 @@ finally { if (e_5) throw e_5.error; }

_e.sent();
this.t.interactor
.clear();
return [4 /*yield*/, (new select_tree_1.SelectTree(this.t, { tree: this.tree })).run()];
this.t.interactor.clear();
return [4 /*yield*/, new select_tree_1.SelectTree(this.t, { tree: this.tree }).run()];
case 4:
response = _e.sent();
this.t.interactor.clear();
pathsToAdd = response.selectedItems.map(function (item) { return _this.getPathForBranch(item); });
pathsToReset = response.unselectedItems.map(function (item) { return _this.getPathForBranch(item); });
pathsToAdd = response.selectedItems.map(function (item) {
return _this.getPathForBranch(item);
});
pathsToReset = response.unselectedItems.map(function (item) {
return _this.getPathForBranch(item);
});
_e.label = 5;

@@ -220,4 +236,5 @@ case 5:

path = pathsToAdd_1_1.value;
return [4 /*yield*/, this.app.gitCommand.clear()
.push({ base: "git add \"" + path + "\"" })
return [4 /*yield*/, this.app.gitCommand
.clear()
.push({ base: "git add \"".concat(path, "\"") })
.execute()];

@@ -237,3 +254,3 @@ case 7:

try {
if (pathsToAdd_1_1 && !pathsToAdd_1_1.done && (_c = pathsToAdd_1["return"])) _c.call(pathsToAdd_1);
if (pathsToAdd_1_1 && !pathsToAdd_1_1.done && (_c = pathsToAdd_1.return)) _c.call(pathsToAdd_1);
}

@@ -249,4 +266,5 @@ finally { if (e_3) throw e_3.error; }

path = pathsToReset_1_1.value;
return [4 /*yield*/, this.app.gitCommand.clear()
.push({ base: "git reset \"" + path + "\"" })
return [4 /*yield*/, this.app.gitCommand
.clear()
.push({ base: "git reset \"".concat(path, "\"") })
.execute()];

@@ -266,3 +284,3 @@ case 14:

try {
if (pathsToReset_1_1 && !pathsToReset_1_1.done && (_d = pathsToReset_1["return"])) _d.call(pathsToReset_1);
if (pathsToReset_1_1 && !pathsToReset_1_1.done && (_d = pathsToReset_1.return)) _d.call(pathsToReset_1);
}

@@ -269,0 +287,0 @@ finally { if (e_4) throw e_4.error; }

@@ -37,3 +37,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CommitPrefixPage = void 0;

@@ -52,72 +52,72 @@ var select_list_1 = require("../../../Terminal/User Interactions/select-list");

name: "feature",
"function": {
base: "git commit -m \"feat: "
}
function: {
base: 'git commit -m "feat: ',
},
},
{
name: "bug fix",
"function": {
base: "git commit -m \"fix: "
}
function: {
base: 'git commit -m "fix: ',
},
},
{
name: "documentation",
"function": {
base: "git commit -m \"docs: "
}
function: {
base: 'git commit -m "docs: ',
},
},
{
name: "style",
"function": {
base: "git commit -m \"style: "
}
function: {
base: 'git commit -m "style: ',
},
},
{
name: "refactoring",
"function": {
base: "git commit -m \"refactor: "
}
function: {
base: 'git commit -m "refactor: ',
},
},
{
name: "performance improvement",
"function": {
base: "git commit -m \"perf: "
}
function: {
base: 'git commit -m "perf: ',
},
},
{
name: "tests",
"function": {
base: "git commit -m \"test: "
}
function: {
base: 'git commit -m "test: ',
},
},
{
name: "builds",
"function": {
base: "git commit -m \"build: "
}
function: {
base: 'git commit -m "build: ',
},
},
{
name: "continuous integrations",
"function": {
base: "git commit -m \"ci: "
}
function: {
base: 'git commit -m "ci: ',
},
},
{
name: "chore",
"function": {
base: "git commit -m \"chore: "
}
function: {
base: 'git commit -m "chore: ',
},
},
{
name: "revert",
"function": {
base: "git commit -m \"revert: "
}
function: {
base: 'git commit -m "revert: ',
},
},
{
name: "none",
"function": {
base: "git commit -m \""
}
}
function: {
base: 'git commit -m "',
},
},
];

@@ -129,4 +129,5 @@ this.pickList = new select_list_1.SelectList(this.t, {

onChange: function (response) {
__1.showGitCommandForSelectList(response, _this.options, _this.t, _this.app);
}
response &&
(0, __1.showGitCommandForSelectList)(response, _this.options, _this.t, _this.app);
},
});

@@ -153,3 +154,3 @@ }

}
this.app.gitCommand.push(this.options[response.index]["function"]);
this.app.gitCommand.push(this.options[response.index].function);
return [2 /*return*/, new commit_1.CommitPage(this.app, this.t)];

@@ -156,0 +157,0 @@ }

@@ -37,3 +37,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CommitPage = void 0;

@@ -75,3 +75,3 @@ var press_enter_to_continue_1 = require("../../../Terminal/User Interactions/press-enter-to-continue");

this.app.gitCommand.push({
addition: response.input + "\""
addition: "".concat(response.input, "\"")
});

@@ -78,0 +78,0 @@ return [4 /*yield*/, this.app.gitCommand.execute()];

@@ -1,2 +0,2 @@

exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.showGitCommandForSelectList = void 0;

@@ -6,3 +6,3 @@ function showGitCommandForSelectList(response, options, t, app) {

if (options[response.index]) {
app.gitCommand.push(option["function"]);
app.gitCommand.push(option.function);
}

@@ -9,0 +9,0 @@ if (option) {

@@ -37,3 +37,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.MainPage = void 0;

@@ -43,3 +43,2 @@ var _1 = require(".");

var status_1 = require("./status");
var Add_1 = require("./Add");
var No_Git_Folder_1 = require("./No Git Folder");

@@ -51,2 +50,3 @@ var push_1 = require("./push");

var commit_prefix_1 = require("./commit/commit-prefix");
var Add_1 = require("./Add");
var MainPage = /** @class */ (function () {

@@ -60,51 +60,52 @@ function MainPage(app, t) {

{
name: 'Status',
"function": {
base: 'git status'
}
name: "Status",
function: {
base: "git status",
},
},
{
name: 'Add',
"function": {
base: 'git add'
}
name: "Add",
function: {
base: "git add",
},
},
{
name: 'Commit',
"function": {
base: 'git commit -m'
}
name: "Commit",
function: {
base: "git commit -m",
},
},
{
name: 'Push',
"function": {
base: 'git push'
}
name: "Push",
function: {
base: "git push",
},
},
{
name: 'Pull',
"function": {
base: 'git pull'
}
name: "Pull",
function: {
base: "git pull",
},
},
{
name: 'New branch',
"function": {
base: 'git checkout -b'
}
name: "New branch",
function: {
base: "git checkout -b",
},
},
{
name: 'Switch branches',
"function": {
base: 'git checkout'
}
}
name: "Switch branches",
function: {
base: "git checkout",
},
},
];
this.pickList = new select_list_1.SelectList(this.t, {
text: 'Main:',
text: "Main:",
options: this.options.map(function (item) { return item.name; }),
back: 'Quit',
back: "Quit",
onChange: function (response) {
_1.showGitCommandForSelectList(response, _this.options, _this.t, _this.app);
}
response &&
(0, _1.showGitCommandForSelectList)(response, _this.options, _this.t, _this.app);
},
});

@@ -133,10 +134,10 @@ }

.clear()
.write('Welcome to ' +
this.t.interactor.color.blue(this.t.interactor.decorate.bold('AGITA')))
.write("Welcome to " +
this.t.interactor.color.blue(this.t.interactor.decorate.bold("AGITA")))
.newLine()
.newLine()
.write(this.t.interactor.color.yellow('Repository: '))
.write(this.app.gitInfo.gitFolderPath().split('/').splice(-2)[0])
.write(this.t.interactor.color.yellow("Repository: "))
.write(this.app.gitInfo.gitFolderPath().split("/").splice(-2)[0])
.newLine()
.write(this.t.interactor.color.yellow('Current branch: '))
.write(this.t.interactor.color.yellow("Current branch: "))
.write(this.app.gitInfo.currentBranch())

@@ -147,3 +148,3 @@ .newLine()

this.t.interactor
.write(this.t.interactor.color.red('No remote provided.'))
.write(this.t.interactor.color.red("No remote provided."))
.newLine()

@@ -150,0 +151,0 @@ .newLine();

@@ -37,3 +37,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.NewBranchPage = void 0;

@@ -75,3 +75,3 @@ var press_enter_to_continue_1 = require("../../Terminal/User Interactions/press-enter-to-continue");

this.app.gitCommand.push({
addition: " " + response.input
addition: " ".concat(response.input)
});

@@ -78,0 +78,0 @@ return [4 /*yield*/, this.app.gitCommand.execute()];

@@ -37,3 +37,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.NoGitFolderPage = void 0;

@@ -50,15 +50,16 @@ var __1 = require("..");

{
name: 'Initialize new repository',
"function": {
base: 'git init'
}
}
name: "Initialize new repository",
function: {
base: "git init",
},
},
];
this.pickList = new select_list_1.SelectList(this.t, {
text: 'Getting started:',
text: "Getting started:",
options: this.options.map(function (item) { return item.name; }),
back: 'Quit',
back: "Quit",
onChange: function (response) {
__1.showGitCommandForSelectList(response, _this.options, _this.t, _this.app);
}
response &&
(0, __1.showGitCommandForSelectList)(response, _this.options, _this.t, _this.app);
},
});

@@ -80,6 +81,7 @@ }

.clear()
.write('Welcome to ' + this.t.interactor.color.blue(this.t.interactor.decorate.bold('AGITA')))
.write("Welcome to " +
this.t.interactor.color.blue(this.t.interactor.decorate.bold("AGITA")))
.newLine()
.newLine()
.write(this.t.interactor.color.red(this.t.interactor.decorate.bold('No .git folder present!')))
.write(this.t.interactor.color.red(this.t.interactor.decorate.bold("No .git folder present!")))
.newLine()

@@ -86,0 +88,0 @@ .newLine();

@@ -53,7 +53,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
var __spread = (this && this.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PullPage = void 0;

@@ -71,14 +76,12 @@ var _1 = require(".");

this.remotePickList = new select_list_1.SelectList(this.t, {
text: 'Pick remote:',
text: "Pick remote:",
options: [],
back: 'Cancel',
onChange: function (response) {
}
back: "Cancel",
onChange: function (response) { },
});
this.branchPickList = new select_list_1.SelectList(this.t, {
text: 'Pick branch:',
text: "Pick branch:",
options: [],
back: 'Back',
onChange: function (response) {
}
back: "Back",
onChange: function (response) { },
});

@@ -95,5 +98,8 @@ }

forOptions = newOptions;
pickList.config.options = __spread(newOptions.map(function (option) { return option.name; }), [pickList.config.back]);
pickList.config.options = __spreadArray(__spreadArray([], __read(newOptions.map(function (option) { return option.name; })), false), [
pickList.config.back,
], false);
pickList.config.onChange = function (response) {
_1.showGitCommandForSelectList(response, forOptions, _this.t, _this.app);
response &&
(0, _1.showGitCommandForSelectList)(response, forOptions, _this.t, _this.app);
};

@@ -112,3 +118,6 @@ };

}
this.setOptions(remotes.map(function (remote) { return ({ name: remote, "function": { base: "git pull " + remote } }); }), this.remoteOptions, this.remotePickList);
this.setOptions(remotes.map(function (remote) { return ({
name: remote,
function: { base: "git pull ".concat(remote) },
}); }), this.remoteOptions, this.remotePickList);
this.t.interactor.clear();

@@ -122,3 +131,8 @@ return [4 /*yield*/, this.remotePickList.run()];

branches = this.app.gitInfo.branchesWithCurrentFirst();
this.setOptions(branches.map(function (branch) { return ({ name: branch, "function": { base: "git pull " + remoteResponse.selectedItem + " " + branch } }); }), this.branchOptions, this.branchPickList);
this.setOptions(branches.map(function (branch) { return ({
name: branch,
function: {
base: "git pull ".concat(remoteResponse.selectedItem, " ").concat(branch),
},
}); }), this.branchOptions, this.branchPickList);
this.t.interactor.clear();

@@ -136,6 +150,4 @@ return [4 /*yield*/, this.branchPickList.run()];

this.t.interactor.clear();
this.t.interactor
.write(commandData.stdout)
.write(commandData.stderr);
return [4 /*yield*/, (new press_enter_to_continue_1.PressEnterToContinue(this.t)).run()];
this.t.interactor.write(commandData.stdout).write(commandData.stderr);
return [4 /*yield*/, new press_enter_to_continue_1.PressEnterToContinue(this.t).run()];
case 5:

@@ -142,0 +154,0 @@ _a.sent();

@@ -53,7 +53,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
var __spread = (this && this.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PushPage = void 0;

@@ -71,14 +76,12 @@ var _1 = require(".");

this.remotePickList = new select_list_1.SelectList(this.t, {
text: 'Pick remote:',
text: "Pick remote:",
options: [],
back: 'Cancel',
onChange: function (response) {
}
back: "Cancel",
onChange: function (response) { },
});
this.branchPickList = new select_list_1.SelectList(this.t, {
text: 'Pick branch:',
text: "Pick branch:",
options: [],
back: 'Back',
onChange: function (response) {
}
back: "Back",
onChange: function (response) { },
});

@@ -95,5 +98,8 @@ }

forOptions = newOptions;
pickList.config.options = __spread(newOptions.map(function (option) { return option.name; }), [pickList.config.back]);
pickList.config.options = __spreadArray(__spreadArray([], __read(newOptions.map(function (option) { return option.name; })), false), [
pickList.config.back,
], false);
pickList.config.onChange = function (response) {
_1.showGitCommandForSelectList(response, forOptions, _this.t, _this.app);
response &&
(0, _1.showGitCommandForSelectList)(response, forOptions, _this.t, _this.app);
};

@@ -112,3 +118,6 @@ };

}
this.setOptions(remotes.map(function (remote) { return ({ name: remote, "function": { base: "git push " + remote } }); }), this.remoteOptions, this.remotePickList);
this.setOptions(remotes.map(function (remote) { return ({
name: remote,
function: { base: "git push ".concat(remote) },
}); }), this.remoteOptions, this.remotePickList);
this.t.interactor.clear();

@@ -122,3 +131,8 @@ return [4 /*yield*/, this.remotePickList.run()];

branches = this.app.gitInfo.branchesWithCurrentFirst();
this.setOptions(branches.map(function (branch) { return ({ name: branch, "function": { base: "git push " + remoteResponse.selectedItem + " " + branch } }); }), this.branchOptions, this.branchPickList);
this.setOptions(branches.map(function (branch) { return ({
name: branch,
function: {
base: "git push ".concat(remoteResponse.selectedItem, " ").concat(branch),
},
}); }), this.branchOptions, this.branchPickList);
this.t.interactor.clear();

@@ -136,6 +150,4 @@ return [4 /*yield*/, this.branchPickList.run()];

this.t.interactor.clear();
this.t.interactor
.write(commandData.stdout)
.write(commandData.stderr);
return [4 /*yield*/, (new press_enter_to_continue_1.PressEnterToContinue(this.t)).run()];
this.t.interactor.write(commandData.stdout).write(commandData.stderr);
return [4 /*yield*/, new press_enter_to_continue_1.PressEnterToContinue(this.t).run()];
case 5:

@@ -142,0 +154,0 @@ _a.sent();

@@ -37,3 +37,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.StatusPage = void 0;

@@ -40,0 +40,0 @@ var press_enter_to_continue_1 = require("../../Terminal/User Interactions/press-enter-to-continue");

@@ -53,7 +53,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
var __spread = (this && this.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SwitchBranchPage = void 0;

@@ -70,7 +75,6 @@ var _1 = require(".");

this.branchPickList = new select_list_1.SelectList(this.t, {
text: 'Pick branch:',
text: "Pick branch:",
options: [],
back: 'Cancel',
onChange: function (response) {
}
back: "Cancel",
onChange: function (response) { },
});

@@ -87,5 +91,8 @@ }

forOptions = newOptions;
pickList.config.options = __spread(newOptions.map(function (option) { return option.name; }), [pickList.config.back]);
pickList.config.options = __spreadArray(__spreadArray([], __read(newOptions.map(function (option) { return option.name; })), false), [
pickList.config.back,
], false);
pickList.config.onChange = function (response) {
_1.showGitCommandForSelectList(response, forOptions, _this.t, _this.app);
response &&
(0, _1.showGitCommandForSelectList)(response, forOptions, _this.t, _this.app);
};

@@ -101,4 +108,7 @@ };

branches = this.app.gitInfo.branchesWithCurrentFirst();
branches[0] = branches[0] + ' (current)';
this.setOptions(branches.map(function (branch) { return ({ name: branch, "function": { base: "git checkout " + branch } }); }), this.branchOptions, this.branchPickList);
branches[0] = branches[0] + " (current)";
this.setOptions(branches.map(function (branch) { return ({
name: branch,
function: { base: "git checkout ".concat(branch) },
}); }), this.branchOptions, this.branchPickList);
return [4 /*yield*/, this.branchPickList.run()];

@@ -115,6 +125,4 @@ case 1:

if (!response.stderr) return [3 /*break*/, 4];
this.t.interactor
.clear()
.write(response.stderr);
return [4 /*yield*/, (new press_enter_to_continue_1.PressEnterToContinue(this.t)).run()];
this.t.interactor.clear().write(response.stderr);
return [4 /*yield*/, new press_enter_to_continue_1.PressEnterToContinue(this.t).run()];
case 3:

@@ -121,0 +129,0 @@ _a.sent();

@@ -17,5 +17,10 @@ var __read = (this && this.__read) || function (o, n) {

};
var __spread = (this && this.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};

@@ -33,3 +38,3 @@ var __values = (this && this.__values) || function(o) {

};
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.GitInfo = void 0;

@@ -40,4 +45,4 @@ var fs_1 = require("fs");

var recuseFileSystem = function (currentPath) {
var resolvedPath = path.join.apply(path, __spread(currentPath));
var info = fs_1.statSync(resolvedPath);
var resolvedPath = path.join.apply(path, __spreadArray([], __read(currentPath), false));
var info = (0, fs_1.statSync)(resolvedPath);
var name = currentPath[currentPath.length - 1];

@@ -47,3 +52,3 @@ if (info.isDirectory()) {

name: name,
children: fs_1.readdirSync(resolvedPath).map(function (node) { return recuseFileSystem(__spread(currentPath, [node])); })
children: (0, fs_1.readdirSync)(resolvedPath).map(function (node) { return recuseFileSystem(__spreadArray(__spreadArray([], __read(currentPath), false), [node], false)); })
};

@@ -68,3 +73,3 @@ }

var testPath = path.join(current.dir, current.base, ".git");
if (fs_1.existsSync(testPath)) {
if ((0, fs_1.existsSync)(testPath)) {
this.pathToGitFolder = testPath;

@@ -91,3 +96,3 @@ return testPath;

var child = _c.value;
branches = __spread(branches, getBranches_1(child, __spread(prefixes, [child.name])));
branches = __spreadArray(__spreadArray([], __read(branches), false), __read(getBranches_1(child, __spreadArray(__spreadArray([], __read(prefixes), false), [child.name], false))), false);
}

@@ -98,3 +103,3 @@ }

try {
if (_c && !_c.done && (_a = _b["return"])) _a.call(_b);
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}

@@ -115,3 +120,3 @@ finally { if (e_1) throw e_1.error; }

var branches = this.branches().filter(function (branch) { return branch != currentBranch; });
return __spread([currentBranch], branches);
return __spreadArray([currentBranch], __read(branches), false);
};

@@ -121,3 +126,3 @@ GitInfo.prototype.currentBranch = function () {

var fullPath = path.join(this.gitFolderPath(), "HEAD");
var data = fs_1.readFileSync(fullPath, 'utf8');
var data = (0, fs_1.readFileSync)(fullPath, 'utf8');
return data.split('refs/heads/').pop().trim();

@@ -132,3 +137,3 @@ }

var fullPath = path.join(this.gitFolderPath(), "refs", "remotes");
return fs_1.readdirSync(fullPath);
return (0, fs_1.readdirSync)(fullPath);
}

@@ -135,0 +140,0 @@ catch (error) {

@@ -39,3 +39,3 @@ #!/usr/bin/env node

var _this = this;
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
var Terminal_1 = require("./Terminal");

@@ -42,0 +42,0 @@ var app_1 = require("./App/app");

@@ -1,2 +0,2 @@

exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
var Color = /** @class */ (function () {

@@ -36,2 +36,2 @@ function Color() {

}());
exports["default"] = Color;
exports.default = Color;

@@ -1,2 +0,2 @@

exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
var CursorMovement = /** @class */ (function () {

@@ -8,15 +8,15 @@ function CursorMovement(t) {

var count = givenCount ? givenCount : 1;
_this.t.interactor.write("\u001B[" + count.toString() + "A");
_this.t.interactor.write("\u001B[".concat(count.toString(), "A"));
};
this.left = function (givenCount) {
var count = givenCount ? givenCount : 1;
_this.t.interactor.write("\u001B[" + count.toString() + "D");
_this.t.interactor.write("\u001B[".concat(count.toString(), "D"));
};
this.right = function (givenCount) {
var count = givenCount ? givenCount : 1;
_this.t.interactor.write("\u001B[" + count.toString() + "C");
_this.t.interactor.write("\u001B[".concat(count.toString(), "C"));
};
this.down = function (givenCount) {
var count = givenCount ? givenCount : 1;
_this.t.interactor.write("\u001B[" + count.toString() + "B");
_this.t.interactor.write("\u001B[".concat(count.toString(), "B"));
};

@@ -38,3 +38,3 @@ this.moveBy = function (x, y) {

this.moveTo = function (x, y) {
_this.t.interactor.write("\u001B[" + y + ";" + x + "H");
_this.t.interactor.write("\u001B[".concat(y, ";").concat(x, "H"));
};

@@ -44,2 +44,2 @@ }

}());
exports["default"] = CursorMovement;
exports.default = CursorMovement;

@@ -1,2 +0,2 @@

exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
var Decorate = /** @class */ (function () {

@@ -23,2 +23,2 @@ function Decorate() {

}());
exports["default"] = Decorate;
exports.default = Decorate;

@@ -1,2 +0,2 @@

exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Terminal = void 0;

@@ -3,0 +3,0 @@ var terminal_interactions_1 = require("./terminal-interactions");

@@ -37,3 +37,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Interactions = void 0;

@@ -47,5 +47,5 @@ var color_1 = require("./color");

this.t = t;
this.color = new color_1["default"]();
this.decorate = new decoration_1["default"]();
this.moveCursor = new cursor_move_1["default"](this.t);
this.color = new color_1.default();
this.decorate = new decoration_1.default();
this.moveCursor = new cursor_move_1.default(this.t);
this.reactToKeyPress = function (callback) { return __awaiter(_this, void 0, void 0, function () {

@@ -74,6 +74,6 @@ var _this = this;

_this.write("\n");
_this["return"]();
_this.return();
return _this;
};
this["return"] = function () {
this.return = function () {
_this.write("\r");

@@ -80,0 +80,0 @@ return _this;

@@ -1,1 +0,1 @@

exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });

@@ -53,3 +53,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Input = void 0;

@@ -56,0 +56,0 @@ var Input = /** @class */ (function () {

@@ -37,3 +37,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PressEnterToContinue = void 0;

@@ -40,0 +40,0 @@ var PressEnterToContinue = /** @class */ (function () {

@@ -37,3 +37,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RequestConfirmation = void 0;

@@ -40,0 +40,0 @@ var RequestConfirmation = /** @class */ (function () {

@@ -37,3 +37,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
exports.__esModule = true;
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SelectList = void 0;

@@ -46,3 +57,5 @@ var SelectList = /** @class */ (function () {

3: {
action: function () { process.exit(); }
action: function () {
process.exit();
},
},

@@ -52,35 +65,68 @@ 27: {

65: {
// up
action: function () {
_this.selected = _this.selected - 1 < 0 ? _this.config.options.length - 1 : _this.selected - 1;
_this.selected =
_this.selected - 1 < 0
? _this.options.length - 1
: _this.selected - 1;
return false;
}
},
},
66: {
// down
action: function () {
_this.selected = _this.selected + 1 > _this.config.options.length - 1 ? 0 : _this.selected + 1;
_this.selected =
_this.selected + 1 > _this.options.length - 1
? 0
: _this.selected + 1;
return false;
}
},
},
67: {
// right
action: function () {
return true;
}
},
},
68: {
// left
action: function () {
if (_this.config.back) {
_this.selected = _this.config.options.length - 1;
_this.selected = -1;
return true;
}
}
}
}
},
},
},
},
13: {
// enter
action: function () {
return true;
}
}
},
},
127: {
// delete
action: function () {
_this.removeFromSearch();
return false;
},
},
8: {
// backspace, windows doesn't recognize 127 it seems ¯\_(ツ)_/¯
action: function () {
_this.removeFromSearch();
return false;
},
},
32: {
// space
action: function () {
_this.addToSearch(" ");
return false;
},
},
};
this.selected = 0;
this.search = "";
this.config = config;

@@ -90,2 +136,36 @@ if (this.config.back)

}
Object.defineProperty(SelectList.prototype, "options", {
get: function () {
var _this = this;
return this.config.options
.map(function (option, index) { return ({
option: option,
index: index,
}); })
.filter(function (_a) {
var option = _a.option;
return option.toLowerCase().startsWith(_this.search.toLowerCase());
});
},
enumerable: false,
configurable: true
});
Object.defineProperty(SelectList.prototype, "currentItem", {
get: function () {
if (this.selected !== -1 && this.options.length === 0)
return null;
return {
selectedItem: this.config.back && this.selected === -1
? this.config.back
: this.options[this.selected].option,
index: this.config.back &&
(this.selected == -1 ||
this.options[this.selected].option === this.config.back)
? -1
: this.options[this.selected].index,
};
},
enumerable: false,
configurable: true
});
SelectList.prototype.run = function () {

@@ -99,7 +179,6 @@ return __awaiter(this, void 0, void 0, function () {

this.t.interactor.saveCursorSpot();
if (this.config.onChange) { // initial call of onChange
this.config.onChange({
selectedItem: this.config.options[this.selected],
index: this.config.back && this.selected == this.config.options.length ? -1 : this.selected
});
if (this.config.onChange) {
// initial call of onChange
// why is there
this.config.onChange(this.currentItem);
}

@@ -117,12 +196,6 @@ response = null;

if (reactResponse.rerender && this.config.onChange) {
this.config.onChange({
selectedItem: this.config.options[this.selected],
index: this.config.back && this.selected == this.config.options.length ? -1 : this.selected
});
this.config.onChange(this.currentItem);
}
if (reactResponse.finished) {
response = {
selectedItem: this.config.options[this.selected],
index: this.config.back && this.selected == this.config.options.length - 1 ? -1 : this.selected
};
response = this.currentItem;
}

@@ -136,17 +209,49 @@ return [3 /*break*/, 1];

SelectList.prototype.render = function () {
var e_1, _a;
var _this = this;
this.t.interactor.restoreCursorSpot();
if (this.config.text)
this.t.interactor.writeWithNewLine(this.config.text);
this.config.options.forEach(function (option, index) {
this.t.interactor.clearLine();
this.t.interactor.writeWithNewLine(this.config.text + (this.search ? " (".concat(this.search, ")") : ""));
try {
for (var _b = __values(this.config.options), _c = _b.next(); !_c.done; _c = _b.next()) {
var _ = _c.value;
this.t.interactor.clearLine().newLine();
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
this.t.interactor.moveCursor.up(this.config.options.length);
this.options.forEach(function (_a, index) {
var option = _a.option;
if (index == _this.selected) {
_this.t.interactor.clearLine()
.write(_this.t.interactor.color.green(_this.t.interactor.decorate.bold((_this.config.back == option ? '<- ' : '-> ') + option))).newLine();
_this.t.interactor
.clearLine()
.write(_this.t.interactor.color.green(_this.t.interactor.decorate.bold((_this.config.back == option ? "<- " : "-> ") + option)))
.newLine();
}
else {
_this.t.interactor.clearLine()
.write(' ' + option).newLine();
_this.t.interactor
.clearLine()
.write(" " + option)
.newLine();
}
});
};
SelectList.prototype.removeFromSearch = function () {
this.search = this.search.slice(0, -1);
this.selected = 0;
};
SelectList.prototype.addToSearch = function (char) {
this.search += char;
this.selected = 0;
// this.selected = this.config.options.findIndex((option) =>
// option.startsWith(this.search)
// );
};
SelectList.prototype.react = function () {

@@ -170,5 +275,10 @@ return __awaiter(this, void 0, void 0, function () {

}
if (!reaction) {
if (key[0] > 32 && key[0] < 127) {
this.addToSearch(key.toString());
}
}
return [2 /*return*/, {
finished: reaction && reaction.action ? reaction.action() : false,
rerender: !!reaction
rerender: true,
}];

@@ -175,0 +285,0 @@ }

@@ -64,3 +64,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SelectTree = void 0;

@@ -166,3 +166,3 @@ var SelectTree = /** @class */ (function () {

try {
if (_c && !_c.done && (_a = _b["return"])) _a.call(_b);
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}

@@ -208,3 +208,3 @@ finally { if (e_1) throw e_1.error; }

try {
if (currentSelected_1_1 && !currentSelected_1_1.done && (_c = currentSelected_1["return"])) _c.call(currentSelected_1);
if (currentSelected_1_1 && !currentSelected_1_1.done && (_c = currentSelected_1.return)) _c.call(currentSelected_1);
}

@@ -224,3 +224,3 @@ finally { if (e_2) throw e_2.error; }

try {
if (_b && !_b.done && (_d = _a["return"])) _d.call(_a);
if (_b && !_b.done && (_d = _a.return)) _d.call(_a);
}

@@ -254,3 +254,3 @@ finally { if (e_3) throw e_3.error; }

try {
if (_c && !_c.done && (_a = _b["return"])) _a.call(_b);
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}

@@ -278,3 +278,3 @@ finally { if (e_4) throw e_4.error; }

try {
if (_c && !_c.done && (_a = _b["return"])) _a.call(_b);
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}

@@ -302,3 +302,3 @@ finally { if (e_5) throw e_5.error; }

try {
if (selectedBranches_1_1 && !selectedBranches_1_1.done && (_b = selectedBranches_1["return"])) _b.call(selectedBranches_1);
if (selectedBranches_1_1 && !selectedBranches_1_1.done && (_b = selectedBranches_1.return)) _b.call(selectedBranches_1);
}

@@ -312,3 +312,3 @@ finally { if (e_7) throw e_7.error; }

try {
if (_d && !_d.done && (_a = _c["return"])) _a.call(_c);
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
}

@@ -365,3 +365,3 @@ finally { if (e_6) throw e_6.error; }

try {
if (_c && !_c.done && (_a = _b["return"])) _a.call(_b);
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}

@@ -368,0 +368,0 @@ finally { if (e_8) throw e_8.error; }

@@ -1,2 +0,2 @@

exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ViewStack = void 0;

@@ -3,0 +3,0 @@ // might not be needed

{
"name": "agita",
"version": "1.2.4",
"version": "1.2.5",
"main": "bin/index.js",

@@ -5,0 +5,0 @@ "author": "Joel Huggett",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc