@flowscripter/example-cli 1.0.0
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/.github/workflows/check-bun-dependencies.yml +9 -0
- package/.github/workflows/lint-pr-message.yml +11 -0
- package/.github/workflows/release-bun-executable.yml +10 -0
- package/.github/workflows/validate-bun-executable-pr.yml +8 -0
- package/LICENSE +21 -0
- package/README.md +101 -0
- package/bun.lock +60 -0
- package/demo.svg +1 -0
- package/functional_tests/README.md +23 -0
- package/functional_tests/features/environment.py +9 -0
- package/functional_tests/features/executable.feature +6 -0
- package/functional_tests/features/steps/executable.py +18 -0
- package/functional_tests/features/support/pexpect_wrapper.py +45 -0
- package/functional_tests/pip-requirements.txt +2 -0
- package/index.ts +3 -0
- package/package.json +18 -0
- package/script/install.ps1 +31 -0
- package/script/install.sh +25 -0
- package/src/cli.ts +30 -0
- package/src/commands/command1.ts +74 -0
- package/src/commands/command2.ts +137 -0
- package/tests/cli_test.ts +16 -0
- package/tsconfig.json +27 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Flowscripter
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# example-cli
|
|
2
|
+
|
|
3
|
+
[](https://github.com/flowscripter/example-cli/releases)
|
|
4
|
+
[](https://github.com/flowscripter/example-cli/actions/workflows/release-bun-executable.yml)
|
|
5
|
+
[](https://codecov.io/gh/flowscripter/example-cli)
|
|
6
|
+
[](https://flowscripter.github.io/example-cli/index.html)
|
|
7
|
+
[](https://github.com/flowscripter/example-cli/blob/main/LICENSE)
|
|
8
|
+
|
|
9
|
+
> Simple example CLI using
|
|
10
|
+
> [dynamic-cli-framework](https://github.com/flowscripter/dynamic-cli-framework).
|
|
11
|
+
|
|
12
|
+
<img width="600" src="./demo.svg" alt="example-cli demo screen recording">
|
|
13
|
+
|
|
14
|
+
## Binary Executable Usage
|
|
15
|
+
|
|
16
|
+
**NOTE**: The binaries are 10's of megabytes in size as the entire Bun runtime
|
|
17
|
+
is included.
|
|
18
|
+
|
|
19
|
+
#### MacOS
|
|
20
|
+
|
|
21
|
+
Via [Homebrew](https://brew.sh/):
|
|
22
|
+
|
|
23
|
+
`brew install flowscripter/tap/example-cli`
|
|
24
|
+
|
|
25
|
+
#### Linux
|
|
26
|
+
|
|
27
|
+
In a terminal:
|
|
28
|
+
|
|
29
|
+
`curl -fsSL https://raw.githubusercontent.com/flowscripter/example-cli/main/script/install.sh | sh`
|
|
30
|
+
|
|
31
|
+
#### Windows
|
|
32
|
+
|
|
33
|
+
In PowerShell:
|
|
34
|
+
|
|
35
|
+
`curl -fsSL https://raw.githubusercontent.com/flowscripter/example-cli/main/script/install.ps1 | powershell`
|
|
36
|
+
|
|
37
|
+
#### Manual Install
|
|
38
|
+
|
|
39
|
+
You can download and extract the binary zip files from the
|
|
40
|
+
[releases](https://github.com/flowscripter/example-cli/releases) page.
|
|
41
|
+
|
|
42
|
+
## Functional Tests
|
|
43
|
+
|
|
44
|
+
Refer to [functional_tests/README.md](functional_tests/README.md)
|
|
45
|
+
|
|
46
|
+
## Development
|
|
47
|
+
|
|
48
|
+
Install dependencies:
|
|
49
|
+
|
|
50
|
+
`bun install`
|
|
51
|
+
|
|
52
|
+
Test:
|
|
53
|
+
|
|
54
|
+
`bun test`
|
|
55
|
+
|
|
56
|
+
Run:
|
|
57
|
+
|
|
58
|
+
`bun run index.ts`
|
|
59
|
+
|
|
60
|
+
> During development this can be used to validate command definitions:
|
|
61
|
+
>
|
|
62
|
+
> `CLI_VALIDATE_ALL=1 bun run index.ts`
|
|
63
|
+
|
|
64
|
+
> During development this can be used to enable framework logging:
|
|
65
|
+
>
|
|
66
|
+
> `CLI_DEBUG=1 bun run index.ts`
|
|
67
|
+
|
|
68
|
+
Compile binary:
|
|
69
|
+
|
|
70
|
+
`bun build index.ts --compile --outfile /tmp/example-cli`
|
|
71
|
+
|
|
72
|
+
**NOTE**: The following tasks use Deno as it excels at these and Bun does not
|
|
73
|
+
currently provide such functionality:
|
|
74
|
+
|
|
75
|
+
Format:
|
|
76
|
+
|
|
77
|
+
`deno fmt`
|
|
78
|
+
|
|
79
|
+
Lint:
|
|
80
|
+
|
|
81
|
+
`deno lint index.ts src/ tests/`
|
|
82
|
+
|
|
83
|
+
Generate HTML API Documentation:
|
|
84
|
+
|
|
85
|
+
`deno doc --html --name=example-cli index.ts`
|
|
86
|
+
|
|
87
|
+
## Documentation
|
|
88
|
+
|
|
89
|
+
Refer to the
|
|
90
|
+
[dynamic-cli-framework](https://github.com/flowscripter/dynamic-cli-framework)
|
|
91
|
+
documentation.
|
|
92
|
+
|
|
93
|
+
### API
|
|
94
|
+
|
|
95
|
+
Link to auto-generated API docs:
|
|
96
|
+
|
|
97
|
+
[API Documentation](https://flowscripter.github.io/example-cli/index.html)
|
|
98
|
+
|
|
99
|
+
## License
|
|
100
|
+
|
|
101
|
+
MIT © Flowscripter
|
package/bun.lock
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lockfileVersion": 1,
|
|
3
|
+
"workspaces": {
|
|
4
|
+
"": {
|
|
5
|
+
"name": "@flowscripter/example-cli",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@flowscripter/dynamic-cli-framework": "^1.0.3",
|
|
8
|
+
},
|
|
9
|
+
"devDependencies": {
|
|
10
|
+
"@types/bun": "^1.2.4",
|
|
11
|
+
},
|
|
12
|
+
"peerDependencies": {
|
|
13
|
+
"typescript": "^5.8.2",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
"packages": {
|
|
18
|
+
"@flowscripter/dynamic-cli-framework": ["@flowscripter/dynamic-cli-framework@1.0.3", "", { "dependencies": { "emphasize": "^7.0.0", "fastest-levenshtein": "^1.0.16", "figlet": "^1.8.0", "highlight.js": "^11.11.1", "supports-color": "^10.0.0", "ts-log": "^2.2.7" }, "peerDependencies": { "typescript": "^5.8.2" } }, "sha512-VjQeGRRVVzOsm3d0G7chwkDblS0ec0HbO8AasQNwvy21XFmdigvQ+fVn6BLd7HboWMtp0MFXSxoslRgDGtiGsw=="],
|
|
19
|
+
|
|
20
|
+
"@types/bun": ["@types/bun@1.2.4", "", { "dependencies": { "bun-types": "1.2.4" } }, "sha512-QtuV5OMR8/rdKJs213iwXDpfVvnskPXY/S0ZiFbsTjQZycuqPbMW8Gf/XhLfwE5njW8sxI2WjISURXPlHypMFA=="],
|
|
21
|
+
|
|
22
|
+
"@types/hast": ["@types/hast@3.0.4", "", { "dependencies": { "@types/unist": "*" } }, "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ=="],
|
|
23
|
+
|
|
24
|
+
"@types/node": ["@types/node@22.13.9", "", { "dependencies": { "undici-types": "~6.20.0" } }, "sha512-acBjXdRJ3A6Pb3tqnw9HZmyR3Fiol3aGxRCK1x3d+6CDAMjl7I649wpSd+yNURCjbOUGu9tqtLKnTGxmK6CyGw=="],
|
|
25
|
+
|
|
26
|
+
"@types/unist": ["@types/unist@3.0.3", "", {}, "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q=="],
|
|
27
|
+
|
|
28
|
+
"@types/ws": ["@types/ws@8.5.14", "", { "dependencies": { "@types/node": "*" } }, "sha512-bd/YFLW+URhBzMXurx7lWByOu+xzU9+kb3RboOteXYDfW+tr+JZa99OyNmPINEGB/ahzKrEuc8rcv4gnpJmxTw=="],
|
|
29
|
+
|
|
30
|
+
"bun-types": ["bun-types@1.2.4", "", { "dependencies": { "@types/node": "*", "@types/ws": "~8.5.10" } }, "sha512-nDPymR207ZZEoWD4AavvEaa/KZe/qlrbMSchqpQwovPZCKc7pwMoENjEtHgMKaAjJhy+x6vfqSBA1QU3bJgs0Q=="],
|
|
31
|
+
|
|
32
|
+
"chalk": ["chalk@5.4.1", "", {}, "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w=="],
|
|
33
|
+
|
|
34
|
+
"dequal": ["dequal@2.0.3", "", {}, "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA=="],
|
|
35
|
+
|
|
36
|
+
"devlop": ["devlop@1.1.0", "", { "dependencies": { "dequal": "^2.0.0" } }, "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA=="],
|
|
37
|
+
|
|
38
|
+
"emphasize": ["emphasize@7.0.0", "", { "dependencies": { "@types/hast": "^3.0.0", "chalk": "^5.0.0", "highlight.js": "~11.9.0", "lowlight": "~3.1.0" } }, "sha512-jdFCDyt+YetBXO12VwK4AiLsMCvkZ3IBxMVIJddB+25EwIL0VETBgpvPkJl63+JyAgaQ5Wja10qWMoXXC95JNg=="],
|
|
39
|
+
|
|
40
|
+
"fastest-levenshtein": ["fastest-levenshtein@1.0.16", "", {}, "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg=="],
|
|
41
|
+
|
|
42
|
+
"figlet": ["figlet@1.8.0", "", { "bin": { "figlet": "bin/index.js" } }, "sha512-chzvGjd+Sp7KUvPHZv6EXV5Ir3Q7kYNpCr4aHrRW79qFtTefmQZNny+W1pW9kf5zeE6dikku2W50W/wAH2xWgw=="],
|
|
43
|
+
|
|
44
|
+
"highlight.js": ["highlight.js@11.11.1", "", {}, "sha512-Xwwo44whKBVCYoliBQwaPvtd/2tYFkRQtXDWj1nackaV2JPXx3L0+Jvd8/qCJ2p+ML0/XVkJ2q+Mr+UVdpJK5w=="],
|
|
45
|
+
|
|
46
|
+
"lowlight": ["lowlight@3.1.0", "", { "dependencies": { "@types/hast": "^3.0.0", "devlop": "^1.0.0", "highlight.js": "~11.9.0" } }, "sha512-CEbNVoSikAxwDMDPjXlqlFYiZLkDJHwyGu/MfOsJnF3d7f3tds5J3z8s/l9TMXhzfsJCCJEAsD78842mwmg0PQ=="],
|
|
47
|
+
|
|
48
|
+
"supports-color": ["supports-color@10.0.0", "", {}, "sha512-HRVVSbCCMbj7/kdWF9Q+bbckjBHLtHMEoJWlkmYzzdwhYMkjkOwubLM6t7NbWKjgKamGDrWL1++KrjUO1t9oAQ=="],
|
|
49
|
+
|
|
50
|
+
"ts-log": ["ts-log@2.2.7", "", {}, "sha512-320x5Ggei84AxzlXp91QkIGSw5wgaLT6GeAH0KsqDmRZdVWW2OiSeVvElVoatk3f7nicwXlElXsoFkARiGE2yg=="],
|
|
51
|
+
|
|
52
|
+
"typescript": ["typescript@5.8.2", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ=="],
|
|
53
|
+
|
|
54
|
+
"undici-types": ["undici-types@6.20.0", "", {}, "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg=="],
|
|
55
|
+
|
|
56
|
+
"emphasize/highlight.js": ["highlight.js@11.9.0", "", {}, "sha512-fJ7cW7fQGCYAkgv4CPfwFHrfd/cLS4Hau96JuJ+ZTOWhjnhoeN1ub1tFmALm/+lW5z4WCAuAV9bm05AP0mS6Gw=="],
|
|
57
|
+
|
|
58
|
+
"lowlight/highlight.js": ["highlight.js@11.9.0", "", {}, "sha512-fJ7cW7fQGCYAkgv4CPfwFHrfd/cLS4Hau96JuJ+ZTOWhjnhoeN1ub1tFmALm/+lW5z4WCAuAV9bm05AP0mS6Gw=="],
|
|
59
|
+
}
|
|
60
|
+
}
|