manager-cli
v1.0.3
Published
Manager-cli is a custom manager command based in NodeJs. It can be configured with a single JSON and from it, generates all possible commands. It's installed as a global module.
Downloads
1
Readme
manager-cli
Manager-cli is a custom manager command based in NodeJs. It can be configured with a single JSON and from it, generates all possible commands. It's installed as a global module.
Contents
- 1 Download from Github
- 2 Install from npm
- 3 JSON
- 4 Other examples
- 4.1 For developers
- 4.2 For your company
- 5 Thanks to...
1 Download from Github
git clone https://github.com/jserra91/manager-cli.git
cd manager-cli
npm i && npm run build
2 Install from npm
npm i -g manager-cli
3 JSON
In the user folder create a manager-cli.json with this strcture:
{
"actions": [
{
"id": 1, <- Unique ID
"name": "generate", <- Command
"shortcut": "g", <- Shortcut
"execute": "", <- Internal execute command
"parent": 0, <- Parent
"childs": false, <- have childs?
"helper": "This is a simple test helper1" <- Helped
},
]
}
For example:
{
"actions": [
{
"id": 1,
"name": "generate",
"shortcut": "g",
"execute": "",
"parent": 0,
"childs": true,
"helper": "This is a simple test helper1"
},
{
"id": 2,
"name": "create",
"shortcut": "c",
"execute": "",
"parent": 1,
"childs": true,
"helper": "This is a simple test helper2"
},
{
"id": 3,
"name": "prepare",
"shortcut": "p",
"execute": "mkdir C:\\Serra\\prepare",
"parent": 1,
"childs": false,
"helper": "This is a simple test helper3"
},
{
"id": 4,
"name": "now",
"shortcut": "n",
"execute": "mkdir C:\\Serra\\now",
"parent": 2,
"childs": false,
"helper": "This is a simple test helper4"
}
]
}
With this example you can execute this commands:
manager-cli generate create now
manager-cli generate prepare
With first command create a folder now in C:\Serra\ . With second command create folder prepare
Or with shortcuts:
manager-cli g c n
manager-cli g p
4 Other examples
4.1 For developers
{
"actions": [
{
"id": 1,
"name": "create",
"shortcut": "c",
"execute": "",
"parent": 0,
"childs": true,
"helper": "This is a simple test helper2"
},
{
"id": 2,
"name": "vuejs",
"shortcut": "v",
"execute": "",
"parent": 1,
"childs": true,
"helper": "This is a simple test helper2"
},
{
"id": 5,
"name": "application",
"shortcut": "a",
"execute": "cd C:\\vuejs && vue create application-example -d",
"parent": 2,
"childs": false,
"helper": "test helper"
},
{
"id": 9,
"name": "angular",
"shortcut": "a",
"execute": "",
"parent": 1,
"childs": true,
"helper": "T"
},
{
"id": 10,
"name": "project",
"shortcut": "p",
"execute": "cd C:\\angular && ng new project angular-test",
"parent": 2,
"childs": false,
"helper": ""
},
{
"id": 11,
"name": "install",
"shortcut": "a",
"execute": "npm i -g @angular/cli && npm i -g vue-cli",
"parent": 1,
"childs": false,
"helper": "T"
}
]
}
Commands:
manager-cli c v a <- Create Vuejs project
manager-cli create vuejs application <- Create Vuejs project
manager-cli c a p <- Create Angular project
manager-cli create angular project <- Create Angular project
manager-cli install <- Install @angular/cli and vue-cli (global)
4.2 For your company
Download from Git and modify "bin" in package.json
...
"bin": {
"my-company": "./bin/global.js"
},
...
and upload in your repo
npm login && npm publish
{
"actions": [
{
"id": 1,
"name": "create",
"shortcut": "c",
"execute": "",
"parent": 0,
"childs": true,
"helper": "This is a simple test helper2"
},
{
"id": 2,
"name": "vuejs",
"shortcut": "v",
"execute": "",
"parent": 1,
"childs": true,
"helper": "This is a simple test helper2"
},
{
"id": 5,
"name": "application",
"shortcut": "a",
"execute": "cd C:\\vuejs && vue create application-example -d",
"parent": 2,
"childs": false,
"helper": "test helper"
},
{
"id": 9,
"name": "angular",
"shortcut": "a",
"execute": "",
"parent": 1,
"childs": true,
"helper": "T"
},
{
"id": 10,
"name": "project",
"shortcut": "p",
"execute": "cd C:\\angular && ng new project angular-test",
"parent": 2,
"childs": false,
"helper": ""
},
{
"id": 11,
"name": "install",
"shortcut": "a",
"execute": "npm i -g @angular/cli && npm i -g vue-cli",
"parent": 1,
"childs": false,
"helper": "T"
}
]
}
Commands:
my-company c v a <- Create Vuejs project
my-company create vuejs application <- Create Vuejs project
my-company c a p <- Create Angular project
my-company create angular project <- Create Angular project
my-company install <- Install @angular/cli and vue-cli (global)
5. Thanks to...
- Martin (stackoverflow) https://stackoverflow.com/questions/53322117/nodejs-javascript-readfilesync