Skip to content

Commit

Permalink
Add readme with example
Browse files Browse the repository at this point in the history
  • Loading branch information
xmonader committed Apr 26, 2018
1 parent e563da0 commit 119e523
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,37 @@
# nim-dmidecode
dmidecode parser in nim


## Example

```
let sample1 = """
# dmidecode 3.1
Getting SMBIOS data from sysfs.
SMBIOS 2.6 present.
Handle 0x0001, DMI type 1, 27 bytes
System Information
Manufacturer: LENOVO
Product Name: 20042
Version: Lenovo G560
Serial Number: 2677240001087
UUID: CB3E6A50-A77B-E011-88E9-B870F4165734
Wake-up Type: Power Switch
SKU Number: Calpella_CRB
Family: Intel_Mobile
"""
import dmidecode, tables
var obj : Table[string, dmidecode.Section]
obj = parseDMI(sample)
for secname, sec in obj:
echo secname & " with " & $len(sec.props)
for k, p in sec.props:
echo "k : " & k & " => " & p.val
if len(p.items) > 0:
for i in p.items:
echo "\t\t I: ", i
```
1 change: 0 additions & 1 deletion src/dmidecode.nim
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ proc parseDMI* (source: string) : Table[string, Section]=
if s != nil:
sects[s.title] = s
continue

if state == sectionName:
s.title = l
state = readKeyValue
Expand Down

0 comments on commit 119e523

Please sign in to comment.