@@ -15,7 +15,8 @@ of them. That makes the manifest below the most important file in an extension:
1515it is what the CLI reads on startup, and it decides whether your code is loaded
1616eagerly or only when one of your commands is actually executed.
1717
18- ## Depending on the CLI
18+ Depending on the CLI
19+ --------------------
1920
2021An extension that imports anything from the CLI — ` defineCommand ` , ` inject ` , the
2122types — needs ` nativescript ` declared twice:
@@ -63,7 +64,8 @@ searches npm for it when it needs to suggest an extension for an unknown command
6364> heading; declaring the peer dependency now is what makes an extension ready
6465> for it.
6566
66- ## Declaring commands
67+ Declaring commands
68+ ------------------
6769
6870Commands are declared in the ` commands ` key of the ` nativescript ` key of the
6971extension's ` package.json ` . Two shapes are accepted.
@@ -162,7 +164,8 @@ instead. Run any command with `--log trace` to see which installed extensions
162164still rely on it, or set ` NS_DEPRECATIONS=warn ` to have those reports printed
163165as warnings.
164166
165- ## Writing a command module
167+ Writing a command module
168+ ------------------------
166169
167170The recommended shape is a module exporting a ` defineCommand ` definition (see
168171[ defining-commands.md] ( defining-commands.md ) ) — the CLI adapts and registers it
@@ -202,7 +205,8 @@ the command itself, executing that command fails with an error naming the
202205extension, the command and the module — the entry points at the wrong file, or
203206the file is not doing what the entry promises.
204207
205- ## Command names
208+ Command names
209+ -------------
206210
207211Command names use ` | ` to express hierarchy, so ` "hello|world" ` is invoked as
208212` ns hello world ` . Prefixing the last segment with ` * ` marks a default
@@ -233,7 +237,8 @@ An alias is a second entry pointing at the same module:
233237
234238Both names route to the same module, which is loaded once.
235239
236- ## When two extensions want the same command
240+ When two extensions want the same command
241+ -----------------------------------------
237242
238243The first extension to claim a command name keeps it; later claimants are
239244reported with a warning naming both extensions and the command, and their entry
@@ -247,7 +252,8 @@ extension name wins. The exception is `ns extension install`: that invocation
247252loads the freshly installed extension after all the others, so a conflict it
248253would win on the next invocation goes the other way that one time.
249254
250- ## Suggesting an extension for an unknown command
255+ Suggesting an extension for an unknown command
256+ ----------------------------------------------
251257
252258When a user types a command the CLI does not know, it searches npm for packages
253259carrying the ` nativescript:extension ` keyword, reads the ` nativescript.commands `
@@ -260,12 +266,13 @@ default command also matches its short form: an extension declaring
260266Both manifest shapes participate in this matching. If a match is found, the CLI
261267tells the user which extension provides the command and how to install it:
262268
263- ```
269+ ``` text
264270The command hello world is registered in extension nativescript-hello.
265271You can install it by executing 'ns extension install nativescript-hello'
266272```
267273
268- ## Documentation
274+ Documentation
275+ -------------
269276
270277Point the ` docs ` key of the ` nativescript ` key at a directory of ` .md ` files to
271278have the CLI's help system pick up the help for your commands.
0 commit comments