custom-menu-cli 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +89 -1
- package/package.json +1 -1
- package/README-en.md +0 -89
package/README.md
CHANGED
@@ -1,3 +1,91 @@
|
|
1
1
|
# Custom Menu CLI
|
2
2
|
|
3
|
-
[
|
3
|
+
[Português (Brasil)](./README-pt.md)
|
4
|
+
|
5
|
+
This is a command-line interface (CLI) tool that creates an interactive menu based on a JSON file. It's designed to simplify the execution of frequent commands in a terminal.
|
6
|
+
|
7
|
+
## Features
|
8
|
+
|
9
|
+
- Interactive menu in the terminal.
|
10
|
+
- Menu structure defined by a JSON file.
|
11
|
+
- Easy to configure and use.
|
12
|
+
- Support for command execution with confirmation.
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
To install this tool globally, run the following command:
|
17
|
+
|
18
|
+
```bash
|
19
|
+
npm install -g custom-menu-cli
|
20
|
+
```
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
To use the CLI, you can run the `custom-menu-cli` command, optionally passing the path to a JSON file. If no path is provided, it will look for a `menu.json` file in the current directory.
|
25
|
+
|
26
|
+
```bash
|
27
|
+
custom-menu-cli [path/to/your/menu.json]
|
28
|
+
```
|
29
|
+
|
30
|
+
## JSON Structure
|
31
|
+
|
32
|
+
The JSON file that defines the menu has the following structure:
|
33
|
+
|
34
|
+
```json
|
35
|
+
{
|
36
|
+
"name": "Deploy Menu",
|
37
|
+
"description": "Menu de navegação para deploys",
|
38
|
+
"options": [
|
39
|
+
{
|
40
|
+
"id": "1",
|
41
|
+
"name": "Projeto A",
|
42
|
+
"type": "navigation",
|
43
|
+
"options": [
|
44
|
+
{
|
45
|
+
"id": "1.1",
|
46
|
+
"name": "Down Service",
|
47
|
+
"type": "action",
|
48
|
+
"command": "echo 'Down A'",
|
49
|
+
"confirm": true
|
50
|
+
},
|
51
|
+
{
|
52
|
+
"id": "1.2",
|
53
|
+
"name": "Up Service",
|
54
|
+
"type": "action",
|
55
|
+
"command": "echo 'Up A'"
|
56
|
+
}
|
57
|
+
]
|
58
|
+
},
|
59
|
+
{
|
60
|
+
"id": "2",
|
61
|
+
"name": "Restart All",
|
62
|
+
"type": "custom-action",
|
63
|
+
"idList": ["1.1", "1.2"],
|
64
|
+
"confirm": true
|
65
|
+
}
|
66
|
+
]
|
67
|
+
}
|
68
|
+
```
|
69
|
+
|
70
|
+
### Fields
|
71
|
+
|
72
|
+
- `name`: The name of the menu.
|
73
|
+
- `description`: A brief description of the menu.
|
74
|
+
- `options`: An array of menu options.
|
75
|
+
- `id`: A unique identifier for the option.
|
76
|
+
- `name`: The text that will be displayed for the option.
|
77
|
+
- `type`: The type of option. It can be `action` (executes a command), `navigation` (opens a submenu) or `custom-action` (executes a list of commands from other actions).
|
78
|
+
- `command`: The command to be executed (if the type is `action`).
|
79
|
+
- `idList`: A list of ids from other actions to be executed (if the type is `custom-action`).
|
80
|
+
- `confirm`: A boolean that indicates whether a confirmation should be requested before executing the command.
|
81
|
+
- `options`: An array of sub-options (if the type is `navigation`).
|
82
|
+
|
83
|
+
## License
|
84
|
+
|
85
|
+
This project is licensed under the MIT License.
|
86
|
+
|
87
|
+
## Author
|
88
|
+
|
89
|
+
- **Mateus Medeiros**
|
90
|
+
- GitHub: [@mateusmed](https://github.com/mateusmed)
|
91
|
+
- LinkedIn: [Mateus Medeiros](https://www.linkedin.com/in/mateus-med/)
|
package/package.json
CHANGED
package/README-en.md
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
# Custom Menu CLI
|
2
|
-
|
3
|
-
This is a command-line interface (CLI) tool that creates an interactive menu based on a JSON file. It's designed to simplify the execution of frequent commands in a terminal.
|
4
|
-
|
5
|
-
## Features
|
6
|
-
|
7
|
-
- Interactive menu in the terminal.
|
8
|
-
- Menu structure defined by a JSON file.
|
9
|
-
- Easy to configure and use.
|
10
|
-
- Support for command execution with confirmation.
|
11
|
-
|
12
|
-
## Installation
|
13
|
-
|
14
|
-
To install this tool globally, run the following command:
|
15
|
-
|
16
|
-
```bash
|
17
|
-
npm install -g custom-menu-cli
|
18
|
-
```
|
19
|
-
|
20
|
-
## Usage
|
21
|
-
|
22
|
-
To use the CLI, you can run the `custom-menu-cli` command, optionally passing the path to a JSON file. If no path is provided, it will look for a `menu.json` file in the current directory.
|
23
|
-
|
24
|
-
```bash
|
25
|
-
custom-menu-cli [path/to/your/menu.json]
|
26
|
-
```
|
27
|
-
|
28
|
-
## JSON Structure
|
29
|
-
|
30
|
-
The JSON file that defines the menu has the following structure:
|
31
|
-
|
32
|
-
```json
|
33
|
-
{
|
34
|
-
"name": "Deploy Menu",
|
35
|
-
"description": "Menu de navegação para deploys",
|
36
|
-
"options": [
|
37
|
-
{
|
38
|
-
"id": "1",
|
39
|
-
"name": "Projeto A",
|
40
|
-
"type": "navigation",
|
41
|
-
"options": [
|
42
|
-
{
|
43
|
-
"id": "1.1",
|
44
|
-
"name": "Down Service",
|
45
|
-
"type": "action",
|
46
|
-
"command": "echo 'Down A'",
|
47
|
-
"confirm": true
|
48
|
-
},
|
49
|
-
{
|
50
|
-
"id": "1.2",
|
51
|
-
"name": "Up Service",
|
52
|
-
"type": "action",
|
53
|
-
"command": "echo 'Up A'"
|
54
|
-
}
|
55
|
-
]
|
56
|
-
},
|
57
|
-
{
|
58
|
-
"id": "2",
|
59
|
-
"name": "Restart All",
|
60
|
-
"type": "custom-action",
|
61
|
-
"idList": ["1.1", "1.2"],
|
62
|
-
"confirm": true
|
63
|
-
}
|
64
|
-
]
|
65
|
-
}
|
66
|
-
```
|
67
|
-
|
68
|
-
### Fields
|
69
|
-
|
70
|
-
- `name`: The name of the menu.
|
71
|
-
- `description`: A brief description of the menu.
|
72
|
-
- `options`: An array of menu options.
|
73
|
-
- `id`: A unique identifier for the option.
|
74
|
-
- `name`: The text that will be displayed for the option.
|
75
|
-
- `type`: The type of option. It can be `action` (executes a command), `navigation` (opens a submenu) or `custom-action` (executes a list of commands from other actions).
|
76
|
-
- `command`: The command to be executed (if the type is `action`).
|
77
|
-
- `idList`: A list of ids from other actions to be executed (if the type is `custom-action`).
|
78
|
-
- `confirm`: A boolean that indicates whether a confirmation should be requested before executing the command.
|
79
|
-
- `options`: An array of sub-options (if the type is `navigation`).
|
80
|
-
|
81
|
-
## License
|
82
|
-
|
83
|
-
This project is licensed under the MIT License.
|
84
|
-
|
85
|
-
## Author
|
86
|
-
|
87
|
-
- **Mateus Medeiros**
|
88
|
-
- GitHub: [@mateusmed](https://github.com/mateusmed)
|
89
|
-
- LinkedIn: [Mateus Medeiros](https://www.linkedin.com/in/mateus-med/)
|