Skip to content

Commit 1c1bad5

Browse files
committed
CLI Spec Proposal
1 parent bdf9c5a commit 1c1bad5

File tree

1 file changed

+110
-0
lines changed

1 file changed

+110
-0
lines changed

api/cli.md

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# Nucleus Command Line Interface
2+
3+
This is the spec for the minimum CLI options that nucleus implementations should expose.
4+
5+
Implementations may also expose platform, vm, and other sspecialty options not found in the other implementations in addition to these.
6+
7+
## nucleus [options] <file or dir> [--] ...
8+
9+
Execute nucleus with the provided options on the specified app bundle and provide it with arguments if specified.
10+
11+
The app bundle may be either a directory, a Zip file, or a JS file.
12+
13+
The following rules apply depending on what is provided:
14+
15+
##### Directory
16+
17+
The directory will be considered the app bundle and nucleus will attempt to execute the default `main.js` file.
18+
19+
##### Zip file
20+
21+
The zip file will be considered the app bundle and nucleus will read instead of it and attempt to execute the default main.js file.
22+
23+
##### JS file
24+
25+
The file's parent directory will be considered the app bundle and nucleus will attempt to execute the specified file.
26+
27+
If a file is provided in combination with the `-N`, `--no-bundle` option as specified below, app bundle file access restrictions will not apply.
28+
29+
### `-h`, `--help`
30+
31+
Prints CLI usage info including the spec options and executable name (or path), then exits with code `0`.
32+
33+
While all implementations must implement a help option, it is not required to look the same provided it lists all the basic options in this spec.
34+
35+
##### Example:
36+
37+
```
38+
Usage: nucleus FILE [options]
39+
40+
Options:
41+
-h, --help print this help menu
42+
-v, --version print the Nucleus version
43+
-o, --output FILE create a bundle with embedded nucleus at the specified file
44+
-l, --linked link nucleus instead of embedding
45+
-z, --zip-only create zip bundle without embedding
46+
-N, --no-bundle do not execute as a bundle
47+
```
48+
49+
### `-v`, `--version`
50+
51+
Prints the implementation and nucleus version, then exists with code `0`.
52+
53+
The output should follow this format:
54+
```
55+
<impl name> v<impl version> implementing Nucleus v<nucleus version>
56+
```
57+
58+
`<impl name>` should be the official name of the impl, but could be anything.
59+
60+
Versions must be valid [SemVer](http://semver.org/) versions in the format of `major.minor.patch` with a pre-pended `v`.
61+
62+
##### example:
63+
```
64+
rustyduk v0.0.0 implementing Nucleus v0.0.0
65+
```
66+
67+
### `-o`, `--output` `FILE`
68+
69+
Set an output filename for a zipped app bundle to be written to.
70+
71+
Nucleus will be embedded and the file will be given a permissions mode of `777` on applicable operating systems.
72+
73+
##### example:
74+
```
75+
nucleus ./my-app-folder -o my-app
76+
```
77+
78+
### `-l`, `--linked`
79+
80+
Requires the `-o`, `--output` option.
81+
82+
Instead of embedding nucleus, insert a shebang link to it at the beginning of the zipped app bundle.
83+
84+
The link should look like `#!/path/to/nucleus --\n`.
85+
86+
##### example:
87+
```
88+
nucleus ./my-app-folder -l -o my-app-linked
89+
```
90+
91+
### `-z`, `--zip-only`
92+
93+
Requires the `-o`, `--output` option.
94+
95+
Instead of embedding nucleus, only create a zipped app bundle.
96+
97+
##### example:
98+
```
99+
nucleus ./my-app-folder -z -o my-app-bundle
100+
```
101+
102+
### `-N`, `--no-bundle`
103+
104+
Do not execute in bundled mode.
105+
106+
This option requires that an exact file be specified for nucleus execute.
107+
108+
Any app bundle file access limitations must not apply when executing in this mode.
109+
110+
Useful for testing.

0 commit comments

Comments
 (0)