Skip to content

Commit 8876e69

Browse files
committed
Update readme
1 parent dda0fea commit 8876e69

File tree

1 file changed

+35
-18
lines changed

1 file changed

+35
-18
lines changed

README.md

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ A Python module for handling config files. It helps handles persist config files
44

55
> Easily load and persist config without having to think about where and how
66
7-
It's built base on nodejs [configstore](https://github.com/yeoman/configstore)
7+
It's built base on nodejs [configstore](https:#github.com/yeoman/configstore)
88

99
Config is stored in a JSON file located in `$XDG_CONFIG_HOME` or `~/.localconfig`.<br>
1010
Example: `~/.localconfig/configstore/name.json`
@@ -20,49 +20,51 @@ pip install pyconfig
2020
```python
2121
from pyconfig import ConfigStore
2222

23-
// create a Configstore instance with a unique name e.g. gnit
24-
// Package name and optionally some default values
23+
# create a Configstore instance with a unique name e.g. gnit
24+
# Package name and optionally some default values
2525
conf = ConfigStore("Gnit", {"foo": 'bar'});
2626

2727
print(conf.get('foo'));
28-
//>>> 'bar'
28+
#>>> 'bar'
2929

3030
conf.set('awesome', True);
3131
print(conf.get('awesome'));
32-
//>>> True
32+
#>>> True
3333

34-
// Use dot-notation to set nested properties
34+
# Use dot-notation to set nested properties
3535
conf.set('bar.baz', True);
3636
print(conf.get('bar'));
37-
//>>> {"baz": True}
37+
#>>> {"baz": True}
38+
39+
# escape dot-notation to set nested properties
40+
conf.set('bar.baz\\.bag', True);
41+
print(conf.get('bar'));
42+
#>>> {"baz.bag": True}
3843

3944
conf.delete('awesome');
4045
print(conf.get('awesome'));
41-
//>>>
46+
#>>>
4247
```
4348

44-
4549
## API
4650

47-
### Configstore(packageName, [defaults], [options])
51+
### Configstore(packageName, [defaults], globalConfigPath)
4852

4953
Returns a new instance.
5054

5155
#### packageName
5256

53-
Type: `string`
57+
Type: `str`
5458

5559
Name of your package.
5660

5761
#### defaults
5862

59-
Type: `Object`
63+
Type: `dicts`
6064

6165
Default config.
6266

63-
#### options
64-
65-
##### globalConfigPath
67+
#### globalConfigPath
6668

6769
Type: `bool`<br>
6870
Default: `False`
@@ -97,9 +99,9 @@ Delete an item.
9799

98100
Delete all items.
99101

100-
### .all
102+
### .all()
101103

102-
Get all the config as an object or replace the current config with an object:
104+
Get all the config as a dict or replace the current config with an object:
103105

104106
```python
105107
conf.all({
@@ -115,8 +117,23 @@ Get the item count.
115117

116118
Get the path to the config file. Can be used to show the user where the config file is located or even better open it for them.
117119

120+
## Contribute
121+
122+
Yes, you can contribute. Just dm on <twitter:[@OyetokeT](http://twitter.com/@OyetokeT)>
123+
124+
## TODO
125+
126+
There are couple of things I still need to add
127+
128+
1. Dot-notation: Currently, you can only set configs using this feature. (get, delete)
129+
130+
2. Stream: I planned to add a param that'll indicate that you want it to hit the file for every operation. Well that's how it works currently though. But to make it smarter, we don't need to hit the file for (size, get, has, all) operation. We are going to call the `.all()` to get the configs and do the operation just using dict properties.
131+
132+
and more...
118133

119134
## License
120135
Copyright - 2018
121-
Oyetoke Toby <twitter:@OyetokeT>
136+
137+
Oyetoke Toby <twitter:[@OyetokeT](http://twitter.com/@OyetokeT)>
138+
122139
MIT LICENSE

0 commit comments

Comments
 (0)