UNPKG

@lenne.tech/cli

Version:

lenne.Tech CLI: lt

37 lines (36 loc) 1.52 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const js_sha256_1 = require("js-sha256"); /** * Open regex tools in browser */ const NewCommand = { alias: ['h', 'hash'], description: 'Hash a string with sha256', hidden: false, name: 'sha256', run: (toolbox) => __awaiter(void 0, void 0, void 0, function* () { const { helper, parameters, print: { info }, } = toolbox; const input = yield helper.getInput(parameters.first, { name: 'string to hash', showError: false, }); const hashResult = yield (0, js_sha256_1.sha256)(input); info(hashResult); if (!toolbox.parameters.options.fromGluegunMenu) { process.exit(); } // For tests return 'sha256'; }), }; exports.default = NewCommand;