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

@makechtec/tezcatl-cli

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@makechtec/tezcatl-cli - npm Package Compare versions

Comparing version 1.0.9 to 1.0.10

2

index.js

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

(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{ARGUMENT_FLAG:()=>u,Argument:()=>f,CLI:()=>a,Pattern:()=>c,Reader:()=>s,Writter:()=>l});const r=require("node:process"),n=require("node:fs");function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var a={getArgumentValue:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.argv,n=t.find((function(t){return c.testArg(e,t)}));if(void 0===n)return new f(e,"");var i=n.split("=")[1];return new f(e,i)},getArgumentsGroup:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.argv;return t.filter((function(t){return c.testArg(e,t)})).map((function(t){return t.replace(e,"")})).map((function(e){var t=e.split("=")[0],r=e.split("=")[1];return new f(t,r)}))},getFlagsGroup:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.argv;return e.filter((function(e){return c.testFlag(e)})).map((function(e){return e.replace(u,"")})).map((function(e){return new f(e,!0)}))},isFlag:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.argv;return t.includes(u+e)},getAllArguments:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.argv,t=e.slice(2);return t.filter((function(e){return c.testIsArg(e)})).map((function(e){var t=e.split("=")[0],r=e.split("=")[1];return new f(t,r)}))}},u="--",c={testStart:function(e,t){return new RegExp("^"+e).test(t)},testArg:function(e,t){return new RegExp("^"+e).test(t)},testIsArg:function(e){return e.includes("=")},testFlag:function(e){return new RegExp("^"+u).test(e)},testHasDirectory:function(e){return new RegExp("/").test(e)},replacePlaceholder:function(e,t){var r=new RegExp("\\$\\{"+t.name+"\\}","g");return e.replace(r,t.value)},countMatches:function(e,t){var r=new RegExp(t,"g");return((e||"").match(r)||[]).length}},s={readTemplate:function(e){this.read(e)},read:function(e){return n.existsSync(e)?n.readFileSync(e,"utf8"):(console.error("file not found in : "+e),"")},changePlaceholders:function(e,t){var r=e;return t.forEach((function(e){r=c.replacePlaceholder(r,e)})),r},readConfig:function(e){}},l={writeFile:function(e,t){if(c.testHasDirectory(e)){var r=e.lastIndexOf("/"),i=e.substring(0,r);this.createDirectory(i)}n.writeFileSync(e,t)},createDirectory:function(e){n.mkdirSync(e,{recursive:!0})},insertInLine:function(e,t,r){if(t-=1,c.testHasDirectory(e)){var i=e.lastIndexOf("/"),o=e.substring(0,i);this.createDirectory(o)}var a=n.readFileSync(e,"utf8").split(/\r?\n/);a.splice(t,0,r);var u=a.join("\n");n.writeFileSync(e,u)}},f=o((function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.name=t,this.value=r}));exports.ARGUMENT_FLAG=t.ARGUMENT_FLAG,exports.Argument=t.Argument,exports.CLI=t.CLI,exports.Pattern=t.Pattern,exports.Reader=t.Reader,exports.Writter=t.Writter,Object.defineProperty(exports,"__esModule",{value:!0})})();
(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{ARGUMENT_FLAG:()=>a,Argument:()=>f,CLI:()=>u,Pattern:()=>c,Reader:()=>s,Writter:()=>l});const r=require("node:process"),n=require("node:fs");function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var u={getArgumentValue:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.argv,n=t.find((function(t){return c.testArg(e,t)}));if(void 0===n)return new f(e,"");var i=n.split("=")[1];return new f(e,i)},getArgumentsGroup:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.argv;return t.filter((function(t){return c.testArg(e,t)})).map((function(t){return t.replace(e,"")})).map((function(e){var t=e.split("=")[0],r=e.split("=")[1];return new f(t,r)}))},getFlagsGroup:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.argv;return e.filter((function(e){return c.testFlag(e)})).map((function(e){return e.replace(a,"")})).map((function(e){return new f(e,!0)}))},isFlag:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.argv;return t.includes(a+e)},getAllArguments:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.argv,t=e.slice(2);return t.filter((function(e){return c.testIsArg(e)})).map((function(e){var t=e.split("=")[0],r=e.split("=")[1];return new f(t,r)}))}},a="--",c={testStart:function(e,t){return new RegExp("^"+e).test(t)},testArg:function(e,t){return new RegExp("^"+e).test(t)},testIsArg:function(e){return e.includes("=")},testFlag:function(e){return new RegExp("^"+a).test(e)},testHasDirectory:function(e){return new RegExp("/").test(e)},replacePlaceholder:function(e,t){var r=new RegExp("\\$\\{"+t.name+"\\}","g");return e.replace(r,t.value)},countMatches:function(e,t){var r=new RegExp(t,"g");return((e||"").match(r)||[]).length}},s={readTemplate:function(e){return this.read(e)},read:function(e){return n.existsSync(e)?n.readFileSync(e,"utf8"):(console.error("file not found in : "+e),"")},changePlaceholders:function(e,t){var r=e;return t.forEach((function(e){r=c.replacePlaceholder(r,e)})),r}},l={writeFile:function(e,t){if(c.testHasDirectory(e)){var r=e.lastIndexOf("/"),i=e.substring(0,r);this.createDirectory(i)}n.writeFileSync(e,t)},createDirectory:function(e){n.mkdirSync(e,{recursive:!0})},insertInLine:function(e,t,r){if(t-=1,c.testHasDirectory(e)){var i=e.lastIndexOf("/"),o=e.substring(0,i);this.createDirectory(o)}var u=n.readFileSync(e,"utf8").split(/\r?\n/);u.splice(t,0,r);var a=u.join("\n");n.writeFileSync(e,a)}},f=o((function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.name=t,this.value=r}));exports.ARGUMENT_FLAG=t.ARGUMENT_FLAG,exports.Argument=t.Argument,exports.CLI=t.CLI,exports.Pattern=t.Pattern,exports.Reader=t.Reader,exports.Writter=t.Writter,Object.defineProperty(exports,"__esModule",{value:!0})})();
{
"name": "@makechtec/tezcatl-cli",
"version": "1.0.9",
"version": "1.0.10",
"description": "",

@@ -12,3 +12,3 @@ "main": "index.js",

"type": "git",
"url": "git+https://github.com/angeldomp49/tezcatl-cli.git"
"url": "git+https://github.com/MakechTec/tezcatl-cli.git"
},

