-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.min.js
1 lines (1 loc) · 2.23 KB
/
app.min.js
1
"use strict";(function(){'use strict';function a(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};a=$.extend(!0,{src:{login:"",host:"",path:""},dest:{login:"",host:"",path:""},ignore:{files:[],exclude:[]},setting:{port:"",contents:"",compress:"",archive:"",extraneous:"",recursive:"",dirs:"",verbose:""}},a);var b=[],c=[];if(a.setting.verbose&&c.push("v"),a.setting.compress&&c.push("z"),a.setting.archive&&c.push("a"),a.setting.recursive&&c.push("r"),a.setting.dirs&&c.push("d"),c.filter(Boolean).length&&b.push("-"+c.join("")),a.setting.port&&b.push("-e \"ssh -p ".concat(a.setting.port,"\"")),a.setting.extraneous&&b.push("--delete"),a.ignore.exclude&&("string"==typeof a.ignore.exclude&&(a.ignore.exclude=a.ignore.exclude.split(/[\r\n]+/).filter(Boolean)),Array.isArray(a.ignore.exclude)))for(var d=0;d<a.ignore.exclude.length;d++)b.push("--exclude \"".concat(a.ignore.exclude[d],"\""));if(a.ignore.include&&("string"==typeof a.ignore.include&&(a.ignore.include=a.ignore.include.split(/[\r\n]+/).filter(Boolean)),Array.isArray(a.ignore.include)))for(var e=0;e<a.ignore.include.length;e++)b.push("--include \"".concat(a.ignore.include[e],"\""));return a.src.login&&a.src.host&&a.src.path?b.push("".concat(a.src.login,"@").concat(a.src.host,":\"").concat(a.src.path,"\"")):a.src.path&&b.push("\"".concat(a.src.path,"\"")),a.dest.login&&a.dest.host&&a.dest.path?b.push("".concat(a.dest.login,"@").concat(a.dest.host,":\"").concat(a.dest.path,"\"")):a.dest.path&&b.push("\"".concat(a.dest.path,"\"")),"rsync "+b.filter(Boolean).join(" ")}var b=$("[name=\"src[path]\"]"),c=$("[name=\"setting[contents]\"]");b.on("change input keyup keydown",function(){var a=/\/$/i.test($(this).val());c.prop("checked",a)}),c.on("change input keyup",function(){var a=b.val().replace(/\/$/i,"");c.is(":checked")&&(a="".concat(a,"/")),b.val(a)}),$(":input").not("[readonly]").on("change input keyup mouseup",function(){for(var b=$(":input").serializeArray(),c={},d=0;d<b.length;d++){var e=b[d],f=e.name.match(/([a-z]{1,})\[([a-z]{1,})\]/i),g=f[1],h=f[2];g&&h&&("undefined"==typeof c[g]&&(c[g]={}),c[g][h]=e.value)}var j=a(c);$("#print-command").val(j),$("#link-command").attr("href","https://explainshell.com/explain?cmd=".concat(encodeURIComponent(j)))}).trigger("change")})(jQuery);