jack-cli
Version:
Chop through that Git log wicked fast!
60 lines • 2.44 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var colors_1 = require("./colors");
var command_util_1 = require("./command-util");
var config_util_1 = require("./config-util");
var emphasis = colors_1.colors.emphasis;
var documentCommands = function (commands) {
return commands.reduce(function (accumulator, command) {
return "" + accumulator + emphasis(pad(6, command.key)) + " -> " + emphasis(command.description) + "\n " + command.command + "\n";
}, '');
};
var getPresetKeysText = function () {
var keys = [
["Space, Enter", "\"Quick Look\" a commit's contents (toggle)"],
["j/k, down/up", "(list view) Navigate between commits"],
["0-9", "(list view) Set a movement interval (like Vim)"],
["j/k, down/up", "(commit view) scroll down"],
["left/right", "(commit view) View previous/next commit"],
['', ''],
["/", "Focus search bar. Press enter to begin search."],
["n", "Jump to next search result"],
["N", "Jump to previous search result"],
['', ''],
["x", "Mark a commit as a range anchor"],
["o", "Open changed files in default editor"],
["m", "Copy commit message to clipboard"],
["y", "Copy commit SHA to clipboard"],
['', ''],
["?", "Show/hide help dialog"],
["r", "Refresh the list"],
['', ''],
["S-, / <", "Open the configuration file"],
];
if (config_util_1.getUseLegacyEscapeKeyBehavior()) {
keys.push(["q, esc, C-c", "Exit " + emphasis('jack')]);
}
else {
keys.push(["esc", "Return to default view"]);
keys.push(["q, C-c", "Exit " + emphasis('jack')]);
}
var longest = keys.reduce(function (acc, _a) {
var key = _a[0];
return Math.max(acc, key.length);
}, 0);
return keys
.map(function (_a) {
var key = _a[0], value = _a[1];
return key.length ? emphasis(pad(longest + 2, key) + " -> " + value) : '';
})
.join('\n');
};
var pad = function (l, s) {
var delta = l - s.length;
if (delta > 0) {
s += ' '.repeat(delta);
}
return s;
};
exports.HELP_TEXT = emphasis('Preset Keys') + "\n\nC = Control key\nS = Shift key\n\n" + getPresetKeysText() + "\n\n" + emphasis('Registered Keys') + "\n\n" + documentCommands(command_util_1.getCommands()) + "\n";
//# sourceMappingURL=help-text.js.map