Managing Charts
Concept
Chart is file unit containing sets of terminal command templates or code snippets and their properties, saved in json format as follows
1{
2 "kind": "git", // chart group name alphabet [A-Z] [a-z] with no space (yocan use underscore _ )
3 "description": "commander for Git", // chart group description
4 "charts": [ // collection of charts
5 {
6 "usage": "load test apache benchmark", // chart usage
7 "cmdt": "ab -n {{total_req}} -c {{total_concurrent}} {{target_url}}", // command or snippet template, use {{template}} to define template replacable by prompt
8 "type": "cmd",
9 "prompt": [ // promp definition to replace cmdt template
10 {
11 "tmplt": "total_req", // template associated with cmdt without double curly bracket
12 "label": "total request", // prompter label or intructions
13 "default": "10" // prompter default value
14 },
15 {
16 "tmplt": "total_concurrent",
17 "label": "total concurrent",
18 "default": "2"
19 },
20 {
21 "tmplt": "target_url",
22 "label": "url load test target",
23 "default": "https://github.com/"
24 }
25 ]
26 },
27 {
28 "usage": "unarchive tar file eg. .tar.gz",
29 "cmdt": "tar -xvf {{file_path}}",
30 "type": "cmd",
31 "prompt": [
32 {
33 "tmplt": "file_path",
34 "label": "archive file path",
35 "default": "mypath.tar.gz"
36 }
37 ]
38 }
39 ]
40}
Charts are located on your home directory ~/.commander by default. You can have more than one charts.
1.
2├── example_2.chart.json
3├── example_3.chart.json
4├── example_4.chart.json
5├── example_5.chart.json
6├── git.chart.json
7└── mychart.chart.json
8
90 directories, 6 files
Using self hosted charts repo
You can create own chart or use official published charts from https://alfiankan.github.io/commander-charts/charts or by host your on your own github pages.
- create your chart following
chart.json format. - push to github and create github page
- try to access your chart json like
myrepo.github.io/mychart/mychart.json - to download or share just tell and use commander command
cmdr get mychart -h=https://myrepo.github.io/mychart
Using main official Commander charts repo
- you can download all available charts by running
cmdr get --all - or just want to download single chart run
cmdr get <chart_name>, see charts name list at Charts
It's doable to contribute and publish to official chart by pulling request to https://github.com/alfiankan/commander-charts using valid chart format.