From 9f6c2ef73db84aa238d8bc044e3f0b858e53c785 Mon Sep 17 00:00:00 2001 From: Trevor Coleman Date: Mon, 16 Oct 2023 11:44:44 -0400 Subject: [PATCH] fix broken links in docs --- docs/README.md | 4 ++-- docs/plugins.md | 8 ++++---- docs/runtime.md | 19 +++++++------------ 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/docs/README.md b/docs/README.md index 33ed3f20..26f91e3a 100644 --- a/docs/README.md +++ b/docs/README.md @@ -103,9 +103,9 @@ module.exports = { } ``` -See the [toolbox api docs](./docs/toolbox-api.md) for more details on what you can do. +See the [toolbox api docs](/toolbox-api) for more details on what you can do. -See the [runtime docs](./docs/runtime.md) for more details on building your own CLI and join us in the #gluegun channel of the Infinite Red Community Slack ([community.infinite.red](http://community.infinite.red)) to get friendly help! +See the [runtime docs](/runtime) for more details on building your own CLI and join us in the #gluegun channel of the Infinite Red Community Slack ([community.infinite.red](http://community.infinite.red)) to get friendly help! # Who Is Using This? diff --git a/docs/plugins.md b/docs/plugins.md index 2260c974..8ebff7ec 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -33,7 +33,7 @@ module.exports = { description: 'Displays the name of an actor', hidden: false, dashed: false, - run: async toolbox => { + run: async (toolbox) => { const { print } = toolbox print.info(`Tom Hanks`) @@ -49,7 +49,7 @@ The `name` and `description` properties are used in `printCommands` calls to pri `dashed` lets you run the command as a dashed command, like `--version` or `-v`. -The `run` property should be a function (async or not) that does whatever you want it to. You'll receive the gluegun `toolbox` object which contains the [core extensions](./toolbox-api.md) and any additional extensions you've loaded. +The `run` property should be a function (async or not) that does whatever you want it to. You'll receive the gluegun `toolbox` object which contains the [core extensions](/toolbox-api) and any additional extensions you've loaded. ## templates @@ -61,7 +61,7 @@ Extensions are additional functionality that you can monkeypatch onto the `toolb ```js // extensions/sayhello.js -module.exports = toolbox => { +module.exports = (toolbox) => { const { print } = toolbox toolbox.sayhello = () => { @@ -74,7 +74,7 @@ When you have this extension, you can access it in any command file, like this: ```js // ... -run: async toolbox => { +run: async (toolbox) => { const { sayhello } = toolbox sayhello() diff --git a/docs/runtime.md b/docs/runtime.md index 723674f7..de9f2510 100644 --- a/docs/runtime.md +++ b/docs/runtime.md @@ -14,7 +14,7 @@ const cli = build('movie') .help() .version() .defaultCommand() - .command({ name: 'hi', run: toolbox => toolbox.print.info('hi!') }) + .command({ name: 'hi', run: (toolbox) => toolbox.print.info('hi!') }) .exclude(['filesystem', 'semver', 'system', 'prompt', 'http']) .checkForUpdates(5) // check for updates randomly about 5% of the time .create() @@ -65,7 +65,7 @@ $ movie producers "Planes, Trains, & Automobiles" --sort age ## plugin -Additional functionality can be added to the `gluegun` object with [plugins](./plugins.md). Plugins can be yours or your users. +Additional functionality can be added to the `gluegun` object with [plugins](/plugins/). Plugins can be yours or your users. _Hint: `src` and `plugin` are almost identical under the hood. The only thing they do differently is `src` will be loaded first and be the "default plugin"._ @@ -86,9 +86,7 @@ movie-credits You can load a plugin from a directory: ```js -const cli = build('movie') - .src(__dirname) - .plugin('~/.movie/movie-imdb') +const cli = build('movie').src(__dirname).plugin('~/.movie/movie-imdb') ``` ## plugins @@ -96,10 +94,7 @@ const cli = build('movie') You can also load multiple plugins within a directory. ```js -const cli = build('movie') - .src(__dirname) - .plugin('~/.movie/movie-imdb') - .plugins('./node_modules', { pattern: 'movie-' }) +const cli = build('movie').src(__dirname).plugin('~/.movie/movie-imdb').plugins('./node_modules', { pattern: 'movie-' }) ``` `plugins` supports a `fs-jetpack` [matching pattern](https://github.com/szwacz/fs-jetpack#findpath-searchoptions) so you can filter out a subset of directories instead of just all. @@ -189,7 +184,7 @@ const cli = build('movie') .help() .version() .defaultCommand() - .command({ name: 'hi', run: toolbox => toolbox.print.info('hi!') }) + .command({ name: 'hi', run: (toolbox) => toolbox.print.info('hi!') }) ``` In this case, if you ran `movie hi`, it would run the function provided and print out 'hi!'. @@ -266,7 +261,7 @@ const cli = build('movie') .help() .version() .defaultCommand() - .command({ name: 'hi', run: toolbox => toolbox.print.info('hi!') }) + .command({ name: 'hi', run: (toolbox) => toolbox.print.info('hi!') }) .checkForUpdates(5) ``` @@ -282,7 +277,7 @@ const cli = build('movie') .help() .version() .defaultCommand() - .command({ name: 'hi', run: toolbox => toolbox.print.info('hi!') }) + .command({ name: 'hi', run: (toolbox) => toolbox.print.info('hi!') }) .checkForUpdates(5) .create() ```