Comparing version 1.0.2 to 1.0.3
313
dist/bin.js
@@ -12,49 +12,2 @@ #!/usr/bin/env node | ||
var id = [0]; | ||
function get_id() { | ||
id[0] += 1; | ||
return id[0]; | ||
} | ||
function create(str) { | ||
var v_001 = get_id(/* () */0); | ||
var v = /* tuple */[ | ||
str, | ||
v_001 | ||
]; | ||
v.tag = 248; | ||
return v; | ||
} | ||
function isCamlExceptionOrOpenVariant(e) { | ||
if (e === undefined) { | ||
return false; | ||
} else if (e.tag === 248) { | ||
return true; | ||
} else { | ||
var slot = e[0]; | ||
if (slot !== undefined) { | ||
return slot.tag === 248; | ||
} else { | ||
return false; | ||
} | ||
} | ||
} | ||
/* No side effect */ | ||
var $$Error = create("Js_exn.Error"); | ||
function internalToOCamlException(e) { | ||
if (isCamlExceptionOrOpenVariant(e)) { | ||
return e; | ||
} else { | ||
return [ | ||
$$Error, | ||
e | ||
]; | ||
} | ||
} | ||
/* No side effect */ | ||
var out_of_memory = /* tuple */[ | ||
@@ -155,13 +108,2 @@ "Out_of_memory", | ||
} | ||
function caml_array_get(xs, index) { | ||
if (index < 0 || index >= xs.length) { | ||
throw [ | ||
invalid_argument, | ||
"index out of bounds" | ||
]; | ||
} else { | ||
return xs[index]; | ||
} | ||
} | ||
/* No side effect */ | ||
@@ -286,2 +228,12 @@ | ||
/* No side effect */ | ||
/* No side effect */ | ||
/* No side effect */ | ||
/* node_std_output Not a pure module */ | ||
/* No side effect */ | ||
/* imul Not a pure module */ | ||
@@ -291,4 +243,2 @@ | ||
/* No side effect */ | ||
/* two_ptr_32_dbl Not a pure module */ | ||
@@ -544,7 +494,31 @@ | ||
function uppercase(c) { | ||
if (c >= /* "a" */97 && c <= /* "z" */122 || c >= /* "\224" */224 && c <= /* "\246" */246 || c >= /* "\248" */248 && c <= /* "\254" */254) { | ||
return c - 32 | 0; | ||
var id = /* record */[/* contents */0]; | ||
function get_id() { | ||
id[0] += 1; | ||
return id[0]; | ||
} | ||
function create(str) { | ||
var v_001 = get_id(/* () */0); | ||
var v = /* tuple */[ | ||
str, | ||
v_001 | ||
]; | ||
v.tag = 248; | ||
return v; | ||
} | ||
function isCamlExceptionOrOpenVariant(e) { | ||
if (e === undefined) { | ||
return false; | ||
} else if (e.tag === 248) { | ||
return true; | ||
} else { | ||
return c; | ||
var slot = e[0]; | ||
if (slot !== undefined) { | ||
return slot.tag === 248; | ||
} else { | ||
return false; | ||
} | ||
} | ||
@@ -558,16 +532,62 @@ } | ||
/* node_std_output Not a pure module */ | ||
var Exit = create("Pervasives.Exit"); | ||
/* No side effect */ | ||
function hd(param) { | ||
if (param) { | ||
return param[0]; | ||
} else { | ||
throw [ | ||
failure, | ||
"hd" | ||
]; | ||
} | ||
} | ||
/* No side effect */ | ||
var $$Error = create("Js_exn.Error"); | ||
function internalToOCamlException(e) { | ||
if (isCamlExceptionOrOpenVariant(e)) { | ||
return e; | ||
} else { | ||
return [ | ||
$$Error, | ||
e | ||
]; | ||
} | ||
} | ||
/* No side effect */ | ||
var Exit = create("Pervasives.Exit"); | ||
function to_list(a) { | ||
var _i = a.length - 1 | 0; | ||
var _res = /* [] */0; | ||
while(true) { | ||
var res = _res; | ||
var i = _i; | ||
if (i < 0) { | ||
return res; | ||
} else { | ||
_res = /* :: */[ | ||
a[i], | ||
res | ||
]; | ||
_i = i - 1 | 0; | ||
continue ; | ||
} | ||
}} | ||
var Bottom = create("Array.Bottom"); | ||
/* No side effect */ | ||
function uppercase(c) { | ||
if (c >= /* "a" */97 && c <= /* "z" */122 || c >= /* "\224" */224 && c <= /* "\246" */246 || c >= /* "\248" */248 && c <= /* "\254" */254) { | ||
return c - 32 | 0; | ||
} else { | ||
return c; | ||
} | ||
} | ||
/* No side effect */ | ||
function sub$1(s, ofs, len) { | ||
function sub$2(s, ofs, len) { | ||
if (ofs < 0 || len < 0 || ofs > (s.length - len | 0)) { | ||
@@ -585,3 +605,3 @@ throw [ | ||
function mapi$2(f, s) { | ||
function mapi$3(f, s) { | ||
var l = s.length; | ||
@@ -639,8 +659,8 @@ if (l === 0) { | ||
function sub$2(s, ofs, len) { | ||
return bytes_to_string(sub$1(bytes_of_string(s), ofs, len)); | ||
function sub$3(s, ofs, len) { | ||
return bytes_to_string(sub$2(bytes_of_string(s), ofs, len)); | ||
} | ||
function mapi$3(f, s) { | ||
return bytes_to_string(mapi$2(f, bytes_of_string(s))); | ||
function mapi$4(f, s) { | ||
return bytes_to_string(mapi$3(f, bytes_of_string(s))); | ||
} | ||
@@ -653,3 +673,3 @@ | ||
// Generated by BUCKLESCRIPT VERSION 3.1.5, PLEASE EDIT WITH CARE | ||
// Generated by BUCKLESCRIPT VERSION 4.0.0, PLEASE EDIT WITH CARE | ||
@@ -675,3 +695,3 @@ function isNumber(c) { | ||
return /* tuple */[ | ||
sub$2(param[0], 0, len), | ||
sub$3(param[0], 0, len), | ||
(function (param) { | ||
@@ -692,3 +712,3 @@ var rule = hmd5_2; | ||
var matchRuleAtIndex = param[1]; | ||
return mapi$3((function (i, ch) { | ||
return mapi$4((function (i, ch) { | ||
if (i !== 0) { | ||
@@ -712,73 +732,77 @@ if (isLowerCase(ch) && _1(matchRuleAtIndex, i)) { | ||
// Generated by BUCKLESCRIPT VERSION 3.1.5, PLEASE EDIT WITH CARE | ||
// Generated by BUCKLESCRIPT VERSION 4.0.0, PLEASE EDIT WITH CARE | ||
var Argument_required = create("Main-Fp455.Argument_required"); | ||
var ExitProcess = create("Main-Fp455.ExitProcess"); | ||
var Invalid_string_int = create("Main-Fp455.Invalid_string_int"); | ||
var CLI_HELP = create("Main-Fp455.CLI_HELP"); | ||
function main() { | ||
var pass; | ||
try { | ||
pass = caml_array_get(Process.argv, 2); | ||
} | ||
catch (raw_exn){ | ||
var exn = internalToOCamlException(raw_exn); | ||
if (exn[0] === invalid_argument) { | ||
throw [ | ||
Argument_required, | ||
"Need a password as the first argument!" | ||
]; | ||
var match = to_list(Process.argv); | ||
if (match) { | ||
var match$1 = match[1]; | ||
if (match$1) { | ||
var match$2 = match$1[1]; | ||
if (match$2) { | ||
var pass = match$2[0]; | ||
switch (pass) { | ||
case "--help" : | ||
case "-h" : | ||
console.log("Welcome to fp455-cli\n\nfp455-cli is a command line for generate flower password. fp455 means flower pa(4)s(5)s(5)word.\n\nUsage:\n\n fp455 password key [length] -- generate the password\n fp455 -h, fp455 --help -- get the help infomation\n\nSuggestion:\nalias fp455 as ` fp`, note the leading space, for not saving sensitive infomation to shell history.\n\n alias fp455=' fp'\n"); | ||
return /* () */0; | ||
default: | ||
var match$3 = match$2[1]; | ||
if (match$3) { | ||
var len; | ||
var exit = 0; | ||
var len$1; | ||
try { | ||
len$1 = caml_int_of_string(hd(match$3[1])); | ||
exit = 1; | ||
} | ||
catch (raw_exn){ | ||
var exn = internalToOCamlException(raw_exn); | ||
if (exn[0] === failure) { | ||
switch (exn[1]) { | ||
case "hd" : | ||
len = 16; | ||
break; | ||
case "int_of_string" : | ||
throw [ | ||
ExitProcess, | ||
"Invalid length argument, try \"fp455 -h\" get the help information" | ||
]; | ||
default: | ||
throw exn; | ||
} | ||
} else { | ||
throw exn; | ||
} | ||
} | ||
if (exit === 1) { | ||
if (len$1 > 0 && len$1 <= 32) { | ||
len = len$1; | ||
} else { | ||
throw [ | ||
ExitProcess, | ||
"The length must be in range(0, 32]!" | ||
]; | ||
} | ||
} | ||
console.log(calculate(pass, match$3[0], len)); | ||
return /* () */0; | ||
} else { | ||
console.log("Not engough arguments, try \"fp455 -h\" get the help information"); | ||
return /* () */0; | ||
} | ||
} | ||
} else { | ||
console.log("Not engough arguments, try \"fp455 -h\" get the help information"); | ||
return /* () */0; | ||
} | ||
} else { | ||
throw exn; | ||
console.log("Not engough arguments, try \"fp455 -h\" get the help information"); | ||
return /* () */0; | ||
} | ||
} else { | ||
console.log("Not engough arguments, try \"fp455 -h\" get the help information"); | ||
return /* () */0; | ||
} | ||
var pass$1; | ||
switch (pass) { | ||
case "--help" : | ||
case "-h" : | ||
throw CLI_HELP; | ||
default: | ||
pass$1 = pass; | ||
} | ||
var key; | ||
try { | ||
key = caml_array_get(Process.argv, 3); | ||
} | ||
catch (raw_exn$1){ | ||
var exn$1 = internalToOCamlException(raw_exn$1); | ||
if (exn$1[0] === invalid_argument) { | ||
throw [ | ||
Argument_required, | ||
"Need a secret key as the seconed argument!" | ||
]; | ||
} else { | ||
throw exn$1; | ||
} | ||
} | ||
var len; | ||
try { | ||
len = caml_int_of_string(caml_array_get(Process.argv, 4)); | ||
} | ||
catch (raw_exn$2){ | ||
var exn$2 = internalToOCamlException(raw_exn$2); | ||
if (exn$2[0] === invalid_argument) { | ||
len = 16; | ||
} else { | ||
throw [ | ||
Invalid_string_int, | ||
"The length must be an integer!" | ||
]; | ||
} | ||
} | ||
if (len <= 0 || len > 32) { | ||
throw [ | ||
Invalid_string_int, | ||
"The length must be in range(1, 32)!" | ||
]; | ||
} | ||
var finallyPass = calculate(pass$1, key, len); | ||
console.log(finallyPass); | ||
return /* () */0; | ||
} | ||
@@ -791,8 +815,5 @@ | ||
var exn = internalToOCamlException(raw_exn); | ||
if (exn[0] === Argument_required) { | ||
if (exn[0] === ExitProcess) { | ||
console.log(exn[1]); | ||
} else if (exn[0] === Invalid_string_int) { | ||
console.log(exn[1]); | ||
} else if (exn === CLI_HELP) { | ||
console.log("Welcome to fp455-cli\n\nfp455-cli is a command line for generate flower password. fp455 means flower pa(4)s(5)s(5)word.\n\nUsage:\n\n fp455 password key [length] -- generate the password\n fp455 -h, fp455 --help -- get the help infomation\n\nSuggestion:\nalias fp455 as ` fp`, note the leading space, for not saving sensitive infomation to shell history.\n\n alias fp455=' fp'\n"); | ||
Process.exit(1); | ||
} else { | ||
@@ -799,0 +820,0 @@ console.log("unexpected error happens."); |
@@ -354,3 +354,3 @@ (function (global, factory) { | ||
var id = [0]; | ||
var id = /* record */[/* contents */0]; | ||
@@ -461,3 +461,3 @@ function get_id() { | ||
// Generated by BUCKLESCRIPT VERSION 3.1.5, PLEASE EDIT WITH CARE | ||
// Generated by BUCKLESCRIPT VERSION 4.0.0, PLEASE EDIT WITH CARE | ||
@@ -464,0 +464,0 @@ function isNumber(c) { |
@@ -1,2 +0,2 @@ | ||
// Generated by BUCKLESCRIPT VERSION 3.1.5, PLEASE EDIT WITH CARE | ||
// Generated by BUCKLESCRIPT VERSION 4.0.0, PLEASE EDIT WITH CARE | ||
'use strict'; | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by BUCKLESCRIPT VERSION 3.1.5, PLEASE EDIT WITH CARE | ||
// Generated by BUCKLESCRIPT VERSION 4.0.0, PLEASE EDIT WITH CARE | ||
@@ -3,0 +3,0 @@ import * as Char from "bs-platform/lib/es6/char.js"; |
@@ -1,6 +0,7 @@ | ||
// Generated by BUCKLESCRIPT VERSION 3.1.5, PLEASE EDIT WITH CARE | ||
// Generated by BUCKLESCRIPT VERSION 4.0.0, PLEASE EDIT WITH CARE | ||
import * as List from "bs-platform/lib/es6/list.js"; | ||
import * as $$Array from "bs-platform/lib/es6/array.js"; | ||
import * as Js_exn from "bs-platform/lib/es6/js_exn.js"; | ||
import * as Process from "process"; | ||
import * as Caml_array from "bs-platform/lib/es6/caml_array.js"; | ||
import * as Caml_format from "bs-platform/lib/es6/caml_format.js"; | ||
@@ -11,71 +12,75 @@ import * as Fp455$Fp455 from "./Fp455.js"; | ||
var Argument_required = Caml_exceptions.create("Main-Fp455.Argument_required"); | ||
var ExitProcess = Caml_exceptions.create("Main-Fp455.ExitProcess"); | ||
var Invalid_string_int = Caml_exceptions.create("Main-Fp455.Invalid_string_int"); | ||
var CLI_HELP = Caml_exceptions.create("Main-Fp455.CLI_HELP"); | ||
function main() { | ||
var pass; | ||
try { | ||
pass = Caml_array.caml_array_get(Process.argv, 2); | ||
} | ||
catch (raw_exn){ | ||
var exn = Js_exn.internalToOCamlException(raw_exn); | ||
if (exn[0] === Caml_builtin_exceptions.invalid_argument) { | ||
throw [ | ||
Argument_required, | ||
"Need a password as the first argument!" | ||
]; | ||
var match = $$Array.to_list(Process.argv); | ||
if (match) { | ||
var match$1 = match[1]; | ||
if (match$1) { | ||
var match$2 = match$1[1]; | ||
if (match$2) { | ||
var pass = match$2[0]; | ||
switch (pass) { | ||
case "--help" : | ||
case "-h" : | ||
console.log("Welcome to fp455-cli\n\nfp455-cli is a command line for generate flower password. fp455 means flower pa(4)s(5)s(5)word.\n\nUsage:\n\n fp455 password key [length] -- generate the password\n fp455 -h, fp455 --help -- get the help infomation\n\nSuggestion:\nalias fp455 as ` fp`, note the leading space, for not saving sensitive infomation to shell history.\n\n alias fp455=' fp'\n"); | ||
return /* () */0; | ||
default: | ||
var match$3 = match$2[1]; | ||
if (match$3) { | ||
var len; | ||
var exit = 0; | ||
var len$1; | ||
try { | ||
len$1 = Caml_format.caml_int_of_string(List.hd(match$3[1])); | ||
exit = 1; | ||
} | ||
catch (raw_exn){ | ||
var exn = Js_exn.internalToOCamlException(raw_exn); | ||
if (exn[0] === Caml_builtin_exceptions.failure) { | ||
switch (exn[1]) { | ||
case "hd" : | ||
len = 16; | ||
break; | ||
case "int_of_string" : | ||
throw [ | ||
ExitProcess, | ||
"Invalid length argument, try \"fp455 -h\" get the help information" | ||
]; | ||
default: | ||
throw exn; | ||
} | ||
} else { | ||
throw exn; | ||
} | ||
} | ||
if (exit === 1) { | ||
if (len$1 > 0 && len$1 <= 32) { | ||
len = len$1; | ||
} else { | ||
throw [ | ||
ExitProcess, | ||
"The length must be in range(0, 32]!" | ||
]; | ||
} | ||
} | ||
console.log(Fp455$Fp455.calculate(pass, match$3[0], len)); | ||
return /* () */0; | ||
} else { | ||
console.log("Not engough arguments, try \"fp455 -h\" get the help information"); | ||
return /* () */0; | ||
} | ||
} | ||
} else { | ||
console.log("Not engough arguments, try \"fp455 -h\" get the help information"); | ||
return /* () */0; | ||
} | ||
} else { | ||
throw exn; | ||
console.log("Not engough arguments, try \"fp455 -h\" get the help information"); | ||
return /* () */0; | ||
} | ||
} else { | ||
console.log("Not engough arguments, try \"fp455 -h\" get the help information"); | ||
return /* () */0; | ||
} | ||
var pass$1; | ||
switch (pass) { | ||
case "--help" : | ||
case "-h" : | ||
throw CLI_HELP; | ||
default: | ||
pass$1 = pass; | ||
} | ||
var key; | ||
try { | ||
key = Caml_array.caml_array_get(Process.argv, 3); | ||
} | ||
catch (raw_exn$1){ | ||
var exn$1 = Js_exn.internalToOCamlException(raw_exn$1); | ||
if (exn$1[0] === Caml_builtin_exceptions.invalid_argument) { | ||
throw [ | ||
Argument_required, | ||
"Need a secret key as the seconed argument!" | ||
]; | ||
} else { | ||
throw exn$1; | ||
} | ||
} | ||
var len; | ||
try { | ||
len = Caml_format.caml_int_of_string(Caml_array.caml_array_get(Process.argv, 4)); | ||
} | ||
catch (raw_exn$2){ | ||
var exn$2 = Js_exn.internalToOCamlException(raw_exn$2); | ||
if (exn$2[0] === Caml_builtin_exceptions.invalid_argument) { | ||
len = 16; | ||
} else { | ||
throw [ | ||
Invalid_string_int, | ||
"The length must be an integer!" | ||
]; | ||
} | ||
} | ||
if (len <= 0 || len > 32) { | ||
throw [ | ||
Invalid_string_int, | ||
"The length must be in range(1, 32)!" | ||
]; | ||
} | ||
var finallyPass = Fp455$Fp455.calculate(pass$1, key, len); | ||
console.log(finallyPass); | ||
return /* () */0; | ||
} | ||
@@ -88,8 +93,5 @@ | ||
var exn = Js_exn.internalToOCamlException(raw_exn); | ||
if (exn[0] === Argument_required) { | ||
if (exn[0] === ExitProcess) { | ||
console.log(exn[1]); | ||
} else if (exn[0] === Invalid_string_int) { | ||
console.log(exn[1]); | ||
} else if (exn === CLI_HELP) { | ||
console.log("Welcome to fp455-cli\n\nfp455-cli is a command line for generate flower password. fp455 means flower pa(4)s(5)s(5)word.\n\nUsage:\n\n fp455 password key [length] -- generate the password\n fp455 -h, fp455 --help -- get the help infomation\n\nSuggestion:\nalias fp455 as ` fp`, note the leading space, for not saving sensitive infomation to shell history.\n\n alias fp455=' fp'\n"); | ||
Process.exit(1); | ||
} else { | ||
@@ -96,0 +98,0 @@ console.log("unexpected error happens."); |
{ | ||
"name": "fp455", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"scripts": { | ||
@@ -25,4 +25,4 @@ "build": "rollup -c && NODE_ENV=bin rollup -c", | ||
"devDependencies": { | ||
"bs-platform": "^3.1.5", | ||
"rollup": "^0.60.1", | ||
"bs-platform": "^4.0.0", | ||
"rollup": "^0.62.0", | ||
"rollup-plugin-bucklescript": "^0.6.1", | ||
@@ -29,0 +29,0 @@ "rollup-plugin-node-resolve": "^3.3.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1462
108414