Skip to content

Commit

Permalink
doc(gh-pages): update doc and example to reflect changes
Browse files Browse the repository at this point in the history
update docs to reflect the removal of the get / set functions for
managing configuration
  • Loading branch information
esatterwhite committed Oct 31, 2021
1 parent e7fe759 commit 75365eb
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 25 deletions.
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ A command line interface the way you want it, and otherwise, stays out of your w
const os = require('os')
const cli = require('seeli')

cli.set({
cli.config({
exitOnError: true
, color: 'green'
, name: 'example'
Expand Down Expand Up @@ -129,8 +129,9 @@ node ./cli world --name=Mark --name=Sally --no-excited
* [Seeli.greenBright( text `<string>`)](#seeligreenbright-text-string)
* [Seeli.yellowBright( text `<string>`)](#seeliyellowbright-text-string)
* [Seeli.cyanBright( text `<string>`)](#seelicyanbright-text-string)
* [Seeli.set( key `<string>`, value `<object>` )](#seeliset-key-string-value-object-)
* [Seeli.get( key `<string>` )](#seeliget-key-string-)
* [Seeli.config( key `<string>`, value `<object>` )](#seeliconfig-key-string-value-object-)
* [Seeli.config( opts `<object>` )](#seeliconfig-opts-object-)
* [Seeli.config( key `<string>` )](#seeliconfig-key-string-)
* [Supported Confgurations](#supported-confgurations)
* [Package Configuration](#package-configuration)
* [Command( options `<object>` )](#command-options-object-)
Expand Down Expand Up @@ -213,11 +214,15 @@ wraps text in the ansi code for yellowBright

wraps text in the ansi code for cyanBright

## Seeli.set( key `<string>`, value `<object>` )
## Seeli.config( key `<string>`, value `<object>` )

sets a conf value.
sets a configuration value.

## Seeli.get( key `<string>` )
## Seeli.config( opts `<object>` )

set multiple configuration values using a single object

## Seeli.config( key `<string>` )

A config value to look up. Can be a dot separated key to look up nested values

Expand All @@ -230,7 +235,7 @@ A config value to look up. Can be a dot separated key to look up nested values
* plugins `<String>|<function>[]` - A list of plugins to load and execute. A plugin may be either a function, or a module id to be required.
If it is a module id, the module must export a single function which will be passed the seeli instance when called.
* help `<String>` - a file path or module name to a custom help command. This will be passed to `require` and must export a single command instance
* `seeli.set('help', '/path/to/help/command')`
* `seeli.config('help', '/path/to/help/command')`

##### Package Configuration

Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<span class="token keyword">return</span> <span class="token string">'hello world'</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre></div><h2 id="configuring-seeli"><a href="#configuring-seeli" class="header-anchor">#</a> Configuring Seeli</h2> <p>Seeli has a simple configuration system exposed as top level functions</p> <ul><li><code>seeli.get</code>: get the value of a configuration property</li> <li><code>seeli.set</code>: set the value of a configuration property</li></ul> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token string">'use strict'</span>
</code></pre></div><h2 id="configuring-seeli"><a href="#configuring-seeli" class="header-anchor">#</a> Configuring Seeli</h2> <p>Seeli has a simple configuration system exposed as top level functions</p> <ul><li><code>seeli.config</code>: get the value of a configuration property</li> <li><code>seeli.config</code>: set the value of a configuration property</li></ul> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token string">'use strict'</span>

<span class="token keyword">const</span> seeli <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">'seeli'</span><span class="token punctuation">)</span>
seeli<span class="token punctuation">.</span><span class="token function">set</span><span class="token punctuation">(</span><span class="token string">'exitOnError'</span><span class="token punctuation">,</span> <span class="token boolean">true</span><span class="token punctuation">)</span>
Expand Down
2 changes: 1 addition & 1 deletion gh-pages/examples/commands/sub.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

const seeli = require('seeli')
const name = seeli.colorize(seeli.get('name'))
const name = seeli.colorize(seeli.config('name'))

const bar = new seeli.Command({
name: 'bar'
Expand Down
15 changes: 9 additions & 6 deletions gh-pages/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Seeli has a `run` function that reads any arguments and flags from terminal inpu
and either executes the appropriate command, or displays help messages.

```javascript
// cli.js
'use strict'
var seeli = require('seeli')
seeli.run()
Expand Down Expand Up @@ -43,15 +44,17 @@ const command = new seeli.Command({

## Configuring Seeli

Seeli has a simple configuration system exposed as top level functions
* `seeli.get`: get the value of a configuration property
* `seeli.set`: set the value of a configuration property
Seeli has a simple configuration system exposed as a single function
* `seeli.config`: gets or sets configuration values based on inputs


```javascript
'use strict'

const seeli = require('seeli')
seeli.set('exitOnError', true)
seeli.config('exitOnError', true) // set a value
seeli.config('exitOnError') // get a value
seeli.config
```

There are a few global options you can manipulate to change basic behaviors
Expand All @@ -68,7 +71,7 @@ of seeli
'use strict'

const seeli = require('seeli')
seeli.set('color', 'red')
seeli.config('color', 'red')

console.log(seeli.colorize('this is red'))
```
Expand Down Expand Up @@ -269,7 +272,7 @@ $ npm link .
$ mycli
```

or if published the to npm registry
or if published the to the npm registry

```bash
$ npm install my-project -g
Expand Down
2 changes: 1 addition & 1 deletion gh-pages/guides/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ command should have a `name`, `description`, and some additional `usage` text.
'use strict'

const seeli = require('seeli')
const name = seeli.get('name')
const name = seeli.config('name')
module.exports = new seeli.Command({
name: 'simple'
, description: 'This is a simple example'
Expand Down
2 changes: 1 addition & 1 deletion gh-pages/guides/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const BasicCommand = require('./commands/basic')
module.exports = simplePlugin

function simplePlugin(seeli) {
seeli.set('color', 'magenta')
seeli.config('color', 'magenta')
seeli.use(BasicCommand)
}
```
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/plugin-a.fixture
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict'

module.exports = function(seeli) {
seeli.set('plugin_a_fixture', true)
seeli.config('plugin_a_fixture', true)
}
2 changes: 1 addition & 1 deletion test/fixtures/plugin-b.fixture
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict'

module.exports = function(seeli) {
seeli.set('plugin_b_fixture', true)
seeli.config('plugin_b_fixture', false)
}
12 changes: 6 additions & 6 deletions test/seeli.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ test('cli', async (t) => {
path.join(FIXTURE_DIR, 'plugin-a.fixture')
])
const seeli = new Seeli()
t.strictEqual(seeli.get('plugin_a_fixture'), true, 'plugin path loaded')
t.strictEqual(seeli.config('plugin_a_fixture'), true, 'plugin path loaded')
})

t.test('require path loader', async (t) => {
Expand All @@ -192,7 +192,7 @@ test('cli', async (t) => {
]
})

t.strictEqual(seeli.get('plugin_b_fixture'), true, 'plugin path loaded')
t.strictEqual(seeli.config('plugin_b_fixture'), false, 'plugin path loaded')
})

t.test('inline function loader', async (t) => {
Expand All @@ -201,15 +201,15 @@ test('cli', async (t) => {
name: 'manual'
})
s.reset()
s.set('inline_plugin', true)
s.config('inline_plugin', 1)
s.use(cmd)
}

const seeli = new Seeli({
plugins: [inline]
})

t.strictEqual(seeli.get('inline_plugin'), true, 'inline plugin loaded')
t.strictEqual(seeli.config('inline_plugin'), 1, 'inline plugin loaded')
t.deepEqual(seeli.list(), ['manual'], 'registered command list')
})

Expand All @@ -219,14 +219,14 @@ test('cli', async (t) => {
name: 'explicit'
})
s.reset()
s.set('outline_plugin', true)
s.config('outline_plugin', true)
s.use(cmd)
}

const seeli = new Seeli()
seeli.plugin(outline)

t.strictEqual(seeli.get('outline_plugin'), true, 'inline plugin loaded')
t.strictEqual(seeli.config('outline_plugin'), true, 'inline plugin loaded')
t.deepEqual(seeli.list(), ['explicit'], 'registered command list')
})

Expand Down

0 comments on commit 75365eb

Please sign in to comment.