@@ -15,0 +15,0 @@ "author": "makechtec",

# Tezcatl CLI #
It's only the CLI API
This module is a low level API, which is used to interact with the command line arguments. And with some file actions.
### installation ###
$ npm install @makechtec/tezcatl-cli
### Argument Class ###
export class Argument{
constructor(name, value){
this.name = name;
this.value = value;
}
}
### Constants ###
export const ARGUMENT_FLAG = "--";
### Pattern Object ###
testStart(search, target) : booelean
chek if the target starts with the search
testArg(search, target) : boolean
check if the target is an argument with the search as name
testIsArg(target) : boolean
check if the target is an argument
testFlag(target) : boolean
check if the target is a flag
testHasDirectory(target) : boolean
check if the target path contains a directory
replacePlaceholder(content, placeholder) : string
replace the placeholder name in all matches inside the content with the value of the placeholder
countMatches(str, pattern) : number
count the number of matches of the pattern in the string
### Reader Object ###
readTemplate(templateName) : string
Alias of read
read(templateName) : string
read the template file
changePlaceholders(content, placeholders) : string
replace the placeholder name in all matches inside the content with the value of the placeholder for each item in the placeholders array
### Writter Object ###
writeFile(fileName, content) : void
create or overwrite the file with the content
createDirectory(dirName) : void
create the directory
insertInLine(fileName, lineNumber, text) : void
insert the text in the line number of the file
### CLI Object ###
getArgumentValue(name, params = argv) : Argument
read the argument from the command line, it must be the form:
name=value
the result is an instance of the Argument class
getArgumentsGroup(prefix, params = argv) : Argument[]
read the arguments from the command line, it must be the form:
prefix1=value1 prefix2=value2 prefix3=value3
the result is an array of instances of the Argument class
getFlagsGroup(params = argv) : Argument[]
read the flags from the command line, it must be the form:
--flag1 --flag2 --flag3
the result is an array of instances of the Argument class, the value is true.
isFlag: (name, params = argv) : boolean
check if the flag is present in the command line
getAllArguments: function(params = argv) : Argument[]
read all arguments ignoring the flags. the result is an array of instances of the Argument class

Sorry, the diff of this file is not supported yet

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